I need help with a script so it works on tfs4
thanks in advance
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid) npcHandlernCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandlernCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandlernCreatureSay(cid, type, msg) end
function onThink() npcHandlernThink() end
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid
msg = string.lower(msg)
local config = {
[{"shovel","rope","backpack","riona"}] = {type = MAPMARK_SHOVEL, pos = {x=149,y=47,z=7}, name = "Riona\'s Tool Shop"},
[{"demon","demons"}] = {type = MAPMARK_TICK, pos = {x=133,y=38,z=7}, name = "Demons"}
}
for var, ret in pairs(config) do
for _, check in pairs(var) do
if msg == check then
type,pos,name = ret.type,ret.pos,ret.name
selfSay('Do you want me to add a mapmark '..msg..'? {yes}', cid)
talkState[talkUser] = 1
end
end
end
if(msgcontains(msg, 'yes') and talkState[talkUser] >= 1) then
doPlayerAddMapMark(cid, pos,type,name)
npcHandler:say('Here you are.', cid)
talkState[talkUser] = 0
elseif(msgcontains(msg, 'no') and talkState[talkUser] >= 1) then
selfSay('Well then, hope you can find it yourself!', cid)
talkState[talkUser] = 0
npcHandler:releaseFocus(cid)
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
thanks in advance
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid) npcHandlernCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandlernCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandlernCreatureSay(cid, type, msg) end
function onThink() npcHandlernThink() end
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid
msg = string.lower(msg)
local config = {
[{"shovel","rope","backpack","riona"}] = {type = MAPMARK_SHOVEL, pos = {x=149,y=47,z=7}, name = "Riona\'s Tool Shop"},
[{"demon","demons"}] = {type = MAPMARK_TICK, pos = {x=133,y=38,z=7}, name = "Demons"}
}
for var, ret in pairs(config) do
for _, check in pairs(var) do
if msg == check then
type,pos,name = ret.type,ret.pos,ret.name
selfSay('Do you want me to add a mapmark '..msg..'? {yes}', cid)
talkState[talkUser] = 1
end
end
end
if(msgcontains(msg, 'yes') and talkState[talkUser] >= 1) then
doPlayerAddMapMark(cid, pos,type,name)
npcHandler:say('Here you are.', cid)
talkState[talkUser] = 0
elseif(msgcontains(msg, 'no') and talkState[talkUser] >= 1) then
selfSay('Well then, hope you can find it yourself!', cid)
talkState[talkUser] = 0
npcHandler:releaseFocus(cid)
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())