Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Script made by Blyitgen @ AC-Web.org
- These credits must stay in place!
- ]]
- -- Varibles
- local NPC = 78000 -- NPC entry for gossip
- local x1,y1,z1 = 1.1, 1.2, 1.3 -- location for Player 1
- local x2,y2,z2 = 1.1, 1.2, 1.3 -- location for Player 2
- local started = false -- Status of the arena (false = not started, true = started)
- local p1 = {}
- local p2 = {}
- -- Custom Functions
- local function getRandom(array)
- local size = #array
- if(size == 0) then
- return 0 -- false, nil?
- elseif(size > 1) then
- return array[math.random(1,size)]
- elseif(size == 1) then
- return array[1]
- end
- end
- local function sendPlayers()
- -- Script
- end
- local function addPlayer(player,unit)
- local p1s = #p1
- local p2s = #p2
- -- p1[p1s + 1] = player Lets use table insert instead. Less code and a cleaner table and it might just be better later on.
- if (p1s > p2s) then
- table.insert(player, p2)
- elseif(p1s < p2s or p1s = p2s) then
- table.insert(player, p1)
- end
- player:SendBroadcastMessage("You are now added to the queue! Good luck!")
- end
- local function Hello(Unit, Event, player)
- Unit:GossipCreateMenu(100, player, 0)
- Unit:GossipMenuAddItem(6, "Add me to the queue!", 1)
- Unit:GossipMenuAddItem(7, "Nevermind", 2)
- Unit:GossipSendMenu(player)
- end
- local function Select(Unit, Event, player, id, intid, code, pMisc)
- if(intid == 1) then
- addPlayer(player)
- end
- player:GossipComplete()
- end
- -- Registers
- RegisterTimedEvent("sendPlayers", 30000, 0)
- RegisterUnitGossipEvent(NPC, 1, Hello)
- RegisterUnitGossipEvent(NPC, 2, Select)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement