Code:
local npcid = 200000
local menunum = 33310
local menuicon = 4
local teleicon = 2
local menu =
{
{"Alliance Locations",
{
{"Stormwind", 0, -9077.296875, 423.434479, 92.79048},
{"Ironforge", 0, -4989.347168, -872.971741, 496.984375},
{"Darnassus", 1, 9951.940430, 2280.126953, 1341.395386},
{"Exodar", 530, -4010.619141, -11886.310547, -1.610816},
}
},
{"Horde Locations",
{
{"Orgrimmar", 1, 1502.709961, -4415.419922, 21.552349},
{"Undercity", 0, 1642.265381, 239.750000, 62.592251},
{"Thunder Bluff", 1, -1289.020020, 144.417999, 129.876007},
{"Silvermoon", 530, 9394.371094, -7278.359375, 14.239411},
}
},
{"Mall", 1, -11792.368164, -4742.708008, 3.411385},
{"PvP Area", 0, -13248.059570, 189.193329, 31.204947}
}
function TeleNPC_MainMenu(Unit, Player)
local i = 0
Unit:GossipCreateMenu(menunum, Player, 0)
for k,v in pairs(menu) do
i = i + 1
if type(v[2]) == "table" then
Unit:GossipMenuAddItem(menuicon, v[1], i, 0)
i = i + #(v[2])
else
Unit:GossipMenuAddItem(teleicon, v[1], i, 0)
end
end
Unit:GossipSendMenu(Player)
end
function TeleNPC_SubMenu(Unit, Player, i, Submenu)
Unit:GossipCreateMenu(menunum-i, Player, 0)
Unit:GossipMenuAddItem(7, "<--Back", 0, 0)
for k,v in pairs(Submenu) do
i = i + 1
Unit:GossipMenuAddItem(teleicon, v[1], i, 0)
end
Unit:GossipSendMenu(Player)
end
function TeleNPC_OnGossipTalk(Unit, Event, Player)
TeleNPC_MainMenu(Unit, Player)
end
function TeleNPC_OnGossipSelect(Unit, Event, Player, MenuId, Id, Code)
local i = 0
if(Id == 0) then
TeleNPC_MainMenu(Unit,Player)
else
for k,v in pairs(menu) do
i = i + 1
if (Id == i) then
if type(v[2]) == "table" then
TeleNPC_SubMenu(Unit, Player, i, v[2])
else
if Player:IsInCombat() then
Unit:SendChatMessage(12, 0, "You can't teleport while in combat!")
else
Player:Teleport(v[2], v[3], v[4], v[5])
end
Unit:GossipComplete(Player)
end
return
elseif (type(v[2]) == "table") then
for j,w in pairs(v[2]) do
i = i + 1
if (Id == i) then
if Player:IsInCombat() then
Unit:SendChatMessage(12, 0, "You can't teleport while in combat!")
else
Player:Teleport(w[2], w[3], w[4], w[5])
end
Unit:GossipComplete(Player)
return
end
end
end
end
end
end
RegisterUnitGossipEvent(200000, 1, "TeleNPC_OnGossipTalk")
RegisterUnitGossipEvent(200000, 2, "TeleNPC_OnGossipSelect")
You can of course put your own cords, you can easily put in your own stuff...