MikExV™
18-05-10, 08:52 PM
local NPC_ID = 50033
function NPC_OnGossipTalk(pUnit, event, player)
pUnit:GossipCreateMenu(1, player, 1)
pUnit:GossipMenuAddItem(1, "Claim a Item.", 1, 1)
pUnit:GossipMenuAddItem(1, "Claim a Spell", 3, 0)
pUnit:GossipMenuAddItem(1, "Nevermind.", 2, 0)
pUnit:GossipSendMenu(player)
end
function NPC_OnGossipSelect(pUnit, event, player, id, intid, code, pMisc)
if(intid == 1) then
if (player:GetGmRank() == 'a') or (player:GetGmRank() == 'az') then
local select = WorldDBQuery("SELECT * FROM items WHERE entry = "..code.."")
local PlayerName = player:GetName()
local AccountName = player:GetAccountName()
local Rank = player:GetGmRank()
if(select == NULL) then
player:SendBroadcastMessage("|cFFFF7401DF[NOTICE]:|r This doesn't exist!")
player:GossipComplete()
else
player:AddItem(code, 1)
player:SendBroadcastMessage("|cFFFF0000[NOTICE]:|r You have recieved Item ID "..code.." and this transaction has been logged to the database.")
WorldDBQuery("INSERT INTO item_logs (`Entry`, `Character`, `Account`, `Rank`, `Item ID`, `Date`, `Time`) VALUES ('0', '"..PlayerName.."', '"..AccountName.."', '"..Rank.."', '"..code.."','"..os.date("%X").."', '"..os.date("%x").."');")
player:GossipComplete()
end
else
player:SendBroadcastMessage("|cFFFF0000[NOTICE]:|r You need to be a <GM> or <Admin> to use this Feature!")
end
end
if(intid == 2) then
player:GossipComplete()
end
end
if(intid == 3) then
if (player:GetGmRank() == 'a') or (player:GetGmRank() == 'az') or (player:GetGmRank() == 3) or (player:GetGmRank() == vip) then
local select = WorldDBQuery("SELECT * FROM items WHERE entry = "..code.."")
local PlayerName = player:GetName()
local AccountName = player:GetAccountName()
local Rank = player:GetGmRank()
if(select == NULL) then
player:SendBroadcastMessage("|cFFFF7401DF[NOTICE]:|r This doesn't exist!")
player:GossipComplete()
else
player:LearnSpell(code, 1)
player:SendBroadcastMessage("|cFFFF0000[NOTICE]:|r You have recieved Item ID "..code.." and this transaction has been logged to the database.")
WorldDBQuery("INSERT INTO item_logs (`Entry`, `Character`, `Account`, `Rank`, `Item ID`, `Date`, `Time`) VALUES ('0', '"..PlayerName.."', '"..AccountName.."', '"..Rank.."', '"..code.."','"..os.date("%X").."', '"..os.date("%x").."');")
player:GossipComplete()
end
else
player:SendBroadcastMessage("|cFFFF0000[NOTICE]:|r You need to be a <GM> or <Admin> to use this Feature!")
end
end
if(intid == 2) then
player:GossipComplete()
end
RegisterUnitGossipEvent(NPC_ID, 1, "NPC_OnGossipTalk")
RegisterUnitGossipEvent(NPC_ID, 2, "NPC_OnGossipSelect")I take no credit for making this I just found it a wile back when i was running a server, and its helpful so I though I would post it. I do not know who made it.
function NPC_OnGossipTalk(pUnit, event, player)
pUnit:GossipCreateMenu(1, player, 1)
pUnit:GossipMenuAddItem(1, "Claim a Item.", 1, 1)
pUnit:GossipMenuAddItem(1, "Claim a Spell", 3, 0)
pUnit:GossipMenuAddItem(1, "Nevermind.", 2, 0)
pUnit:GossipSendMenu(player)
end
function NPC_OnGossipSelect(pUnit, event, player, id, intid, code, pMisc)
if(intid == 1) then
if (player:GetGmRank() == 'a') or (player:GetGmRank() == 'az') then
local select = WorldDBQuery("SELECT * FROM items WHERE entry = "..code.."")
local PlayerName = player:GetName()
local AccountName = player:GetAccountName()
local Rank = player:GetGmRank()
if(select == NULL) then
player:SendBroadcastMessage("|cFFFF7401DF[NOTICE]:|r This doesn't exist!")
player:GossipComplete()
else
player:AddItem(code, 1)
player:SendBroadcastMessage("|cFFFF0000[NOTICE]:|r You have recieved Item ID "..code.." and this transaction has been logged to the database.")
WorldDBQuery("INSERT INTO item_logs (`Entry`, `Character`, `Account`, `Rank`, `Item ID`, `Date`, `Time`) VALUES ('0', '"..PlayerName.."', '"..AccountName.."', '"..Rank.."', '"..code.."','"..os.date("%X").."', '"..os.date("%x").."');")
player:GossipComplete()
end
else
player:SendBroadcastMessage("|cFFFF0000[NOTICE]:|r You need to be a <GM> or <Admin> to use this Feature!")
end
end
if(intid == 2) then
player:GossipComplete()
end
end
if(intid == 3) then
if (player:GetGmRank() == 'a') or (player:GetGmRank() == 'az') or (player:GetGmRank() == 3) or (player:GetGmRank() == vip) then
local select = WorldDBQuery("SELECT * FROM items WHERE entry = "..code.."")
local PlayerName = player:GetName()
local AccountName = player:GetAccountName()
local Rank = player:GetGmRank()
if(select == NULL) then
player:SendBroadcastMessage("|cFFFF7401DF[NOTICE]:|r This doesn't exist!")
player:GossipComplete()
else
player:LearnSpell(code, 1)
player:SendBroadcastMessage("|cFFFF0000[NOTICE]:|r You have recieved Item ID "..code.." and this transaction has been logged to the database.")
WorldDBQuery("INSERT INTO item_logs (`Entry`, `Character`, `Account`, `Rank`, `Item ID`, `Date`, `Time`) VALUES ('0', '"..PlayerName.."', '"..AccountName.."', '"..Rank.."', '"..code.."','"..os.date("%X").."', '"..os.date("%x").."');")
player:GossipComplete()
end
else
player:SendBroadcastMessage("|cFFFF0000[NOTICE]:|r You need to be a <GM> or <Admin> to use this Feature!")
end
end
if(intid == 2) then
player:GossipComplete()
end
RegisterUnitGossipEvent(NPC_ID, 1, "NPC_OnGossipTalk")
RegisterUnitGossipEvent(NPC_ID, 2, "NPC_OnGossipSelect")I take no credit for making this I just found it a wile back when i was running a server, and its helpful so I though I would post it. I do not know who made it.