SA-MP Forums Archive
/smoke system , i need help. - 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: /smoke system , i need help. (/showthread.php?tid=104366)



/smoke system , i need help. - Frank_Brown - 24.10.2009

Hello,

How can i make that you can do /smoke only every 2 minutes ?

Thanks



Re: /smoke system , i need help. - Frank_Brown - 24.10.2009

with a timer ? how can i make that?


Re: /smoke system , i need help. - MadeMan - 24.10.2009

pawn Код:
new SmokeWait[MAX_PLAYERS];
forward SmokeTimer(playerid);
Where your /smoke command is:
pawn Код:
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
pawn Код:
public SmokeTimer(playerid)
{
    SmokeWait[playerid] = 0; // Now player can smoke again
}