• 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!

Npc

pele112

Member
Joined
Aug 9, 2007
Messages
571
Reaction score
8
Location
Wodzisław Śląski
Hello ! I Dont know why this script dont work

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

-- OTServ event handling functions start
function onCreatureAppear(cid) npcHandler:eek:nCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:eek:nCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:eek:nCreatureSay(cid, type, msg) end
function onThink() npcHandler:eek:nThink() end
-- OTServ event handling functions end
function creatureSayCallback(cid, type, msg)
if(getPlayerStorageValue(cid,1337,1) then
local travelNode = keywordHandler:addKeyword({'idz'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'czy chcesz isc?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 0, cost = 0, destination = {x=437, y=505, z=7} })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'To spierdalaj!'})
else
if(not npcHandler:isFocused(cid)) then
return FALSE
end

npcHandler.talkStart[cid] = os.time()
msg = string.lower(msg)
if msgcontains(msg, 'item') then
npcHandler:say('Dajesz to kurwa ?', cid)
talk_state[talkUser] = 1
elseif msgcontains(msg, 'yes') then
if talk_state[talkUser] == 1 then
if doPlayerRemoveMoney(cid,2391249) == TRUE then
setPlayerStorageValue(cid, 1337, 1)
npcHandler:say('Danke i spierdalaj.', cid)
else
npcHandler:say('nie masz kaski wiec spierdalaj', cid)
end
end
end
end

keywordHandler:addKeyword({'travel'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Mam nasrane w pale dej mi item'})
-- Makes sure the npc reacts when you say hi, bye etc.
npcHandler:addModule(FocusModule:new())

Error:
44634040c1fc7529med.jpg
 
Last edited:
Try this:
Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

-- OTServ event handling functions start
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
-- OTServ event handling functions end
function creatureSayCallback(cid, type, msg)
if(getPlayerStorageValue(cid,1337,1) == TRUE) then
local travelNode = keywordHandler:addKeyword({'idz'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'czy chcesz isc?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 0, cost = 0, destination = {x=437, y=505, z=7} })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'To spierdalaj!'})
else
if(not npcHandler:isFocused(cid)) then
return FALSE
end

npcHandler.talkStart[cid] = os.time()
msg = string.lower(msg)
if msgcontains(msg, 'item') then
npcHandler:say('Dajesz to kurwa ?', cid)
talk_state[talkUser] = 1
elseif msgcontains(msg, 'yes') then
if talk_state[talkUser] == 1 then
if doPlayerRemoveMoney(cid,2391249) == TRUE then
setPlayerStorageValue(cid, 1337, 1)
npcHandler:say('Danke i spierdalaj.', cid)
else
npcHandler:say('nie masz kaski wiec spierdalaj', cid)
end
end
end
end

keywordHandler:addKeyword({'travel'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Mam nasrane w pale dej mi item'})
-- Makes sure the npc reacts when you say hi, bye etc.
npcHandler:addModule(FocusModule:new())
Should work, ^_^.
 
Back
Top