• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua how can i make a refference in a table for msgcontains(msg, ... )

How to make a refference in a table for msgcontains something like that, it doesnt work ofc:

Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
function onCreatureAppear(cid)                  npcHandler:onCreatureAppear(cid)                        end
function onCreatureDisappear(cid)               npcHandler:onCreatureDisappear(cid)                     end
function onCreatureSay(cid, type, msg)  npcHandler:onCreatureSay(cid, type, msg)        end
function onThink()                                              npcHandler:onThink()    end
 
function creatureSayCallback (cid, type, msg)
  if(npcHandler.focus ~= cid) then
     return 0
  end

local Items = {
["magic sword"] = {price = 12, id = 1}, 
["demon armor"] = {price = 14, id = 1},
["demon helmet"] = {price = 14, id = 1}
}

               if(msgcontains(Items[msg])) then
                   npcHandler:say("do you want to buy a "..msg.." for "..Items[msg].price.." gold?")
		   talkState[talkUser] = 1

	       end
	       return 1
end

npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Back
Top