
edited 1×, last 26.01.17 11:33:13 am
addhook("say","_say") function _say(p,txt) 	-- Hello 	if (txt=="hello") then menu(p,"Hello,add menu"); return 1 end 	-- Nice 	if (txt=="nice") then menu(p,"Nice,add menu"); return 1 end 	 end
-- NEW code: tested & working -- which positions will open a menu when saying !hello ? pos = { [1] = {5,9}, -- stay on Tile 5|9 [2] = {12,12}, -- stay on Tile 12|12 ---... as much you like } addhook("say","mySay") function mySay(id,txt) if (txt == "!hello") then local px = player(id,"tilex") local py = player(id,"tiley") for iposi, posi in pairs(pos) do if (px == posi[1]) then if (py == posi[2]) then 		 --menu(id,tostring(iposi)..". Menu, Energy Drink, Smartphone, E-Cigs.") -- this is the same menu for all positions (probably not what you want) if (iposi == 1) then -- look if player is standing @Market position menu(id,"NEW MARKET, Fresh Fish|ezpz, Apples|lmsqz, Bread | without butter") -- change as you like elseif (iposi == 2) then -- modify as you like: The "" String has to match with the names you gave in pos = {} array menu(id,"AMMONATION, Swords, Rifles, Gunblades, Ammo") end end end end end end addhook("menu", "myMenu") function myMenu(id,txt,b) -- id, txt, button if (txt == "NEW MARKET") then if (b == 1) then -- if button 1 pressed elseif (b== 2) then -- if button 2 pressed elseif (b== 3) then -- ... end elseif (txt =="AMMONATION") then if (b == 1) then -- if button 1 pressed elseif (b== 2) then -- if button 2 pressed elseif (b== 3) then -- ... end end end
-- which positions will open a menu when saying !hello ? pos = { [1] = {37,19}, -- stay on Tile 37|19 [2] = {37,20}, -- stay on Tile 37|20 ---... as much you like }