Dreft Posted April 17, 2010 Share Posted April 17, 2010 On server side script: setElementData( thePlayer, "someValue", 100 ) On client side script: setElementData( getRootElement(), "someValue", getElementData( getRootElement(), "someValue" ) -1 ) And error is on line setElementData( getRootElement(), "someValue", getElementData( getRootElement(), "someValue" ) -1 ) : ERROR: attempt to perform arithmetic on a boolean value getElementData returns false if data wasn't set, so i can understand that client sees data "someValue" as doesn't created. Maybe I'm doing something wrong ? Link to comment
Dark Dragon Posted April 17, 2010 Share Posted April 17, 2010 you are setting the element data of "thePlayer" then you try to get an element data value of the root element. if you change the serverside line to setElementData( getRootElement(), "someValue", 100 ) it should work but if you want to have different players with different element data values you need to get the player element you want to set the element data for. it depends much on what you try to do but let me give you an example server for i,aPlayerElement in ipairs(getElementsByType("player")) do setElementData(aPlayerElement,"bulletsfired",0) end client function addtobulletcount() setElementData(getLocalPlayer(),"bulletsfired",tonumber(getElementData(getLocalPlayer(),"bulletsfired"))+1) end addEventHandler("onClientPlayerWeaponFire",getLocalPlayer(),addtobulletcount) Link to comment
Dreft Posted April 17, 2010 Author Share Posted April 17, 2010 Oh thanks, I was using getRootElement() instead of getLocalPlayer(), here was problem Thanks again. 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