Lais Prad
Disgusting Scammer
- Joined
- Apr 12, 2017
- Messages
- 153
- Solutions
- 6
- Reaction score
- 15
Hello, how to apply this function on this script npc?
tfs 1.3
Example: if player say "change sex doll" dont work, if he say "Change Sex Doll" will work
tfs 1.3
Example: if player say "change sex doll" dont work, if he say "Change Sex Doll" will work
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
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
local storeTable = {}
local itemsTable = {
["Change Sex Doll"] = {itemId = 13030, count = 15},
["Crystal Crossbow"] = {itemId = 18453, count = 5}
}
local function creatureSayCallback(cid, type, msg)
if not npcHandler:isFocused(cid) then
return false
end
local player = Player(cid)
if npcHandler.topic[cid] == 0 then
local table = itemsTable[msg]
if table then
npcHandler:say("So you want to exchange "..msg..", for ".. table.count .." lucky coins?", cid)
storeTable[cid] = msg
npcHandler.topic[cid] = 1
end
end
npcHandler:setCallback(CALLBACK_ONRELEASEFOCUS, onReleaseFocus)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())