Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --######################
- --# By Keta of Modcraft#
- --######################
- local NPCID = 500500
- local AnswerOnId = 0
- local function NPC_GossipHello(pUnit, event, pPlayer)
- pUnit:GossipCreateMenu(100, pPlayer, 0)
- local result = WorldDBQuery( "SELECT * FROM `gossip_menus`" );
- if( result ~= NIL ) then
- local rowcount = result:GetRowCount();
- local colcount = result:GetColumnCount();
- repeat
- if (result:GetColumn(1):GetUShort() == AnswerOnId) then
- pUnit:GossipMenuAddItem(result:GetColumn(3):GetUShort(), result:GetColumn(2):GetString(), result:GetColumn(4):GetUShort(), 0)
- end
- until result:NextRow() ~= true;
- pUnit:GossipMenuAddItem(0, "[Exit]", 0, 0)
- end
- pUnit:GossipSendMenu(pPlayer)
- end
- local function NPC_GossipSelect(pUnit, event, pPlayer, id, intid, code)
- local MenuAdded = false
- if (intid == 0) then
- pPlayer:GossipComplete()
- elseif (intid == 500) then
- pPlayer:SendBroadcastMessage(pPlayer:GetName())
- pPlayer:GossipComplete()
- else
- local result = WorldDBQuery( "SELECT * FROM `gossip_menus`" );
- pUnit:GossipCreateMenu(100, pPlayer, 0)
- if( result ~= NIL ) then
- local rowcount = result:GetRowCount();
- local colcount = result:GetColumnCount();
- repeat
- if (result:GetColumn(1):GetUShort() == intid) then
- pUnit:GossipMenuAddItem(result:GetColumn(3):GetUShort(), result:GetColumn(2):GetString(), result:GetColumn(4):GetUShort(), 0)
- MenuAdded = true
- end
- until result:NextRow() ~= true;
- end
- pUnit:GossipMenuAddItem(0, "[Exit]", 0, 0)
- if MenuAdded == false then
- pPlayer:GossipComplete()
- pPlayer:SendBroadcastMessage("Error: Missing Menu Table. Report to developers")
- else
- pUnit:GossipSendMenu(pPlayer)
- end
- end
- end
- RegisterUnitGossipEvent(NPCID, 1, NPC_GossipHello)
- RegisterUnitGossipEvent(NPCID, 2, NPC_GossipSelect)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement