Jump to content

Strange problem


Drakath

Recommended Posts

Posted (edited)

I have element data called: "data". The script sets data to 0.

Then I use 'onElementDataChange'

if getElementData(source,"data") == 10 then

outputChatBox("k", source, 0, 255, 0, true)

And for some players it outputs k. How is this possible, if I ask data to be 10 and it stills passes the condition?

Usually everything works fine but for some people it happens. Why?

Everything is server side.

Edited by Guest
Posted

I really dont understand you fully but you said

if I ask data to be 10 and it stills passes the condition?

Well if its 10 then of course it will pass because you are checking if it's equal to 10.

Posted

Oh, I provided incorrect information. Data is set to 10 by client, then server sets it to 0 and finally server checks data with 'onElementDataChange'. and it is still 10.

Posted

The element data is synced with all clients and the server so each time you change it client side or server side the event 'onElementDataChange' and 'onClientElementDataChange' will get triggered unless the element doesn't exist on the other side or you choose to not sync the data, the event won't get triggered on the other side.

Posted

https://wiki.multitheftauto.com/wiki/SetElementData

bool setElementData ( element theElement, string key, var value [, bool synchronize = true ] ) 

Set synchronize argument to false if you don't want the data to be synced.

Player is always exist in both side, An example of element that does not exist in both side such as GUI only exist in client side.

Posted

So how come few players were able to pass the condition several times? They said that they could not pass it anymore after reconnect.

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