Tommy. Posted August 30, 2017 Share Posted August 30, 2017 -> Server-side function detach() detachElementFromElement(source) end bindKey("f", "down", detach) debugscript: http://i.imgur.com/Db48FsE.jpg Link to comment
DonOmar Posted August 30, 2017 Share Posted August 30, 2017 function detach() local attachedelem = getAttachedElements ( source ) for i,v in ipairs ( attachedelem ) do detachElementFromElement(v, source) end end bindKey("f", "down", detach) 1 Link to comment
Tommy. Posted August 30, 2017 Author Share Posted August 30, 2017 warning: ATTACH\s.lua:209: Bad argument @ 'bindKey' [Expected player at argument 1,got string 'f'] Link to comment
DonOmar Posted August 30, 2017 Share Posted August 30, 2017 bindKey(source,"f", "down", detach) 1 Link to comment
Tommy. Posted August 30, 2017 Author Share Posted August 30, 2017 RESOLVED function detach(source) detachElementFromElement(source) end function bindset(source) bindKey(source, "F2", "down", detach) end addEventHandler("onPlayerJoin", root, bindset) Thx, @DonOmar 1 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