Blockland Forums > Modification Help

Toggling Command

Pages: (1/2) > >>

jes00:

How can you script something so you type /altwarner and it toggles my script on/off?

Greek2me:


--- Code: ---function serverCmdToggleMod(%client)
{
$varThatEnablesDisablesYourMod = !$varThatEnablesDisablesYourMod;
//and any other stuff you need to toggle
}
--- End code ---


jes00:

So I just put that in and it toggles everything?

tyler0:

Here... kinda messy but it works...



--- Code: ---function serverCmdCOMMANDNAME(%client) {

if(%sentcommand.commandname == "") {
%sentcommand.commandname = 0;
}

if(%sentcommand.commandname == 1) {
//turn off
%sentcommand.commandname = 0;
} else {
//turn on
%sentcommand.commandname = 1;
}
}
--- End code ---

hope this is what you needed

jes00:

I tried

--- Code: ---function serverCmdIPUTMYCOMMANDHERE(%client) {

if(%sentcommand.Iputmycommandhere == 1) {
//turn off
%sentcommand.Iputmycommandhere = 0;
messageClient(%client, '', "\c6jes00s mod had been turned \c5off\c6.");
} else {
//turn on
%sentcommand.Iputmycommandhere = 1;
messageClient(%client, '', "\c6jes00s mod has been turned \c5on\c6.");

}
}

--- End code ---
and it did not work.

Pages: (1/2) > >>

Go to full version