/report timer
#1

I have /report How can make it so they have to wait 30 seconds before reporting again? Will put some code if I need.
Reply
#2

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;
}
Reply
#3

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
Reply
#4

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);
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)