OnplayerUpdate alternative?
#1

Hello,

i read over the bad points of onplayerupdate...so i created my own function "playerUpdate()"...so if i use this function whenever you disconnect (for that player ONLY) and every 5 minutes (for whole server) will that be okay instead of using onplayerupdate?

thanks for help
Reply
#2

yes, that's fine the thing with OnPlayerUpdate is that it's called ~40times a second depends what you need it for every 5 minutes should be fine
Reply
#3

You should use something like this, if you don't use already ^^

pawn Код:
forward PlayerUpdate();

OnGameModeInit()
{
    SetTimer("PlayerUpdate",1000,1);
}
public PlayerUpdate()
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            //Do something here
        }
    }
}
Reply
#4

I was wondering would it be better to use 'GetTickCount' in onplayerupdate to update a mode, eg,
pawn Код:
new UpdateTime;
pawn Код:
UpdateTime = GetTickCount() + 120000;//gm/fs init
pawn Код:
public OnPlayerUpdate(playerid)
{
    if(GetTickCount() > UpdateTime)
    {
        //mode update stuff here
       
        UpdateTime = GetTickCount() + 120000;
    }
    return 1;
}
Or would that be worse/less efficient than using a repeating timer?

ps, Sorry if its a bit offtopic.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)