Padul Posted March 3, 2017 Posted March 3, 2017 serverside local fb={} if policeSigState == 0 then setElementData ( playerOccupiedRadiolka ,"radiolka:signalsstate",1) fb.wuwuni = createObject ( 1845, x , y , z , xr , yr, zr ) attachElements ( fb.wuwuni , playerOccupiedRadiolka, -0.5 , -0.05 , 0.9 ) elseif policeSigState == 1 then setElementData ( playerOccupiedRadiolka ,"radiolka:signalsstate",0) destroyElement ( fb.wuwuni ) end WARNING: Bad argument @ 'destroyElement' [Expected element at argument 1, got nill] can someone explain me that and maybe help :)? the problem is that i have more than one car that will have attached object wuwuni, it appears that if i create object on two vehicles then its possible to me to destroy element on the first vehicle MTA Dayz textures and objects: http://padulmods.blogspot.com/
Moderators Citizen Posted March 4, 2017 Moderators Posted March 4, 2017 Try this (using an element data so it's the vehicle who is in charge to keep a reference to wuwuni instead of a server variable): if policeSigState == 0 then local wuwuni = createObject ( 1845, x , y , z , xr , yr, zr ) setElementData ( playerOccupiedRadiolka ,"radiolka:signalsstate",1) setElementData ( playerOccupiedRadiolka ,"radiolka:signalsobject", wuwuni ) attachElements ( wuwuni , playerOccupiedRadiolka, -0.5 , -0.05 , 0.9 ) elseif policeSigState == 1 then setElementData ( playerOccupiedRadiolka ,"radiolka:signalsstate",0) local wuwni = getElementData ( playerOccupiedRadiolka , "radiolka:signalsobject" ) if wuwni and isElement( wuwni ) then destroyElement ( wuwuni ) end end if policeSigState == 0 then local wuwuni = createObject ( 1845, x , y , z , xr , yr, zr ) setElementData ( playerOccupiedRadiolka ,"radiolka:signalsstate",1) setElementData ( playerOccupiedRadiolka ,"radiolka:signalsobject", wuwuni ) attachElements ( wuwuni , playerOccupiedRadiolka, -0.5 , -0.05 , 0.9 ) elseif policeSigState == 1 then setElementData ( playerOccupiedRadiolka ,"radiolka:signalsstate",0) local wuwni = getElementData ( playerOccupiedRadiolka , "radiolka:signalsobject" ) if wuwni and isElement( wuwni ) then destroyElement ( wuwuni ) end end The rEvolution is coming ...
Padul Posted March 4, 2017 Author Posted March 4, 2017 ok, thx it works now MTA Dayz textures and objects: http://padulmods.blogspot.com/
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