Jump to content

Question about setElementData & getElementData


Overkillz

Recommended Posts

Posted

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.

Posted

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.

Posted
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.

  • Like 1
Posted

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.

Posted
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.

  • Moderators
Posted

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.

Posted

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 :P

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...