pa3ck Posted November 14, 2013 Posted November 14, 2013 (edited) -- Edited November 14, 2013 by Guest
Spajk Posted November 14, 2013 Posted November 14, 2013 I dont know if this will help you, but after "destroyElement(helmet[lp])" do "helmet[lp] = nil", also from this part of code, I cant see who is "lp" and who is "thePlayer"
pa3ck Posted November 14, 2013 Author Posted November 14, 2013 Thanks for reply, thePlayer was triggered from client side (so thePlayer = getLocalPlayer()). The problem is, that it wont destroy the element at all. I'll try what you said.
Spajk Posted November 14, 2013 Posted November 14, 2013 You should then try with helmet[thePlayer] instead of helmet[lp] EDIT: Try this: helmet = {} --lp = getElementType(thePlayer) if getElementData(thePlayer, 'helmetOn') ~= 1 then setElementData(thePlayer, 'helmetOn', 1) local x, y, z = getElementPosition(thePlayer) helmet[thePlayer] = createObject(2053, x, y, z) setObjectScale(helmet[thePlayer], 2.4) exports.bone_attach:attachElementToBone(helmet[thePlayer],thePlayer,1,0,0.03,0.1,0,0,180) else setElementData(thePlayer, 'helmetOn', 0) destroyElement(helmet[thePlayer]) helmet[thePlayer] = nil end
pa3ck Posted November 14, 2013 Author Posted November 14, 2013 Thanks for you help, this was my first try, but it gave me the same error. Now I copy-pasted your code and give the same error. Bad argument @ destroyElement
pa3ck Posted November 14, 2013 Author Posted November 14, 2013 The event is triggered when you click on a gui, and 'thePlayer' is sent from client side to server side. So its defined client side as getLocalPlayer()
TAPL Posted November 14, 2013 Posted November 14, 2013 Could you post the trigger code? I think it should be source not thePlayer.
pa3ck Posted November 14, 2013 Author Posted November 14, 2013 (edited) -- Edited November 14, 2013 by Guest
TAPL Posted November 14, 2013 Posted November 14, 2013 oh also you don't need the element data, you can use the table. something like: if not isElement(helmet[thePlayer]) then -- create it else -- destroy it end
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