Im working to add a new functions on 50-functions and trying make a VIP boat work but i dont know whats wrong with i do if possible any one can help me im glad and rep +++
Error
boat_darashia
050-function.lua
Error
Code:
[2:24:12.234] [Error - NpcScript Interface]
[2:24:12.234] data/npc/scripts/boat_darashia.lua:onCreatureSay
[2:24:12.234] Description:
[2:24:12.234] data/lib/050-function.lua:6: attempt to concatenate local 'account
Name' (a nil value)
[2:24:12.234] stack traceback:
[2:24:12.234] data/lib/050-function.lua:6: in function 'getSilverVipTime'
[2:24:12.250] data/lib/050-function.lua:78: in function 'isVip'
[2:24:12.250] data/npc/lib/npcsystem/modules.lua:170: in function 'callback'
[2:24:12.250] data/npc/lib/npcsystem/keywordhandler.lua:40: in function 'proce
ssMessage'
[2:24:12.250] data/npc/lib/npcsystem/keywordhandler.lua:168: in function 'proc
essNodeMessage'
[2:24:12.265] data/npc/lib/npcsystem/keywordhandler.lua:122: in function 'proc
essMessage'
[2:24:12.265] data/npc/lib/npcsystem/npchandler.lua:387: in function 'onCreatu
reSay'
[2:24:12.265] data/npc/scripts/boat_darashia.lua:10: in function <data/npc/scr
ipts/boat_darashia.lua:10>
boat_darashia
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
-- OTServ event handling functions start
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
-- OTServ event handling functions end
-- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions!
local travelNode = keywordHandler:addKeyword({'venore'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to Venore for 60 gold coins?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost = 60, destination = {x=32952, y=32022, z=6} })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then stay here!'})
local travelNode = keywordHandler:addKeyword({'port hope'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to Port Hope for 180 gold coins?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost = 180, destination = {x=32527, y=32784, z=6} })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then stay here!'})
local travelNode = keywordHandler:addKeyword({'ankrahmun'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to Ankrahmun for 100 gold coins?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost = 100, destination = {x=33092, y=32883, z=6} })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then stay here!'})
local travelNode = keywordHandler:addKeyword({'liberty bay'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to Liberty Bay for 200 gold coins?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost = 200, destination = {x=32285, y=32892, z=6} })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then stay here!'})
local travelNode = keywordHandler:addKeyword({'yalahar'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to Yalahar for 200 gold coins?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost = 200, destination = {x=602, y=670, z=6} })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then stay here!'})
local travelNode = keywordHandler:addKeyword({'drakov'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can bring you to VIP city Darkov for 80 gold. Agreed?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, vip = true, level = 0, cost = 80, destination = {x=33640, y=32135, z=6}, msg = 'Okay. Enjoy!' })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Come back anytime.'})
local travelNode = keywordHandler:addKeyword({'vip'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can bring you to VIP city Darkov for 80 gold. Agreed?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, vip = true, level = 0, cost = 80, destination = {x=33640, y=32135, z=6}, msg = 'Okay. Enjoy!' })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Come back anytime.'})
keywordHandler:addKeyword({'sail'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can take you to {Venore}, {Port Hope}, {Liberty Bay}, {Ankrahmun}, {Yalahar} and {Drakov}.'})
keywordHandler:addKeyword({'job'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I am the captain of this ship.'})
keywordHandler:addKeyword({'travel'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can only take you to {Venore}, {Port Hope}, {Liberty Bay}, {Ankrahmun}, {Yalahar} and {Drakov}.'})
-- Makes sure the npc reacts when you say hi, bye etc.
npcHandler:addModule(FocusModule:new())
050-function.lua
Code:
function isSummon(cid)
return getCreatureMaster(cid) ~= cid or false
end
function getSilverVipTime(accountName)
local result = db.getResult("SELECT `silverviptime` FROM `accounts` WHERE `name` = '" .. accountName .. "' LIMIT 1;")
if(result:getID() ~= -1) then
if(result:getDataInt("silverviptime") > os.time())then
return result:getDataInt("silverviptime")-os.time()
else
return 0
end
else
return FALSE
end
result:free()
end
function isSilverVip(accountName)
if(getSilverVipTime(accountName) > 0 or getBooleanFromString(getConfigInfo('freeSilverVip')))then
return TRUE
else
return FALSE
end
end
function doAddSilverVipTime(accountName, silverVipTime)
local result = db.getResult("SELECT `silverviptime` FROM `accounts` WHERE `name` = '" .. accountName .. "' LIMIT 1;")
if(result:getID() ~= -1) then
if(result:getDataInt("silverviptime") > os.time())then
timeToAdd = result:getDataInt("silverviptime")+silverVipTime
else
timeToAdd = os.time()+silverVipTime
end
db.executeQuery("UPDATE `accounts` SET `silverviptime` = " .. timeToAdd .. " WHERE `name`='" .. accountName .. "' LIMIT 1;")
result:free()
return TRUE
end
end
function getGoldVipTime(accountName)
local result = db.getResult("SELECT `goldviptime` FROM `accounts` WHERE `name` = '" .. accountName .. "' LIMIT 1;")
if(result:getID() ~= -1) then
if(result:getDataInt("goldviptime") > os.time())then
return result:getDataInt("goldviptime")-os.time()
else
return 0
end
else
return FALSE
end
result:free()
end
function isGoldVip(accountName)
if(getGoldVipTime(accountName) > 0 or getBooleanFromString(getConfigInfo('freeGoldVip')))then
return TRUE
else
return FALSE
end
end
function doAddGoldVipTime(accountName, goldVipTime)
local result = db.getResult("SELECT `goldviptime` FROM `accounts` WHERE `name` = '" .. accountName .. "' LIMIT 1;")
if(result:getID() ~= -1) then
if(result:getDataInt("goldvip") > os.time())then
timeToAdd = result:getDataInt("goldviptime")+goldVipTime
else
timeToAdd = os.time()+goldVipTime
end
db.executeQuery("UPDATE `accounts` SET `goldviptime` = " .. timeToAdd .. " WHERE `name`='" .. accountName .. "' LIMIT 1;")
result:free()
return TRUE
end
end
function isVip(cid)
if(isGoldVip(accountName) or isSilverVip(accountName))then
return TRUE
else
return FALSE
end
end
Attachments
-
npcsystem.rar14.6 KB · Views: 4 · VirusTotal