Posts: 47
Threads: 8
Joined: Dec 2018
Reputation:
0
I'm doing a custom "hud" for my server, which will hide the original of the game and show new images of the weapons (in version 0.3.DL). It will show the weapon that the player currently has in his hands. Where can I use this code to update it? Use the "OnPlayerUpdate" callback to update or use a "timer" in "OnPlayerConnect"?
What is more recommendable and efficient?
Posts: 41
Threads: 0
Joined: Jan 2019
well you only need to update players hud, when player switches to other weapon. So you create timer what compares players weapon at the moment and server side weapon, when they are different you update hud model.
Posts: 47
Threads: 8
Joined: Dec 2018
Reputation:
0
Yes, I know I have to update, that's why I ask the question. Should I use "OnPlayerUpdate" to update or should I use a "timer" in some callback? What is more advisable and efficient?
I explained everything in the publication!
Posts: 41
Threads: 0
Joined: Jan 2019
well i think i would go 1 sec timer, because onplayerupdate check rate is too high, but onplayerupdate could also use gettickcount to make it update in every 1 sec and other benefit is that it wont be called when player is afk.
you can try both methods and check what fits best for this system.
Posts: 47
Threads: 8
Joined: Dec 2018
Reputation:
0
Thank you!
Someone to give me a concrete answer of what I am asking, thank you very much.
Posts: 47
Threads: 8
Joined: Dec 2018
Reputation:
0
Oh thanks. This is the answer I was looking for. By the way, is not it necessary to use a timer instead of 'OnPlayerUpdate'?
Posts: 4,885
Threads: 57
Joined: Jun 2012
Reputation:
0
You want to update this when the player updates, this kind of feature needs to update as fast as possible yes a timer would work but OPU has a variable update rate depending on what the player is doing.
Posts: 47
Threads: 8
Joined: Dec 2018
Reputation:
0
Ok, I will use 'OnPlayerUpdate'. If I had used a timer, would it go to OnPlayerConnect?