[Help] Getting time from a timer...
#1

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

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

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 !!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)