timer after command - 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)
+--- Thread: timer after command (
/showthread.php?tid=476131)
timer after command -
kingcrome - 16.11.2013
How can i add a timer so
. Vip use command /kitvip.
How can i make a timer so person cant use command after like 20min
Re: timer after command -
Diogo123 - 16.11.2013
pawn Code:
new Temp[MAX_PLAYERS];
//OnPlayerConnect:
Temp[playerid] = 0;
//Begin the command
if(gettime() - Temp[playerid] < 20) return SendClientMessage(playerid, 0xFF0000FF, "Wait time is up");
Temp[playerid] = gettime();
change the 20 to the value you want
AW: timer after command -
Skimmer - 16.11.2013
Simple. Create a variable, which saves the time of using the command.
pawn Code:
new KITVIP_TICKER[MAX_PLAYERS];
pawn Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/kitvip", cmdtext, true, 10) == 0)
{
if((gettime() - KITVIP_TICKER[playerid]) < ((1000 * 60) * 20)) return SendClientMessage(playerid, -1, "Please wait before using this command again.");
KITVIP_TICKER[playerid] = gettime();
// The command
return 1;
}
return 0;
}
Don't forgot to reset variable after quit. (OnPlayerDisconnect)