How To desactivate a command
#1

Hello , can someone say me how do i turn off a command like this one:

if(!strcmp("/warww", cmdtext, true))
{
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;

I want to make a command which desactive that one. Because i want to make him just like a event.
Thank you for your attention
Reply
#2

1. Use [ pawn ] tags
2. Speak English
3. Come again?
Reply
#3

Quote:
Originally Posted by Mikep
1. Use [ pawn ] tags
2. Speak English
3. Come again?
You just post things non-sense? if you dont wanna help then dont post omg... you talk about my english of course is not my native language but if you want to talk portuguese with me come one b0tzor -.-
ps: Keep out more posts like that they are stupid -.-
Reply
#4

I do want to help but I can't understand a word your saying.
Reply
#5

Quote:
Originally Posted by Mikep
I do want to help but I can't understand a word your saying.
Man i want to make a command which desactivate the /warww , a command like /waroff which dont allow players use it
Reply
#6

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.
Reply
#7

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.
Ok Thanks For The help
Reply
#8

- Create a new bool variable at top of script.

- Set it to either true or false in the admin command to turn on/off the /warww command.

- Check it's value in the /warww command:
- if it's value is true then the command is enabled, do what you want.
- if it's false, then command is disabled, send error message or whatever.
Reply
#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
#10

Quote:
Originally Posted by JaYmE
OMG, and you told him to use [pwn] tags :P
One line doesn't need [ pawn ] tags.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)