Drakath Posted June 7, 2014 Posted June 7, 2014 (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 June 7, 2014 by Guest
MIKI785 Posted June 7, 2014 Posted June 7, 2014 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.
Drakath Posted June 7, 2014 Author Posted June 7, 2014 Data is 0. It should pass the condition if data is 10 but it passes with 0.
MIKI785 Posted June 7, 2014 Posted June 7, 2014 Well that's impossible, change the "k" to getElementData(source, "data") and see what the value is.
Drakath Posted June 7, 2014 Author Posted June 7, 2014 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.
TAPL Posted June 7, 2014 Posted June 7, 2014 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.
Drakath Posted June 7, 2014 Author Posted June 7, 2014 How can I check if my data is synced and how to check if player doesn't exist on the other side?
TAPL Posted June 7, 2014 Posted June 7, 2014 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.
Drakath Posted June 7, 2014 Author Posted June 7, 2014 So how come few players were able to pass the condition several times? They said that they could not pass it anymore after reconnect.
TAPL Posted June 7, 2014 Posted June 7, 2014 You should know that the data sync may delay to arrive the other side because of the ping.
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