TextDraws not updating after a specific period of server ticks. - iLearner - 12.03.2017
Hello,
I've recently had a problem regarding trxtdraws, thing is that I have a 'Stats monitor' (DayZ server) for each player which updates every second with a timer (time alive etc), but with this recent problem this monitor only works for few hours and then... It stops and the values are set to default (e.g name: loading... Kills:99 etc), with some tests and inquiries it came out that it works for 9 hours after (approx) server start, and then this problem occurs.
Its not only with stats monitor, but other textdraws that have to be updated as well, e.g vehicle fuel engine & tires information. So I guess it in general something with textdraws.
Unfortunately I don't have a recent backup either (got 1 which I took 1 month ago) so I have no choice other then fixing it.
Anyone has any clue what might be wrong / causing it?
Re: TextDraws not updating after a specific period of server ticks. -
RyderX - 12.03.2017
have you set TextDrawSetString under OnPlayerUpdate?
Re: TextDraws not updating after a specific period of server ticks. - iLearner - 12.03.2017
No, of course not.
Re: TextDraws not updating after a specific period of server ticks. -
RyderX - 12.03.2017
Then how it's updating if not?
Let me give an example:
PHP код:
new Text:Textdraw8[MAX_PLAYERS];
public OnGameModeinit()
{
Textdraw8[i] = TextDrawCreate(4.000000, 181.999969, "");
TextDrawLetterSize(Textdraw8[i], 0.449999, 1.600000);
TextDrawAlignment(Textdraw8[i], 1);
TextDrawColor(Textdraw8[i], -1);
TextDrawSetShadow(Textdraw8[i], 0);
TextDrawSetOutline(Textdraw8[i], 1);
TextDrawBackgroundColor(Textdraw8[i], 51);
TextDrawFont(Textdraw8[i], 1);
TextDrawSetProportional(Textdraw8[i], 1);
return 1;
}
public OnPlayerUpdate(playerid)
{
new string2[128];
format(string2, sizeof(string2), "Ping: %d", GetPlayerPing(playerid));
TextDrawSetString(Textdraw8[playerid], string2);
TextDrawShowForPlayer(playerid, Textdraw8[playerid]);
return 1;
}
something like that
Re: TextDraws not updating after a specific period of server ticks. -
Toroi - 12.03.2017
Are you using a global timer?
If so, check if there's something in the script that could kill the timer mistakenly.
Debug it with printf to see if the timer is actually running when you face the problem.
By the way, are you using a
foreach loop inside the timer by chance?
Re: TextDraws not updating after a specific period of server ticks. - iLearner - 12.03.2017
@Ryder: Timers buddy timers.
@Tro: Yea a global timer with 1sec interval, and no timer ain't being killed.
Ye I am using foreach (or for can't say precisely as I ain't at PC).
Edit: For each with y_timers (timer UpdatePlayer[1000])
Re: TextDraws not updating after a specific period of server ticks. -
Toroi - 12.03.2017
Whenever you get to your PC, change the foreach loop for a normal
for player loop and test it like that; I faced a similar problem with a foreach loop, sometimes nothing of the function wanted to execute although there were no mistakes in it, I changed it for a normal player loop and it has been working fine until now, that MAY be the problem.
Re: TextDraws not updating after a specific period of server ticks. - iLearner - 12.03.2017
As I've said I haven't touched that timer function so far, and it has been working for years, its probably something to do with textdraws in general.
I'll try your suggestion though, but I doubt its the reason
Re: TextDraws not updating after a specific period of server ticks. -
SyS - 12.03.2017
Quote:
Originally Posted by Troydere
Whenever you get to your PC, change the foreach loop for a normal for player loop and test it like that; I faced a similar problem with a foreach loop, sometimes nothing of the function wanted to execute although there were no mistakes in it, I changed it for a normal player loop and it has been working fine until now, that MAY be the problem.
|
This problem is due to iter_add was not setup for filter script initialization. Konstantinos once gave me a patch in which he fixed this issue. This bug is not found on GMs. I will share that link (wait...lemme search in ma pms).
@ilearner try changing the time of repeat to 5 secs and view. The calling of timer and doing a task like that sometimes causes this.
Edit : got it
http://www.filedropper.com/foreach31_1 try it @Troydere
Re: TextDraws not updating after a specific period of server ticks. - iLearner - 12.03.2017
Well, ill need the timer to 1 sec.
@Tro: It did not work, something else's wrong.