roddydennvor Posted April 17, 2015 Share Posted April 17, 2015 How to change this Script... I want this script set to addeventhandler , not addcommandhandler And how to edit this script so when i use item id 90 then this script will be work ... ?? local cases = {} for i,v in ipairs(getElementsByType("player"))do setElementData(v, "ffhelmet", 0) end addCommandHandler("ffhelmet", function(player) if(getResourceState(getResourceFromName("bone_attach")) == "running")then if(getElementType(player) == "player")then if(getElementData(player, "helmet") ~= 1)then setElementData(player, "helmet", 1) case = createObject(2054,0,0,0) exports.bone_attach:attachElementToBone(case,player,1,0,0.04,0.06,0,0,180) cases[player] = case elseif(getElementData(player, "helmet") == 1)then setElementData(player, "helmet", 0) exports.bone_attach:detachElementFromBone(cases[player]) destroyElement(cases[player]) end end else outputChatBox("ERROR #1", player, 255, 50, 0) end end ) Link to comment
dugasz1 Posted April 17, 2015 Share Posted April 17, 2015 I guess you have a inventory system. Then, where the script detect you used item with id 90 you have to write a triggerEvent or export this function first then use it. Link to comment
roddydennvor Posted April 17, 2015 Author Share Posted April 17, 2015 Solved , just copy this Script to item system , thanks 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