How To desactivate a command
#9

Quote:
Originally Posted by Mikep
Use a variable, e.g:

new waron[MAX_PLAYERS];

To turn it off:

waron[playerid] = 0;

Replace 0 with 1 to enable it again.

Use

if(waron[playerid] == 0) return whatever

in your command to disable it.
OMG, and you told him to use [pwn] tags :P

Just a lil more info

At top of script

pawn Код:
new WarStatus = 0|1; // 0 for disabled and 1 for enabled when the server starts will be changed later
and these simple commands in the OnPlayerCommandText() Callback

pawn Код:
if(strcmp("/toggle-war", cmdtext, true) == 0 ) {
  if ( WarStatus == 0 ) {
    WarStatus = 1;
  } else {
    WarStatus = 0;    
  }
  return 1;
}

/ /And

if ( WarStatus == 1 ) {

  if(strcmp("/warww", cmdtext, true) == 0 ) {
    if (GetPlayerMoney(playerid) < 5000)
    {
       GameTextForPlayer(playerid,"You Got No Money",1000,0);
    }
    else
    {
    SendClientMessage(playerid, 0x33AA33AA, "Welcome To Server At War");
    SetPlayerPos(playerid, -2160.8521, 158.0676, 62.1094);
    GivePlayerMoney(playerid, -1000);
    ResetPlayerWeapons(playerid);
    GivePlayerWeapon(playerid, 24, 9999);
    GivePlayerWeapon(playerid, 27, 9999);
    SetPlayerArmour(playerid, 100);
    return 1;
  }

} else {
  SendClientMessage(playerid, color, "War is deactivated !");
}
Reply


Messages In This Thread
How To desactivate a command - by Dragonoir - 22.02.2009, 11:47
Re: How To desactivate a command - by Mikep - 22.02.2009, 11:48
Re: How To desactivate a command - by Dragonoir - 22.02.2009, 11:50
Re: How To desactivate a command - by Mikep - 22.02.2009, 11:53
Re: How To desactivate a command - by Dragonoir - 22.02.2009, 11:55
Re: How To desactivate a command - by Mikep - 22.02.2009, 11:59
Re: How To desactivate a command - by Dragonoir - 22.02.2009, 12:01
Re: How To desactivate a command - by yom - 22.02.2009, 12:03
Re: How To desactivate a command - by JaYmE - 22.02.2009, 12:31
Re: How To desactivate a command - by Mikep - 22.02.2009, 14:21

Forum Jump:


Users browsing this thread: 1 Guest(s)