Advertisement
Uissu

[X-TIBIA][ACTION] New Anihilator

Feb 10th, 2012
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.45 KB | None | 0 0
  1.  
  2. local function doCreateDemons()
  3. for i,pos in pairs(demons) do
  4.     if doCreateMonster('Demon', pos) then
  5.         doSendMagicEffect(pos, 10)
  6.         if i == #demons then
  7.             return true
  8.         end
  9.     end
  10. end
  11. return false
  12. end
  13.  
  14. function onUse(cid, item, pos, item2, topos)
  15. local players, demons = {{x=119, y=35, z=9},{x=120, y=35, z=9},{x=121, y=35, z=9},{x=122, y=35, z=9}}, {}
  16. local config = {
  17. storage = 23891,
  18. }
  19.  
  20. local pcount = 0
  21. for i,pos in pairs(players) do
  22.     pos.stackpos = 253
  23.     local pid = getThingFromPos(pos)
  24.     if isPlayer(pid.uid) then
  25.         if getPlayerStorageValue(pid, config.storage) == 1 then
  26.             local name = name or getCreatureName(pid)
  27.             doPlayerSendCancel(pid, name .." has done this quest before.")
  28.             if i == #players then
  29.                 return true
  30.             end
  31.         else
  32.             doSendMagicEffect(pos, 12)
  33.             pcount = pcount + 1
  34.             if (i == #players and pcount ~= #players) then doPlayerSendCancel(cid, "Not enough players.") return true end
  35.         end
  36.         local downCenterPos = players[math.ceil(#players / 2)]
  37.         for _,cid in pairs(getSpectators(downCenterPos, 5,5)) do
  38.             if isPlayer(cid) then doPlayerSendCancel(cid, "There is currently a team inside the quest.") return true end
  39.             if isMonster(cid) then doRemoveCreature(cid) end
  40.         end
  41.         local newpos = {x=pos.x,y=pos.y,z=pos.z-1}
  42.         if doTeleportThing(pid, newpos) then
  43.             doSendMagicEffect(newpos, 10)
  44.             if i == #players then
  45.                 if doCreateDemons() then
  46.                 return true
  47.                 end
  48.             end
  49.         end
  50.     end
  51. end
  52.  
  53. return true
  54. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement