SuperVisor Posted January 3, 2019 Share Posted January 3, 2019 elementVest = {} function getArmour(hitPlayer) if isElement(hitPlayer) then local player = hitPlayer local armour = getPedArmor(player) if armour > 5 then x,y,z = getElementPosition(player) if not isElement(elementVest[player]) then exports.bone_attach:detachElementFromBone(elementVest[player]) elementVest[player] = false end elementVest[player] = createObject(1242,x,y,z) exports.bone_attach:attachElementToBone(elementVest[player],player,3,0,0.04,0.08,0,0,180) else if elementVest[player] and isElement(elementVest[player]) then exports.bone_attach:detachElementFromBone(elementVest[player]) destroyElement(elementVest[player]) elementVest[player] = false end end end end addEventHandler ( "onPlayerDamage" getRootElement () , getArmour) Function removearmour ( player ) local armour = getPedArmor(player) If armour > 0 then destoryElement(elementVest[player]) elementVest[player] = false end end addEventHandler ( "onPlayerDamage" getRootElement () , removearmour) Script have 2bugs Player must damge for show the armour And when armour finished it's still wear in player must reconnect to remove it Any help plz Link to comment
DNL291 Posted January 9, 2019 Share Posted January 9, 2019 Use the event onPlayerSpawn and regarding your second problem, you should be handling the checking in the wrong way in onPlayerDamage. 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