OnPlayerUpdate optimize question..
#1

Hi. Which is more efficient and faster ?
I will use for anti cheats/hacks but player connect the server lag problems.
For Example:

- GetTickCount:

Код:
new count[MAX_PLAYERS];
Код:
public OnPlayerUpdate(playerid)
{
     if(GetTickCount() - count[playerid] > 1000){
     count[playerid] = GetTickCount();
     new Float:animX, Float:animY, Float:animZ;
     new anim = GetPlayerAnimationIndex(playerid);
     GetPlayerPos(playerid, animX, animY, animZ);
     if((anim >= 1538) && (anim <= 1544) || (anim == 1250) || (anim == 1062) && animZ > 5 || animZ > -5){
     BanEx(playerid, "Anim Hack");}
     return 0;
}
     return 1;
}
- Call a public/stock functions:
Код:
public OnPlayerConnect(playerid){
     SetTimerEx("Bla", 1000, true, "i", playerid);
     return 1;
}
Код:
forward Bla(playerid);
public Bla(playerid){
     new Float:animX, Float:animY, Float:animZ;
     new anim = GetPlayerAnimationIndex(playerid);
     GetPlayerPos(playerid, animX, animY, animZ);
     if((anim >= 1538) && (anim <= 1544) || (anim == 1250) || (anim == 1062) && animZ > 5 || animZ > -5){
     BanEx(playerid, "Anim Hack");}
     return true;
}
Reply
#2

I suggest creating a timer, because it will cause you less lagg on your server.
Reply
#3

Why creating a new timer? Search maybe you have another 1s timer and use global timer no per player
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)