Advertisement
Skymagnum

Untitled

May 9th, 2013
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.29 KB | None | 0 0
  1. local function stun(p)
  2.  
  3. local dirs = math.random(1, 3)
  4. local newDir = getPosByDir(getThingPos(p), getCreatureLookDirection(p), 1)
  5.  
  6.     for loop = 1, 3 do
  7.         addEvent(doCreatureSetLookDir, loop * 200, p, dirs)
  8.         addEvent(doTeleportThing, loop * 220, p, getClosestFreeTile(p, newDir), false)
  9.         doSendMagicEffect(getThingPos(p), CONST_ME_STUN)
  10.     end
  11.  
  12. end
  13.  
  14. function onUse(cid, item, fromPosition, itemEx, toPosition)
  15.  
  16. local itemName = getItemAttribute(item.uid, "description")
  17. local p = itemName:match("Este item serve para fazer macumba ao player (.+).")
  18.  
  19. -- so mecha em percent e stun
  20.     local player = getPlayerByNameWildcard(getPlayerByName(p))
  21.     local percent = 30
  22.     local conta = getCreatureHealth(player) / percent * 100
  23.     local stun = true
  24.  
  25.     if player then
  26.        if p ~= getCreatureName(cid) then
  27.            doCreatureAddHealth(player, conta)
  28.            doCreatureSay(player, "Ai")
  29.            doPlayerSendTextMessage(cid, 27, "Você fez macumba contra o jogador " .. p .. ".")
  30.        else
  31.            doPlayerSendCancel(cid, "Você não pode fazer macumba contra sí mesmo.")
  32.        end
  33.     else
  34.         doPlayerSendCancel(cid, "Este jogador esta offline.")
  35.     end
  36.  
  37.     if stun then
  38.        stun(player)
  39.     end
  40.  
  41.     return true
  42. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement