roriscrave
Advanced OT User
- Joined
- Dec 7, 2011
- Messages
- 1,188
- Solutions
- 34
- Reaction score
- 200
I use tfs 0.4, tibia 8.6.
I have a boat script that after some time running, it starts to give a bug and gets spamming this bug, how do I solve it?
Script:
error:
OBS: This error spam forever, i need to use /reload npc to stop a spam
I have a boat script that after some time running, it starts to give a bug and gets spamming this bug, how do I solve it?
Script:
Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
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(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
--//////////////////////GUEST CARD//////////////////////--
-- [City Name]
-- TALK = switching 1, 2, 3, 4 accoring to the number of cities
-- COST = How many will costs the travel (gold coins)
-- LEVEL = level needed to travel with this NPC
-- STOR = True or False,
---------[True] if the player needs a certain storage in DATABASE.
---------[False] if you wanna disable this function.
-- STORID = In case you put 'True', paste this your StorageID, required to travel.
-- DESTINATION = X, Y, Z Position of place where will be teleported.
--//////////////////////GUEST CARD//////////////////////--
local travels = {
["thais"] = {talk=1, cost=0, level=0, prem=false, stor=false, storId=0, destination={x=486, y=1067, z=7}},
["venore"] = {talk=2, cost=0, level=0, prem=false, stor=false, storId=0, destination={x=1163, y=1173, z=7}},
["edron"] = {talk=3, cost=0, level=0, prem=false, stor=false, storId=0, destination={x=1040, y=892, z=5}},
["carlin"] = {talk=4, cost=0, level=0, prem=false, stor=false, storId=0, destination={x=972, y=1471, z=6}}
}
for k, v in pairs(travels) do
if(msgcontains(msg:lower(), k)) then
if isPlayerPzLocked(cid) then
selfSay('Cant travel with pz', cid)
return true
elseif getCreatureSkull(cid) >= 3 then
selfSay('Can travel black or red!', cid)
return true
end
talkState[talkUser] = v.talk
if v.stor then
if getPlayerStorageValue(cid, v.storId) > 0 then
selfSay('Do you want to travel to '..k..' for '..v.cost..' gold coins?', cid)
talkState[talkUser] = v.talk
else
selfSay('You must got Norseman Mission\'s to travel with me. Hics! Hi ckS ! Hic.', cid)
talkState[talkUser] = 0
end
elseif(talkState[talkUser] == v.talk) then
if not isPremium(cid) and v.prem then
selfSay('Only p.a go to this city.', cid)
else
if getPlayerLevel(cid) >= v.level then
if(doPlayerRemoveMoney(cid, v.cost) == TRUE) then
function effectTp(cid)
if isPlayer(cid) then
doTeleportThing(cid, v.destination, FALSE)
selfSay('Going to '..k..'.', cid)
doSendMagicEffect(getCreaturePosition(cid),4)
end
end
doSendMagicEffect(getCreaturePosition(cid),4)
addEvent(effectTp,200,cid)
else
selfSay('Sorry, you don\'t have enough gold coins.', cid)
end
else
selfSay('Sorry, you don\'t have enough level.', cid)
end
end
talkState[talkUser] = 0
elseif(msgcontains(msg, 'no') and isInArray({v.talk}, talkState[talkUser]) == TRUE) then
talkState[talkUser] = 0
selfSay('Ok then.', cid)
end
end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
error:
OBS: This error spam forever, i need to use /reload npc to stop a spam
Code:
[9:44:55.262] [Error - NpcScript Interface]
[9:44:55.262] data/npc/scripts/travel/boat.lua:onThink
[9:44:55.262] Description:
[9:44:55.262] (luaGetNpcDistanceTo) Thing not found
[9:44:55.262] [Error - NpcScript Interface]
[9:44:55.262] data/npc/scripts/travel/boat.lua:onThink
[9:44:55.262] Description:
[9:44:55.262] (luaGetCreatureName) Creature not found
[9:44:55.262] [Error - NpcScript Interface]
[9:44:55.262] data/npc/scripts/travel/boat.lua:onThink
[9:44:55.262] Description:
[9:44:55.262] data/npc/lib/npcsystem/npchandler.lua:308: bad argument #3 to 'gsub' (string/function/table expected)
[9:44:55.262] stack traceback:
[9:44:55.262] [C]: in function 'gsub'
[9:44:55.262] data/npc/lib/npcsystem/npchandler.lua:308: in function 'parseMessage'
[9:44:55.262] data/npc/lib/npcsystem/npchandler.lua:545: in function 'onWalkAway'
[9:44:55.262] data/npc/lib/npcsystem/npchandler.lua:480: in function 'onThink'
[9:44:55.262] data/npc/scripts/travel/boat.lua:9: in function <data/npc/scripts/travel/boat.lua:9>
Last edited by a moderator: