Blockland Forums > Modification Help
Server commands
takato14:
Would this be the proper syntax to create a server command? Please note I am somewhat new to scripting.That means dont be a prick, just tell me if Im doing it wrong.
--- Code: ---function ServerCMDNuke(%this, %slot, %obj)
{
if(%obj.client.issuperadmin)
{
case yes
{
%NukesAllowed = 1;
messageAll('',"\c2Nukes are now allowed.");
}
case no
{
%NukesAllowed = 0;
messageAll('',"Nukes are no longer allowed.");
}
}
else
{
%obj.messageClient('',"\c2Only SuperAdmins may use this command!");
}
}
--- End code ---
Note that I am almost entirely guessing this is how I would do it(I've taken JavaScript before, so I have some of an idea of what Im doing.)
EDIT: Tested, and I failed. So, how would one do this correctly?
phflack:
not sure how the case yes/no would work, i'd just have a nested if
takato14:
--- Quote from: phflack on January 02, 2011, 12:46:40 AM ---not sure how the case yes/no would work, i'd just have a nested if
--- End quote ---
Thats what I was going to do, but I didnt know what I needed to put into the parenthesis. Do you?
phflack:
well, for a server command, i think you can put anything in them :D
takato14:
--- Quote from: phflack on January 02, 2011, 12:49:57 AM ---well, for a server command, i think you can put anything in them :D
--- End quote ---
What's something that always returns true? x_x
Also, could you give an example? Remember, Im sorta new to this.