elementVest = {}
function getArmour(hitPlayer)
if isElement(hitPlayer) then
local player = hitPlayer
local armour = getPedArmor(player)
if armour > 0 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
setTimer(getArmour, 1000, 1, localPlayer)