Overkillz Posted August 17, 2017 Share Posted August 17, 2017 Hey dear community, today im here to ask you if I use setElementData and getElementData on a function which has as event onClientRender will give me problems ? I have used it but I would like to know everything about it. Thanks for reading, regards. Link to comment
itHyperoX Posted August 17, 2017 Share Posted August 17, 2017 I'm not using getElementData in render, but its up to you. Im using onClientElementDataChange. 1 Link to comment
Overkillz Posted August 17, 2017 Author Share Posted August 17, 2017 Well, It could help me, but not at all. For example. If Im specting to some player who is in any vehicle and that vehicle has nitro and nitro is being used. If u switch to another player and switch back to the previous player and try to get the nitro level with the funciton GetVehicleNitroLevel you are not going to get the real nitro level. It gets restarted everytime. Thats why I want to use setElementData on a render (I want to do a draw with the real nitro level). Regards. Link to comment
Dretax Posted August 17, 2017 Share Posted August 17, 2017 10 minutes ago, Overkillz said: Well, It could help me, but not at all. For example. If Im specting to some player who is in any vehicle and that vehicle has nitro and nitro is being used. If u switch to another player and switch back to the previous player and try to get the nitro level with the funciton GetVehicleNitroLevel you are not going to get the real nitro level. It gets restarted everytime. Thats why I want to use setElementData on a render (I want to do a draw with the real nitro level). Regards. getElementData and set are totally safe to use upon rendering. In fact they should be faster since they only sync upon change. You may also use MTA functions in renders and heavier map distance calculations. Panel rendering is going to eat your FPS a bit though, but there is no other way around unless you find a custom sort of way to load things like I did which fits your needs. 1 Link to comment
N3xT Posted August 18, 2017 Share Posted August 18, 2017 I won't recommend you to use data with onClientRender event, If you can use variables will be better. Wiki: it can generate a lot of network traffic and consume server CPU. Link to comment
Dretax Posted August 18, 2017 Share Posted August 18, 2017 15 hours ago, N3xT said: I won't recommend you to use data with onClientRender event, If you can use variables will be better. Wiki: it can generate a lot of network traffic and consume server CPU. Only upon sync. Link to comment
Moderators IIYAMA Posted August 20, 2017 Moderators Share Posted August 20, 2017 Even if you disable the sync argument, it probably will trigger the onClientElementDataChange event. But it shouldn't be too bad if you use it. But I do recommend you to set the elementdata only when it isn't the same as the previous value. Link to comment
koragg Posted August 21, 2017 Share Posted August 21, 2017 I'm using setElementData with onClientRender to sync nitro in my server. There's no (noticable) difference from how it was before other than fixing my nos meter that is Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now