How To desactivate a command -
Dragonoir - 22.02.2009
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
Re: How To desactivate a command -
Mikep - 22.02.2009
1. Use [ pawn ] tags
2. Speak English
3. Come again?
Re: How To desactivate a command -
Dragonoir - 22.02.2009
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 -.-
Re: How To desactivate a command -
Mikep - 22.02.2009
I do want to help but I can't understand a word your saying.
Re: How To desactivate a command -
Dragonoir - 22.02.2009
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
Re: How To desactivate a command -
Mikep - 22.02.2009
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.
Re: How To desactivate a command -
Dragonoir - 22.02.2009
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
Re: How To desactivate a command -
yom - 22.02.2009
- 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.
Re: How To desactivate a command -
JaYmE - 22.02.2009
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 !");
}
Re: How To desactivate a command -
Mikep - 22.02.2009
Quote:
Originally Posted by JaYmE
OMG, and you told him to use [pwn] tags :P
|
One line doesn't need [ pawn ] tags.