SA-MP Forums Archive
[HELP] prison timer seconds - 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: [HELP] prison timer seconds (/showthread.php?tid=559444)



[HELP] prison timer seconds - Luca12 - 23.01.2015

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.


Re: [HELP] prison timer seconds - SV - 23.01.2015

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.


Re: [HELP] prison timer seconds - Luca12 - 23.01.2015

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


Re: [HELP] prison timer seconds - Schneider - 23.01.2015

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


Re: [HELP] prison timer seconds - Luca12 - 23.01.2015

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


Re: [HELP] prison timer seconds - Schneider - 23.01.2015

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..


Re: [HELP] prison timer seconds - Luca12 - 23.01.2015

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;
}



Re: [HELP] prison timer seconds - Lenon - 23.01.2015

Where did you put you SetTimer or SetTimerEx function?


Re: [HELP] prison timer seconds - Luca12 - 23.01.2015

in jail command


Re: [HELP] prison timer seconds - Lenon - 23.01.2015

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

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