Posts: 1,534
Threads: 129
Joined: Jan 2012
Reputation:
0
18.02.2014, 06:10
(
Последний раз редактировалось newbienoob; 22.02.2014 в 13:52.
)
In performance/optimization?
Posts: 1,534
Threads: 129
Joined: Jan 2012
Reputation:
0
Maybe I still need to know this..
Posts: 1,363
Threads: 14
Joined: Apr 2009
Reputation:
0
each is better in its own way, it depends on the situation
Posts: 10,066
Threads: 38
Joined: Sep 2007
Reputation:
0
I only use OnPlayerUpdate as an entry point for custom callbacks. Generally, when you know something has to be done, use a timer (e.g. anti-cheat timer). When you don't know, use OnPlayerUpdate (e.g. a player changing a weapon).
Posts: 166
Threads: 0
Joined: Feb 2013
Quote:
Originally Posted by cessil
each is better in its own way, it depends on the situation
|
^ This. If one was better than the other, why would we have both? If you only want to run something at a set interval, use a timer - using GetTickCount in OnPlayerUpdate is almost exactly what timers do anyway, so you are just duplicating effort. If you want something to happen as often as possible when a player's data changes, use OnPlayerUpdate.
Asking about "performance" and "optimisation" is the wrong thing to ask because I guarantee that any trivial differences between the two will be meaningless compared to the code you are running within the functions.