Advertisement
Guest User

Amuleto do Caçador

a guest
May 19th, 2015
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.81 KB | None | 0 0
  1. -- By Godfather
  2. function onStatsChange(cid, attacker, type, combat, value)
  3.     local porcentagem = 40
  4.     local reset = 9235
  5.     if getPlayerSlotItem(cid,2).itemid == 2218 then
  6.         if isMonster(attacker) then
  7.             if type == 1 or type == 3 then
  8.                 if getPlayerStorageValue(cid,reset) == 2 then
  9.                     setPlayerStorageValue(cid,reset,1)
  10.                     return true
  11.                 else
  12.                     local blocked = math.ceil((porcentagem/100)*value)
  13.                     setPlayerStorageValue(cid,reset,2)
  14.                     doPlayerSendTextMessage(cid,MESSAGE_STATUS_DEFAULT,"Protegeu "..porcentagem.."% de "..value.." ("..blocked..")")
  15.                     doPlayerSendCancel(cid,"Protegeu "..porcentagem.."% de "..value.." ("..blocked..")")
  16.                     doAreaCombatHealth(attacker, combat, getCreaturePosition(cid), 0, -blocked, -blocked, -1)
  17.                     return false
  18.                 end
  19.             end
  20.         end
  21.     end
  22.     return true
  23. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement