hello guys
firstly happy new year
i was trying to make shown armour in body while im using armour and when i lose armour the armour will hidden from my body but theres something wrong in it
as you see i need to type the armour to make it shown in my body
the problems in it , if i used armour i need to type command to make it shown, i want to make it shown auto when i used armour, 2. if i used armour and i typed the command the armour will still shown in body when i lose armour so i need to reconnect to make it hidden i want to make it removed auto when i lose armour , 3. when i typed the commnd it shown in my body like that check the photo https://www.photobox.co.uk/my/photo/full?photo_id=501531795868
sorry for bad english
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
addCommandHandler("armour", getArmour)