Advertisement
Rochet2

Untitled

Jan 1st, 2012
290
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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 x1,y1,z1 = 1.1, 1.2, 1.3 -- location for Player 1
  10. local x2,y2,z2 = 1.1, 1.2, 1.3 -- location for Player 2
  11.  
  12. local started = false  -- Status of the arena (false = not started, true = started)
  13.  
  14. local p1 = {}
  15. local p2 = {}
  16.  
  17. -- Custom Functions
  18.  
  19. local function getRandom(array)
  20.     local size = #array
  21.     if(size == 0) then
  22.         return 0 -- false, nil?
  23.     elseif(size > 1) then
  24.         return array[math.random(1,size)]
  25.     elseif(size == 1) then
  26.         return array[1]
  27.     end
  28. end
  29.  
  30. local function sendPlayers()
  31. -- Script
  32. end
  33.  
  34. local function addPlayer(player,unit)
  35.     local p1s = #p1
  36.     local p2s = #p2
  37.     -- p1[p1s + 1] = player Lets use table insert instead. Less code and a cleaner table and it might just be better later on.
  38.     if (p1s > p2s)  then
  39.         table.insert(player, p2)
  40.     elseif(p1s < p2s or p1s = p2s) then
  41.         table.insert(player, p1)
  42.     end
  43.     player:SendBroadcastMessage("You are now added to the queue! Good luck!")
  44. end
  45.  
  46. local function Hello(Unit, Event, player)
  47.     Unit:GossipCreateMenu(100, player, 0)
  48.    
  49.     Unit:GossipMenuAddItem(6, "Add me to the queue!", 1)
  50.     Unit:GossipMenuAddItem(7, "Nevermind", 2)
  51.    
  52.     Unit:GossipSendMenu(player)
  53. end
  54.  
  55. local function Select(Unit, Event, player, id, intid, code, pMisc)
  56.     if(intid == 1) then
  57.         addPlayer(player)
  58.     end
  59.     player:GossipComplete()
  60. end
  61.  
  62. -- Registers
  63. RegisterTimedEvent("sendPlayers", 30000, 0)
  64. RegisterUnitGossipEvent(NPC, 1, Hello)
  65. RegisterUnitGossipEvent(NPC, 2, Select)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement