addEvent( "helmet", true )
local cases = {}
for i,v in ipairs(getElementsByType("player"))do
setElementData(v, "helmet", 0)
end
function helmet( source )
if (getResourceState(getResourceFromName("bone_attach")) == "running") then
if (getElementData(source, "helmet") ~=1) then
setElementData(source, "helmet", 1)
case = createObject(1210,0,0,0)
exports.bone_attach:attachElementToBone(case,source,12,0,0.05,0.27,0,180,0)
cases[source] = case
outputChatBox("Helmet:- True.", source, 0, 255, 0)
else
setElementData(source, "helmet", 0)
exports.bone_attach:detachElementFromBone(cases[source])
destroyElement(cases[source])
outputChatBox("Helmet:- False.", source, 255, 50, 0)
end
else
outputChatBox("ERROR #2 Resource not found.", source, 255, 50, 0)
end
end
addEventHandler( "helmet", root, helmet )
elseif (itemID==90) then
triggerServerEvent("helmet", root, source)
takeItemFromSlot(source, itemSlot)