Help with this code.
#1

Hello, I have a good stat textdraw is using a timer to actualize, but the problem is that titilea lot when there is a bit of lag -.- And annoying haha.
pawn Код:
new Text:Stats[MAX_PLAYERS];
new Estadisticas[MAX_PLAYERS];

Estadisticas[playerid] = SetTimerEx("Actualizar",400,1,"e",playerid);

    for(new playerid; playerid < MAX_PLAYERS; playerid++) {
    Stats[playerid] = TextDrawCreate(.........................
    }
forward Actualizar(playerid);
public Actualizar(playerid)
{
     new strr[128];
     TextDrawHideForPlayer(playerid,Stats[playerid]);
    format(strr, sizeof(strr), " ~r~Score: ~w~%d ~g~Kills: ~w~%d ~b~Deaths: ~w~%d",PlayerInfo[playerid][Score],PlayerInfo[playerid][Kills],PlayerInfo[playerid][Deaths]);
    TextDrawSetString(Stats[playerid],strr);
    TextDrawShowForPlayer(playerid,Stats[playerid]);
    return 1;
}
Reply
#2

Define the problem more clearly, I have no idea what you mean.
Reply
#3

Some thoughts:
Do you really need to update the textdraw every 400ms?
I don't think that it changes that quickly...


Just update the textdraw when the stats change.

Also, having that many timers is bad.
Reply
#4

Either change the timer to 10 seconds or only update the textdraw when the stats actually change which is the best way. Also, you don't need to hide and show the textdraw, you can just set the string.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)