Blockland Forums > Modification Help

Toggling Command

Pages: << < (2/2)

tyler0:


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

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

there you go

jes00:


--- Quote from: tyler0 on June 14, 2011, 06:26:18 PM ---
--- Code: ---function serverCmdmycmd(%client) {

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

there you go

--- End quote ---
Still not working.

Destiny/Zack0Wack0:

You actually need to replace the variable with the variable that controls your mod.

jes00:


--- Quote from: Destiny/Zack0Wack0 on June 14, 2011, 08:15:59 PM ---You actually need to replace the variable with the variable that controls your mod.

--- End quote ---
I replaced all the "mycmd"s.

Greek2me:

Simply use this code. Replace $varThatEnablesDisablesYourMod with the actual variable that enables your mod.


--- Quote from: Greek2me on June 14, 2011, 05:05:02 PM ---
--- Quote ---function serverCmdToggleMod(%client)
{
   $varThatEnablesDisablesYourMod = !$varThatEnablesDisablesYourMod;
   //and any other stuff you need to toggle
}
--- End quote ---

--- End quote ---
Note the ! before the bolded variable. That makes it the opposite of what the variable was.

Pages: << < (2/2)

Go to full version