Jailtimer - 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: Jailtimer (
/showthread.php?tid=119806)
Jailtimer -
Razvann - 09.01.2010
Код:
KillTimer(jailtimer);
Код:
jailtimer = SetTimer("JailTi", 1000, 1);
Код:
public JailTi()
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if (PlayerInfo[i][pJailed] == 1)
{
new string[128];
format(string, sizeof(string),"~n~~n~~n~~n~~n~~n~~n~~h~~h~Jail Time: ~h~~h~%d seconds",PlayerInfo[i][pJailTime] - 1);
GameTextForPlayer(i, string, 5000000, 3);
}
}
}
the gametext doesen't appear when I'm in jail.
Re: Jailtimer -
SiJ - 09.01.2010
Код:
public JailTi()
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i)
{
if (PlayerInfo[i][pJailed] == 1)
{
new string[128];
format(string, sizeof(string),"~n~~n~~n~~n~~h~~h~Jail Time: ~h~~h~%d seconds",PlayerInfo[i][pJailTime] - 1);
GameTextForPlayer(i, string, 500000, 3);
}
}
}
}
Try this.. Dunno if it helps.. :S
And i think your text goes off screen because of too many ~n~
Re: Jailtimer -
Razvann - 09.01.2010
Same

.
Re: Jailtimer -
SiJ - 09.01.2010
Try debugging:
Код:
public JailTi()
{
print("JailTi has been called!");
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i)
{
if (PlayerInfo[i][pJailed] == 1)
{
new string[128];
format(string, sizeof(string),"~n~~n~~n~~n~~h~~h~Jail Time: ~h~~h~%d seconds",PlayerInfo[i][pJailTime] - 1);
GameTextForPlayer(i, string, 500000, 3);
}
}
}
}
And check if it will print you "Jail timer called" to console.. If it won't that means that you made some errors not in timer..
Re: Jailtimer -
Razvann - 09.01.2010
Thank you MAN, NOW IT'S WORKING!
Re: Jailtimer -
x-unit - 21.01.2010
don't work
Re: Jailtimer -
Razvann - 21.01.2010
Here you are, mine works:
forwards
news
//GameModeExitFunc()
Код:
KillTimer(jailtimer);
//OnGameModeInit()
Код:
jailtimer = SetTimer("JailTi", 1000, 1);
//publics
Код:
public JailTi()
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if (PlayerInfo[i][pJailed] == 1)
{
new string[128];
format(string, sizeof(string),"~n~~n~~n~~n~~n~~n~~n~~h~~h~Jail Time: ~h~~h~%d seconds", PlayerInfo[i][pJailTime] - 1);
GameTextForPlayer(i, string, 5000000, 3);
}
}
}