Disabling Commands .. ? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Disabling Commands .. ? (
/showthread.php?tid=84324)
Disabling Commands .. ? -
•Ajax• - 30.06.2009
Ey' guys. I was wondering If you can disable a command, I'm making a CnR (which will be a lot different to previous CnR's). I want a 2 (120s) minute timer which I can create myself to re-enable the command. Does anybody know and / or have experience with this?
Re: Disabling Commands .. ? -
Ignas1337 - 30.06.2009
umm do you mean like this?:
pawn Код:
new cmdUsed[MAX_PLAYERS];
OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/command", true)==0)
{
if(cmdUsed[playerid]) return SendClientMessage(playerid, 0xFFFFFFFF, "You must wait 2 minutes before using the cmd again.");
// do the command thing here and...
cmdUsed[playerid] = 1;
SetTimerEx("resetCmd", 120000, 0, "i");
return 0;
}
return 0;
}
public resetCmd(i)
{
cmdUsed[i] = 0;
}
Re: Disabling Commands .. ? -
•Ajax• - 30.06.2009
Quote:
Originally Posted by Thanatos
umm do you mean like this?:
pawn Код:
new cmdUsed[MAX_PLAYERS];
OnPlayerCommandText(playerid, cmdtext[]) { if(strcmp(cmdtext, "/command", true)==0) { if(cmdUsed[playerid]) return SendClientMessage(playerid, 0xFFFFFFFF, "You must wait 2 minutes before using the cmd again."); // do the command thing here and... cmdUsed[playerid] = 1; SetTimerEx("resetCmd", 120000, 0, "i"); return 0; } return 0; }
public resetCmd(i) { cmdUsed[i] = 0; }
|
That works fine, thanks.
Re: Disabling Commands .. ? -
Ignas1337 - 30.06.2009
no problem :P