/report timer - 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: /report timer (
/showthread.php?tid=448401)
/report timer -
TranquiliZed - 04.07.2013
I have /report How can make it so they have to wait 30 seconds before reporting again? Will put some code if I need.
Re: /report timer -
RedFusion - 04.07.2013
Use GetTickCount() and not a timer.
pawn Code:
new pReportTick[MAX_PLAYERS];
CMD:report(playerid, params[])
{
if(GetTickCount() - pReportTick[playerid] < 30*1000 && pReportTick[playerid] != 0)
{
//Error message goes here (Wait 30 seconds)
return 1;
}
//Report code goes here
pReportTick[playerid] = GetTickCount();
return 1;
}
Re: /report timer -
Konstantinos - 04.07.2013
It's not necessary to use timers (keep in mind that the use of many timers cause lag). You can use GetTickCount or tickcount functions.
https://sampforum.blast.hk/showthread.php?tid=370955
Re: /report timer -
feartonyb - 04.07.2013
On top of script:
new ReportTime[MAX_PLAYERS];
forward ReportTimer(playerid);
Then make a public:
public ReportTimer(playerid)
{
ReportTime[playerid] = 0;
return 1;
}
Then add under /report command:
if(ReportTime[playerid] == 1) return SendClientMessage(playerid, -1, "You can use this command each 30 seconds!");
ReportTime[playerid] = 1;
SetTimerEx("ReportTimer", 30000, false, "i", playerid);