Advertisement
Rochet2

Untitled

May 18th, 2013
279
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.00 KB | None | 0 0
  1. local item_id = 6948
  2. -- local menu_id = 1 -- unused
  3.  
  4. function Item_Hello(event, player, item)
  5.     -- NOTE; THIS IS ALWAYS NEEDED HERE IN PLAYER GOSSIP:
  6.     player:GossipClearMenu()
  7.    
  8.     player:GossipMenuAddItem(0, "menu 1", 0, 1, 0)
  9.     player:GossipMenuAddItem(0, "menu 2", 0, 2, 0)
  10.     player:GossipSendMenu(1, player, 333) -- Note player and 333, same as in register
  11. end
  12.  
  13. local function OnSelect(event, player, player, sender, intid, code, menu_id)
  14.     if(intid == 1) then
  15.     player:GossipMenuAddItem(0, "worked 1", 0, 2, 0)
  16.     player:GossipSendMenu(1, player, menu_id) -- can use menu_id or 333 .. or different number too, if you want to register the menu actions to another function
  17.     end
  18.    
  19.     if(intid == 2) then
  20.     player:GossipMenuAddItem(0, "worked 2", 0, 2, 0)
  21.     player:GossipSendMenu(1, player, menu_id)
  22.     end
  23.     -- Item_Hello(event, player) -- Shows main menu (event is 2)
  24. end
  25.  
  26. RegisterItemGossipEvent(item_id, 1, Item_Hello)
  27. RegisterPlayerGossipEvent(333, 2, OnSelect) -- GOSSIP_EVENT_ON_SELECT
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement