Advertisement
Guest User

Untitled

a guest
Jan 1st, 2012
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.82 KB | None | 0 0
  1. --[[
  2.     Script made by Blyitgen @ AC-Web.org
  3.     These credits must stay in place!
  4. ]]
  5.  
  6. -- Varibles
  7. local NPC = 78000  -- NPC entry for gossip
  8.  
  9. local p1_X = 31000 -- X location for Player 1
  10. local p1_Y = 31000 -- Y location for Player 1
  11. local p1_Z = 31000 -- Z location for Player 1
  12.  
  13. local p2_X = 31000 -- X location for Player 2
  14. local p2_Y = 31000 -- Y location for Player 2
  15. local p2_Z = 31000 -- Z location for Player 2
  16.  
  17. local started = 0  -- Status of the arena (0 = not started, 1 = started)
  18.  
  19. local p1 = {}
  20. local p2 = {}
  21.  
  22. -- Custom Functions
  23.  
  24. function addPlayer(player,unit)
  25.     local pid = player
  26.    
  27.     local p1s = table.getn(p1)
  28.     local p2s = table.getn(p2)
  29.    
  30.     if (p1s > p2s)  then
  31.         p2[p2s + 1] = pid
  32.     else if(p2s > p1s) then
  33.         p1[p1s + 1] = pid
  34.     else if(p1s == p2s) then
  35.         local chance = math.random(1,2)
  36.         if(chance == 1) then
  37.             p1[p1s + 1] = pid
  38.         else
  39.             p2[p2s + 1] = pid
  40.         end
  41.     end
  42.    
  43.     player:SendBroadcastMessage("You are now added to the queue! Good luck!")
  44. end
  45.  
  46. function getRandom(array)
  47.     local size = table.getn(array)
  48.    
  49.     if(size == 0) then
  50.         return 0
  51.     else if(size > 1) then
  52.         local m = math.random(1,size)
  53.         return array[math.random(1,size)]
  54.     else if(size == 1) then
  55.         return array[1]
  56.     end
  57. end
  58.  
  59. function sendPlayers()
  60. end
  61.  
  62. -- Script
  63.  
  64. function onGossipTalk(Unit, Event, player)
  65.     Unit:GossipCreateMenu(100, player, 0)
  66.    
  67.     Unit:GossipMenuAddItem(6, "Add me to the queue!", 1)
  68.     Unit:GossipMenuAddItem(0, "Nevermind", 2)
  69.    
  70.     Unit:GossipSendMenu(player)
  71. end
  72.  
  73. function onGossipSelect(Unit, Event, player, id, intid, code, pMisc)
  74.     if(intid == 1) then
  75.         addPlayer(player)
  76.     end
  77.     if(intid == 2) then
  78.         player:GossipComplete()
  79.     end
  80. end
  81.  
  82. -- Registers
  83. RegisterTimedEvent("sendPlayers", 30000, 0)
  84. RegisterUnitGossipEvent(NPC, 1, onGossipTalk)
  85. RegisterUnitGossipEvent(NPC, 2, onGossipSelect)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement