[HELP] prison timer seconds
#1

Hello I have set a timer when is player prisoned (/prison) and when the player is in prison he get textdraw how much time is in jail Jailed: and here is in textdraw seconds

but the problem is know I prison myself on 10 min which is 600 seconds and when I prisoned the timer goes like

598 596 594 always for two seconds at once if you know what I mean. How can I make that timer goes like

599 598 597 596 etc...

Thanks.
Reply
#2

Hi,

You propably have in your gamemode a timer which will re-set the time of time left in prison, Your current one is setting after two seconds ( 2000 µs ), Set it to ( 1000 µs ) and your server will goes like this.
  1. 599
  2. 598
  3. 597
  4. 596
  5. ect.
P.S : Search for the timer in your TextDraw.
Reply
#3

JailTimer[playerid] = SetTimerEx("JailTimerLeft",1000,1,"d",playerid); // this is for setting timer for one player .
Reply
#4

You are lowering the amount of seconds with 2 each time...
Reply
#5

how you mean isn't it 1000 - 1 second
? Thanks
Reply
#6

No, i mean the value. If it's showing as 598 596 594 592 it looks like is subtracting 2 seconds...
Show us the code..
Reply
#7

in public JailTimeLeft is

pawn Код:
forward JailTimerLeft(playerid);
public JailTimerLeft(playerid)
{
    if(PlayerInfo[playerid][pJailed] != 0)
    {
         PlayerInfo[playerid][pJailTime] -= 1;
         new string[128];
         format(string,sizeof(string),"%d",PlayerInfo[playerid][pJailTime]);
         TextDrawSetString(Text2,string);
         TextDrawShowForPlayer(playerid,Text:Text1);
         TextDrawShowForPlayer(playerid,Text:Text2);
    }
    else
    {
         KillTimer(JailTimer[playerid]);
         TextDrawHideForPlayer(playerid,Text:Text1);
         TextDrawHideForPlayer(playerid,Text:Text2);
     }
     return 1;
}
Reply
#8

Where did you put you SetTimer or SetTimerEx function?
Reply
#9

in jail command
Reply
#10

Put this under OnGameModeInit, this is just to check something, post here if it counts right:

Код:
SetTimer("JailTimerLeft", 1000, true);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)