johnsamir
Advanced OT User
When i greet this npc the server is displaying this error in console:
have tried this
this
this
and always the same error is displayed. By some reason if i remove this code
it works, but it doesn't check players sex
fixed
changed
to
and
for this
this fixed the error
Code:
Lua Script Error: [Npc interface]
data/npc/scripts/test.lua:onCreatureSay
data/npc/scripts/test.lua:15: attempt to concatenate a boolean value
stack traceback:
[C]: in function '__concat'
data/npc/scripts/Nielson.lua:15: in function 'callback'
data/npc/scripts/lib/npcsystem/npchandler.lua:344: in function 'greet'
data/npc/scripts/lib/npcsystem/npchandler.lua:523: in function 'onGreet'
data/npc/scripts/lib/npcsystem/modules.lua:250: in function 'callback'
data/npc/scripts/lib/npcsystem/keywordhandler.lua:26: in function 'processMessage'
data/npc/scripts/lib/npcsystem/keywordhandler.lua:151: in function 'processNodeMessage'
data/npc/scripts/lib/npcsystem/keywordhandler.lua:119: in function 'processMessage'
data/npc/scripts/lib/npcsystem/npchandler.lua:412: in function 'onCreatureSay'
data/npc/scripts/Nielson.lua:10: in function <data/npc/scripts/test.lua:10>
Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
-- OTServ event handling functions
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 greetCallback(cid)
if getPlayerSex(cid) == PLAYERSEX_MALE then
npcHandler:setMessage(MESSAGE_GREET, "man ".. getPlayerName(cid) .." welcome.")
return true
elseif getPlayerSex(cid) == PLAYERSEX_FEMALE then
npcHandler:setMessage(MESSAGE_GREET, " lady ".. getPlayerName(cid) .." welcomes.")
return true
end
end
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
Code:
function greetCallback(cid)
if getPlayerSex(cid) == 1 then
npcHandler:setMessage(MESSAGE_GREET, "man ".. getPlayerName(cid) .." welcome.")
return true
elseif getPlayerSex(cid) == 0 then
npcHandler:setMessage(MESSAGE_GREET, "lady ".. getPlayerName(cid) .." welcome.")
return true
end
end
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
this
Code:
function greetCallback(cid)
if getPlayerSex(cid) == 1 then
npcHandler:setMessage(MESSAGE_GREET, "man ".. getPlayerName(cid) .." welcome.")
return true
else
npcHandler:setMessage(MESSAGE_GREET, "lady ".. getPlayerName(cid) .."welcome.")
return true
end
end
and always the same error is displayed. By some reason if i remove this code
Code:
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
Post automatically merged:
fixed
changed
Lua:
if getPlayerSex(cid) == 1 then
Code:
if Player(cid):getSex() == PLAYERSEX_MALE then
Code:
npcHandler:setMessage(MESSAGE_GREET, "lady ".. getPlayerName(cid) .."welcome.")
Code:
npcHandler:setMessage(MESSAGE_GREET, "lady".." |PLAYERNAME| ".."welcome.")
Last edited: