SA-MP Forums Archive
Ingame lagg because of 3dtextlabel - 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)
+--- Thread: Ingame lagg because of 3dtextlabel (/showthread.php?tid=483891)



Ingame lagg because of 3dtextlabel - SplinteX - 28.12.2013

Hello!!

In my server when i type /aod (Admin on Duty!) it creates label at my head,and if other admins do that (/aod),and if I am close to them (to the label) my FPS are getting low and my game is really lagging,it happens to all players on server,not just me.Could you tell me whats wrong for that lag in my code?Please fix it:

Код:
public OnPlayerUpdate(playerid)
{
 if(aDuty[playerid] == 1)
 {
 Adminlabel[playerid] = Create3DTextLabel("Admin On Duty!",COLOR_ADMIN,30.0,40.0,50.0,40.0,0);
 Attach3DTextLabelToPlayer(Adminlabel[playerid],playerid,0.0, 0.0, 0.7);
 }
 else if(aDuty[playerid] == 0)
 {
 Delete3DTextLabel(Adminlabel[playerid]);
 }
 return 1;
}



Re: Ingame lagg because of 3dtextlabel - Excelize - 28.12.2013

It's because you're using OnPlayerUpdate, which is going to make it REALLY laggy. Use a timer instead, don't need to make it fast, make it around 5-10 seconds.