Get how far the timer is? - 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: Get how far the timer is? (
/showthread.php?tid=337800)
Get how far the timer is? -
Jstylezzz - 27.04.2012
Hi SA-MP,
Is there any possibility to get how far the timer is?
Like, when someone types /stats, he sees how long it takes till he receives his paycheck?
Thanks
Re: Get how far the timer is? -
Crazymax - 27.04.2012
yes.... its possible, search.
https://sampwiki.blast.hk/wiki/GetTickCount
https://sampwiki.blast.hk/wiki/SetTimer
Re: Get how far the timer is? -
Jstylezzz - 27.04.2012
ow, sry
![Wink](images/smilies/wink.png)
Thanks for helping
Respuesta: Get how far the timer is? -
TheChaoz - 27.04.2012
you can do something like this:
pawn Код:
new Time[MAX_PLAYERS];
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/timetogetpay", true))
{
new str[40]
format(str, 40, "Time to get your pay: %i seconds", (Time[playerid]-GetTickCount())/1000);
SendClientMessage(playerid, -1, str);
return 1;
}
return 0;
}
forward MyTimer(playerid);
public MyTimer(playerid)
{
//Supose the timer interval to be 10000ms
Time[playerid] = GetTickCount()+10000;
//do something here
}
Re: Respuesta: Get how far the timer is? -
Jstylezzz - 27.04.2012
Quote:
Originally Posted by the_chaoz
you can do something like this:
pawn Код:
new Time[MAX_PLAYERS];
public OnPlayerCommandText(playerid, cmdtext[]) { if(!strcmp(cmdtext, "/timetogetpay", true)) { new str[40] format(str, 40, "Time to get your pay: %i seconds", (Time[playerid]-GetTickCount())/1000); SendClientMessage(playerid, -1, str); return 1; } return 0; }
forward MyTimer(playerid); public MyTimer(playerid) { //Supose the timer interval to be 10000ms Time[playerid] = GetTickCount()+10000; //do something here }
|
Yeah, thanks, i think i will use this one