Advertisement
Guest User

Amuleto do Caçador (rev 1)

a guest
May 20th, 2015
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.87 KB | None | 0 0
  1. -- By Godfather (rev 1)
  2. local porcentagem = 40 -- Porcentagem de dano que será BLO-QUE-A-DO
  3. local pt_br = false
  4.  
  5. function onStatsChange(cid, attacker, type, combat, value)
  6.     local lang = {"You lose %d hitpoints (damage protected by amulet: %x).","Você perdeu %d pontos de vida (proteção do amuleto: %x)."}
  7.     local reset = 9235
  8.     if getPlayerSlotItem(cid,2).itemid == 2218 then
  9.         if type == 1 or type == 3 then
  10.             if getPlayerStorageValue(cid,reset) == 2 then
  11.                 setPlayerStorageValue(cid,reset,1)
  12.                 return true
  13.             else
  14.                 local new_dmg = math.ceil(((100-porcentagem)/100)*value)
  15.                 setPlayerStorageValue(cid,reset,2)
  16.                 doTargetCombatHealth(attacker, cid, combat, -new_dmg, -new_dmg, -1)
  17.                 doPlayerSendCancel(cid,(pt_br and lang[2]:format(new_dmg, value-new_dmg) or lang[1]:format(new_dmg, value-new_dmg)))
  18.                 return false
  19.             end
  20.         end
  21.     end
  22.     return true
  23. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement