| Blockland Forums > Modification Help |
| [Solved] Keybind Question [Thanks Destiny/Zack0Wack0 and Amade!] |
| << < (2/2) |
| Destiny/Zack0Wack0:
You need to put curly braces {} around conditionals (except if its only one line). Also, you've commented out the one line statement in the else and it's using the last } as the one line of code instead. |
| jes00:
--- Quote from: Destiny/Zack0Wack0 on November 11, 2011, 06:50:41 PM ---You need to put curly braces {} around conditionals (except if its only one line). Also, you've commented out the online statement in the else and it's using the last } as the one line of code instead. --- End quote --- So this? --- Code: ---function NightVisionToggle(%client) { if(!%down) { if($NightVision::isOn == 1) { NightVision.setVisible(0); $NightVision::isOn = 0; } else if($NightVision::isOn == 0) { NightVision.setVisible(1); $NightVision::isOn = 1; } } else echo("Night vision toggled."); } --- End code --- |
| Greek2me:
--- Quote from: Destiny/Zack0Wack0 on November 11, 2011, 06:50:41 PM ---You need to put curly braces {} around conditionals (except if its only one line). Also, you've commented out the online statement in the else and it's using the last } as the one line of code instead. --- End quote --- Basically you can't have else statements just floating there. |
| Destiny/Zack0Wack0:
--- Quote from: jes00 on November 11, 2011, 06:59:13 PM ---So this? --- Code: ---function NightVisionToggle(%client) { if(!%down) { if($NightVision::isOn == 1) { NightVision.setVisible(0); $NightVision::isOn = 0; } else if($NightVision::isOn == 0) { NightVision.setVisible(1); $NightVision::isOn = 1; } } else echo("Night vision toggled."); } --- End code --- --- End quote --- %client shouldn't be there, it should be %down. |
| jes00:
--- Quote from: Destiny/Zack0Wack0 on November 11, 2011, 07:31:42 PM ---%client shouldn't be there, it should be %down. --- End quote --- It works, thanks! |
| Navigation |
| Message Index |
| Previous page |