05-30-2013, 12:04 AM
Maybe something like this?:
function HandleCommand( Split, Player ) local MyOnSlotChangeFunction = function(Player, ChangedSlot) if Window:GetSlot( ChangedSlot ) == E_ITEM_EMERALD then Player:TeleportTo( X, Y, Z ) elseif Window:GetSlot( ChangedSlot ) == E_ITEM_DIAMOND then Player:TeleportTo( X, Y, Z ) elseif Window:GetSlot( ChangedSlot ) == E_BLOCK_DIRT then Player:SendMessage( cChatColor.Rose .. "Dirt is nothing worth" ) else --Some code here end end local MyOnWindowCloseFunction = function( Player ) Player:SendMessage( cChatColor.Rose .. "Pick something please" ) end Window = cLuaWindow(cWindow.Chest, 3 * 9); Item = cItem( E_BLOCK_DEAD_BUSH, 1, 0, 0 ); Window:SetSlot( 1, Item ); Window:SetOnSlotChange(MyOnSlotChangeFunction); Window:SetOnWindowClose(MyOnWindowCloseFunction); Player:OpenWindow( Window ); end