Jailtimer
#1

Код:
new jailtimer;
Код:
KillTimer(jailtimer);
Код:
jailtimer = SetTimer("JailTi", 1000, 1);
Код:
forward JailTi();
Код:
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.
Reply
#2

Код:
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~
Reply
#3

Same .
Reply
#4

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..
Reply
#5

Thank you MAN, NOW IT'S WORKING!
Reply
#6

don't work
Reply
#7

Here you are, mine works:
forwards
Код:
forward JailTi();
news
Код:
new jailtimer;
//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);
		}
	}
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)