TextDraws not updating after a specific period of server ticks.
#1

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?
Reply
#2

have you set TextDrawSetString under OnPlayerUpdate?
Reply
#3

No, of course not.
Reply
#4

Then how it's updating if not?

Let me give an example:


PHP код:
new Text:Textdraw8[MAX_PLAYERS];

public 
OnGameModeinit()
{
    
Textdraw8[i] = TextDrawCreate(4.000000181.999969"");
    
TextDrawLetterSize(Textdraw8[i], 0.4499991.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(string2sizeof(string2), "Ping: %d"GetPlayerPing(playerid));
    
TextDrawSetString(Textdraw8[playerid], string2);
    
TextDrawShowForPlayer(playeridTextdraw8[playerid]);
    return 
1;

something like that
Reply
#5

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?
Reply
#6

@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])
Reply
#7

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

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
Reply
#9

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
Reply
#10

Well, ill need the timer to 1 sec.

@Tro: It did not work, something else's wrong.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)