Sjoerdva97

Untitled

Apr 29th, 2018
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.45 KB | None | 0 0
  1. -- add to the bottom
  2. function armorDamage(attacker, weapon, part, loss)
  3.     for i=219,221 do
  4.         local found, slot, value = hasItem(source, i)
  5.         if found then
  6.             local newValue = value - math.floor(loss)
  7.             if newValue >= 0 then
  8.                 updateItemValue(source, slot, newValue)
  9.             else
  10.                 triggerServerEvent("deleteArmor", localPlayer, localPlayer, i, value)
  11.             end
  12.         end
  13.     end                
  14. end
  15. addEventHandler("onClientPlayerDamage", localPlayer, armorDamage)
Advertisement
Add Comment
Please, Sign In to add comment