24.10.2009, 10:26
Hello,
How can i make that you can do /smoke only every 2 minutes ?
Thanks
How can i make that you can do /smoke only every 2 minutes ?
Thanks

new SmokeWait[MAX_PLAYERS];
forward SmokeTimer(playerid);
if(SmokeWait[playerid] == 1) // If player has been smoking lately
{
SendClientMessage(playerid, 0xFFFFFFFF, "You have to wait before smoking again");
return 1;
}
SmokeWait[playerid] = 1; // Set this variable to 1 so player can't smoke next time
SetTimerEx("SmokeTimer", 120000, false, "i", playerid); // Timer to clear the variable after 2 minutes so player can smoke again
public SmokeTimer(playerid)
{
SmokeWait[playerid] = 0; // Now player can smoke again
}