Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local command = "menu" -- Usage: .menu
- local hearthstone = {}
- -------------------Gossip Section-----------------
- local T = {
- ["Main"] = {
- {"|TInterface\\icons\\Spell_Shadow_TwistedFaith.png:30|tHearthstone", 1},
- {"|TInterface\\icons\\INV_Misc_Book_11.png:30|tRule Book", 20},
- {"|cffffff00[Exit Menu]|r", 999}
- },
- ["HSs"] = {
- {"|TInterface\\icons\\Achievement_Zone_Northrend_01.png:30|tSave my location", 9},
- {"|cffffff00[Main Menu]|r", 1000}
- },
- ["HSt"] = {
- {"|TInterface\\icons\\Spell_Arcane_TeleportSilvermoon.png:30|tTeleport Me", 10},
- {"|TInterface\\icons\\Achievement_Zone_Northrend_01.png:30|tChange My Location", 9},
- {"|cffffff00[Main Menu]|r", 1000}
- },
- ["Rules"] = {
- {"|TInterface\\icons\\INV_MISC_NOTE_02.png:30|tGeneral Rules", 21},
- {"|TInterface\\icons\\INV_MISC_NOTE_02.png:30|tPlayer Rules", 22},
- {"|cffffff00[Main Menu]|r", 1000}
- },
- ["GenR"] = {
- {"|cffff0000Do not Flame or insult other members.", 21},
- {"|cffff0000Do not Bypass the swear filter or other filters.", 21},
- {"|cffff0000Do not Spread personally identifiable information (i.e. name, address, email, phone number, etc.)", 21},
- {"|cffff0000Do not Racism, discrimination", 21},
- {"|cffff0000Do not Bash any of the staff and the choices they make", 21},
- {"|cffff0000Do not Soliciting, auctioning, selling, advertising, referrals", 21},
- {"|cffff0000Do not Hack", 21},
- {"|cffff0000Do not Cheat", 21},
- {"|cffff0000Do not Bug Exploit", 21},
- {"|cffff0000Do not advertise", 21},
- {"|cffffff00[Back]|r", 20}
- },
- ["PlyR"] = {
- {"|cffff0000No asking GMs for in-game currency or items", 22},
- {"|cffff0000No abusive conduct", 22},
- {"|cffff0000No posing as a staff member", 22},
- {"|cffff0000No abusing the ticket system", 22},
- {"|cffff0000No Win trading", 22},
- {"|cffff0000No Honor Farming", 22},
- {"|cffff0000Do not AFK in BG's", 22},
- {"|cffffff00[Back]|r", 20}
- },
- };
- do
- local Q = CharDBQuery("SELECT * FROM hearthstone")
- if (Q) then
- repeat
- local data = Q:GetRow()
- hearthstone[data.guid] = data
- until not Q:NextRow()
- end
- end
- local function Hello(event, player)
- player:GossipClearMenu()
- for k, v in ipairs(T["Main"]) do
- player:GossipMenuAddItem(0, v[1], 0, v[2])
- end
- player:GossipSendMenu(1, player, 100)
- player:SendAreaTriggerMessage("|cff00ff00Greetings, "..player:GetName().."!|r")
- end
- local function OnSelect(event, player, _, _, intid, code)
- player:GossipClearMenu()
- local guid = player:GetGUIDLow()
- ----------------------Hearthstone-------------------------
- if (intid == 1) then --- Hearthstone Menu
- if (not hearthstone[guid]) then
- for k, v in ipairs(T["HSs"]) do
- player:GossipMenuAddItem(0, v[1], 0, v[2])
- end
- else
- for k, v in ipairs(T["HSt"]) do
- player:GossipMenuAddItem(0, v[1], 0, v[2])
- end
- end
- player:GossipSendMenu(1, player, 100)
- elseif (intid == 9) then --- Hearthstone Save
- if(player:GetLuaCooldown() == 0) then
- player:SetLuaCooldown(180)
- local map,x,y,z,o = player:GetMapId(), player:GetLocation()
- hearthstone[guid] = {guid=guid,map=map,x=x,y=y,z=z,o=o}
- CharDBExecute("REPLACE INTO hearthstone (`guid`, `map`, `x`, `y`, `z`, `o`) VALUES ("..guid..", "..string.format("%u, %f, %f, %f, %f", map,x,y,z,o)..")")
- player:SendAreaTriggerMessage("|cff00ff00Your location have been stored!|r")
- player:GossipComplete()
- else
- player:SendBroadcastMessage(string.format("|cff00ffff[Hearthstone]|r|cffff0000 Your hearthstone is on cooldown, %s seconds left.|r", math.ceil(player:GetLuaCooldown())))
- end
- elseif (intid == 10) then --- Hearthstone Teleport
- if(player:GetLuaCooldown() == 0) then
- player:SetLuaCooldown(180)
- player:GossipComplete()
- local data = hearthstone[guid]
- if (data) then
- player:Teleport(data.map,data.x,data.y,data.z,data.o)
- end
- else
- player:SendBroadcastMessage(string.format("|cff00ffff[Hearthstone]|r|cffff0000 Your hearthstone is on cooldown, %s seconds left.|r", math.ceil(player:GetLuaCooldown())))
- end
- ----------------------Rule-Book-------------------------
- elseif(intid == 20) then --- Rules Menu
- for k, v in ipairs(T["Rules"]) do
- player:GossipMenuAddItem(0, v[1], 0, v[2])
- player:GossipSendMenu(1, player, 100)
- end
- elseif(intid == 21) then --- General Rules
- for k, v in ipairs(T["GenR"]) do
- player:GossipMenuAddItem(0, v[1], 0, v[2])
- player:GossipSendMenu(1, player, 100)
- end
- elseif(intid == 22) then --- Player Rules
- for k, v in ipairs(T["PlyR"]) do
- player:GossipMenuAddItem(0, v[1], 0, v[2])
- player:GossipSendMenu(1, player, 100)
- end
- -------------------OTHER----------------
- elseif(intid == 1000) then --- Main Menu
- for k, v in ipairs(T["Main"]) do
- player:GossipMenuAddItem(0, v[1], 0, v[2])
- player:GossipSendMenu(1, player, 100)
- end
- elseif(intid == 999) then --- Exit Menu
- player:GossipComplete()
- end
- end
- local function OnCommand(event, player, cmd)
- if (cmd:lower() == command) then
- Hello(event, player)
- end
- end
- RegisterPlayerEvent(42, OnCommand)
- RegisterPlayerGossipEvent(100, 2, OnSelect)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement