How do i enable and disable commands? -
Coolman12 - 16.04.2009
As the title says
i've been trying for a while now, but i can't seem to figure it out
(got to sleep now, be back tomorrow)
Re: How do i enable and disable commands? -
Backwardsman97 - 17.04.2009
Like all commands or individual ones?
Re: How do i enable and disable commands? -
Coolman12 - 17.04.2009
Quote:
Originally Posted by backwardsman97
Like all commands or individual ones?
|
individual ones
Re: How do i enable and disable commands? -
Kirkmaster10 - 17.04.2009
You could put // Round it or /*
Re: How do i enable and disable commands? -
Coolman12 - 17.04.2009
Quote:
Originally Posted by HarryKirkby
You could put // Round it or /*
|
yea, i know that
but i mean when i'm ingame, with another command.
(is it possible?)
Re: How do i enable and disable commands? -
tom_jonez - 17.04.2009
Make a new variable, allow the cmd if the variable ==1, disable it if it equals 0
Re: How do i enable and disable commands? -
ruarai - 17.04.2009
i think you can with some variables behind all the commands and some commands setting those variables so yes it is possible as it is seen in alot of gms
Re: How do i enable and disable commands? -
streetzuk - 17.04.2009
In your script you could add a variable to turn the command on or off.
example:
Код:
if(strcmp(cmdtext, "/cash", true) == 0 && CmdInUse == 1) {
GivePlayerMoney(playerid, 100000);
return 1;
}
Turn the cash command on:
Код:
if(strcmp(cmdtext, "/Cashon", true) == 0) {
CmdInUse[playerid] =1;
return 1;
}
Turn the cash command off:
Код:
if(strcmp(cmdtext, "/Cashoff", true) == 0) {
CmdInUse[playerid] =0;
return 1;
}
Re: How do i enable and disable commands? -
Pyrokid - 17.04.2009
Quote:
Originally Posted by Infamous
In your script you could add a variable to turn the command on or off.
example:
Код:
if(strcmp(cmdtext, "/cash", true) == 0 && CmdInUse == 1) {
GivePlayerMoney(playerid, 100000);
return 1;
}
Turn the cash command on:
Код:
if(strcmp(cmdtext, "/Cashon", true) == 0) {
CmdInUse[playerid] =1;
return 1;
}
Turn the cash command off:
Код:
if(strcmp(cmdtext, "/Cashoff", true) == 0) {
CmdInUse[playerid] =0;
return 1;
}
|
That would give an error. It should be:
Код:
if(strcmp(cmdtext, "/cash", true) == 0 && CmdInUse[playerid] == 1) {
GivePlayerMoney(playerid, 100000);
return 1;
}
Turn the cash command on:
Код:
if(strcmp(cmdtext, "/Cashon", true) == 0) {
CmdInUse[playerid] =1;
return 1;
}
Turn the cash command off:
Код:
if(strcmp(cmdtext, "/Cashoff", true) == 0) {
CmdInUse[playerid] =0;
return 1;
}
Re: How do i enable and disable commands? -
streetzuk - 18.04.2009
Ah yes i missed a "[playerid]"