Ingame lagg because of 3dtextlabel
#1

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;
}
Reply
#2

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


Forum Jump:


Users browsing this thread: 1 Guest(s)