SA-MP Forums Archive
[Help] Getting time from a 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [Help] Getting time from a timer... (/showthread.php?tid=126892)



[Help] Getting time from a timer... - Fedee! - 10.02.2010

Well, I have got a automatic vehicle respawner(made with a timer), every 1 hour the server respawns automaticly the vehicles. What I need to do, is to get the remaining time before it respawns again. Like, if you type /time shows me the remaining time. Just like /jail on GodFather.
Thanks in advance


Re: [Help] Getting time from a timer... - Joe Staff - 10.02.2010

You can use GetTickCount() for this.

pawn Код:
new gTimeTick;
public timerfunction()
{
  gTimeTick=GetTickCount()+(60*(60*1000));
  //your code
}

//OnPayerCommandText
  if(!strcmp(cmdtext[1],"timeleft",true))
  {
    new tmpstr[128];
    format(tmpstr,128,"%d minutes and %d seconds remaining until vehicle respawn",((gTimeTick-GetTickCount())/60000),((gTimeTick-GetTickCount())-((gTimeTick-GetTickCount())/60000)*60000)/1000);
    SendClientMessage(playerid,0xFF0000FF,tmpstr);
    return 1;
  }



Re: [Help] Getting time from a timer... - Fedee! - 10.02.2010

Quote:
Originally Posted by Joe Staff
You can use GetTickCount() for this.

pawn Код:
new gTimeTick;
public timerfunction()
{
  gTimeTick=GetTickCount()+(60*(60*1000));
  //your code
}

//OnPayerCommandText
  if(!strcmp(cmdtext[1],"timeleft",true))
  {
    new tmpstr[128];
    format(tmpstr,128,"%d minutes and %d seconds remaining until vehicle respawn",((gTimeTick-GetTickCount())/60000),((gTimeTick-GetTickCount())-((gTimeTick-GetTickCount())/60000)*60000)/1000);
    SendClientMessage(playerid,0xFF0000FF,tmpstr);
    return 1;
  }
LOOOL, today I was asking myself for what was GetTickCount() xDD

Thanks !!