| Blockland Forums > Help |
| Console stops my add-on from working. |
| (1/1) |
| TeeJay:
So, here's something I whipped up in boredom: --- Quote ---package TeeBot { case "ded" function serverCmdKillMe(%client) %client.player.kill(); case "disconnect": function makeClientQuit(%client) case "Thanks": echo "TeeBot: Thank you for-a playing my game-a!" case "plsno": echo "TeeBot: plsys mm bby" case "barrel roll": echo "DO A BARREL ROLL" case "pro mode": echo "360 noscop cawwadute bhop so cul guise" }; activatePackage("TeeBot"); --- End quote --- I'm still a beginner, so dont go hard on me :c Anyways, the console keeps stopping it from turning on because it says that everything with case is an error. Can you guys help a beginner out? |
| phflack:
because it is an error, also this should go in coding help case is used in switch statements, to check if the inputted value is something you can do the same thing with a list of if statements, it's just easier with a switch statement to use cases, do --- Code: ---switch(%value) { case 5: echo("ducks"); case 4: echo("%value is 4"); default: echo("%value isn't 4 or 5"); } --- End code --- this may need break; at the end of each case and before the next case |
| phflack:
i think what you're trying to do though is package some functions? --- Code: ---package teebot { function serverCmdded(%client) { %client.player.kill(); } function serverCmddisconnect(%client) { makeClientQuit(%client); } function makeClientQuit(%client) { switch$(%client.name) { case "Thanks": echo("TeeBot: Thank you for-a playing my game-a!"; //and so on... } } } --- End code --- not sure what you're trying to do at parts, and overriding the disconnect function might not be a good idea |
| Navigation |
| Message Index |