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!
- ]]
- -- Variables
- local NPC = 78000 -- NPC entry for gossip
- local m1,x1,y1,z1 = 1.1, 1.2, 1.3, 1.4 -- Location for Player 1
- local m2,x2,y2,z2 = 1.1, 1.2, 1.3, 1.4 -- Location for Player 2
- local am,ax,ay,az = 1.1, 1.2, 1.3, 1.4 -- Location after arena for alliance
- local hm,hx,hy,hz = 1.1, 1.2, 1.3, 1.4 -- Location after arena for horde
- local reward = 125 -- Reward (in honor) for the winner
- local started = false -- Status of the arena (false = not started, true = started)
- local p1 = {}
- local p2 = {}
- local t1,t2 = false, false
- -- Custom Functions
- local function endArena()
- local p1t = p1[t1]:getTeam()
- local p2t = p2[t2]:getTeam()
- if(p1t == 1) then
- p1[t1]:Teleport(hm,hx,hy,hz)
- else
- p1[t1]:Teleport(am,ax,ay,az)
- end
- if(p2t == 1) then
- p2[t2]:Teleport(hm,hx,hy,hz)
- else
- p2[t2]:Teleport(am,ax,ay,az)
- end
- table.remove(p1,t1)
- table.remove(p2,t2)
- started = false
- end
- local function checkArena()
- if(started) then
- if(t1 and t2) then
- if(p1[t1]:isDead()) then
- p2[t2]:SendBroadcastMessage("Congratulations! You won "..reward.." honor!")
- p1[t1]:SendBroadcastMessage("You can do better than that.")
- p2[t2]:giveHonor(reward)
- p1[t1]:ResurrectPlayer()
- endArena()
- elseif(p2[t2]:isDead()) then
- p1[t1]:SendBroadcastMessage("Congratulations! You won "..reward.." honor!")
- p2[t2]:SendBroadcastMessage("You can do better than that.")
- p1[t1]:giveHonor(reward)
- p2[t2]:ResurrectPlayer()
- endArena()
- end
- end
- end
- end
- local function getRandom(array)
- local size = #array
- if(size == 0) then
- return false
- elseif(size > 1) then
- return math.random(1,size)
- elseif(size == 1) then
- return 1
- end
- end
- local function sendPlayers()
- if(started == false) then
- t1 = getRandom(p1)
- t2 = getRandom(p2)
- if(t1 and t2) then
- p1[t1]:Teleport(m1,x1,y1,z1,0)
- p2[t2]:Teleport(m2,x2,y2,z2,0)
- started = true
- end
- end
- end
- local function addPlayer(player,unit)
- local p1s = #p1
- local p2s = #p2
- if (p1s > p2s) then
- table.insert(p2, player)
- elseif(p1s < p2s or p1s = p2s) then
- table.insert(p1, player)
- 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)
- RegisterTimedEvent("checkArena", 5000, 0)
- RegisterUnitGossipEvent(NPC, 1, Hello)
- RegisterUnitGossipEvent(NPC, 2, Select)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement