SA-MP Forums Archive
OnPlayerUpdate - 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: OnPlayerUpdate (/showthread.php?tid=505245)



OnPlayerUpdate - vassilis - 07.04.2014

Will the server lag or will i have any problems if i for example make a callback which saves the user database and then use this inside.. OnPlayerUpdate so it saves user file continually or should i make a timer ?


Re: OnPlayerUpdate - Vince - 07.04.2014

Writing to disk in OnPlayerUpdate is the worst thing you could possibly do. Better to use a 10, 20, 30 minute timer or write changes the instant they're changed.


Re: OnPlayerUpdate - iBanner - 07.04.2014

Why onplayerupdate? when you can save them under onplayerdeath? anyway I tried before saving player database under onplayerupdate and I can feel the delay, for me adding timer in onplayerupdate will make things worst. But let us see if someone recommend better.


Re: OnPlayerUpdate - vassilis - 07.04.2014

Quote:
Originally Posted by Vince
Посмотреть сообщение
Writing to disk in OnPlayerUpdate is the worst thing you could possibly do. Better to use a 10, 20, 30 minute timer or write changes the instant they're changed.
So you suggest me to use a timer.. OK thanks Vince this is what i wanted actually to here because i wasn't sure.. ! Thanks.
But i set the timer onplayerconnect ?


Re: OnPlayerUpdate - Lidor124 - 07.04.2014

Quote:
Originally Posted by vassilis
Посмотреть сообщение
So you suggest me to use a timer.. OK thanks Vince this is what i wanted actually to here because i wasn't sure.. ! Thanks.
But i set the timer onplayerconnect ?
You set a timer under public OnGameModeInit() because you need a global timer (SetTimer not SetTimerEx)


Re: OnPlayerUpdate - vassilis - 07.04.2014

Quote:
Originally Posted by Lidor124
Посмотреть сообщение
You set a timer under public OnGameModeInit() because you need a global timer (SetTimer not SetTimerEx)
Ok i understand now thanks