Hello, guys! I having this error, i pretty new with scripts so i have no clue of what is going on.
It's a castle war system, i currently using OTX 8.7 distro. I got the error on movements, but it happens whnever the scripts try to execute the getDataString("guild")... Already happened on creaturescripts and globalscripts aswell... i think i configuring it wrong our something... Can someone help me out with it?
Thanks alot!
Executable log error:
Movement file.lua that i think is giving the error:
Query i executing:
complete lib 004-database:
It's a castle war system, i currently using OTX 8.7 distro. I got the error on movements, but it happens whnever the scripts try to execute the getDataString("guild")... Already happened on creaturescripts and globalscripts aswell... i think i configuring it wrong our something... Can someone help me out with it?
Thanks alot!
Executable log error:
[Error - MoveEvents Interface]
data/movements/scripts/efferus/castle-wars.luanStepIn
Description:
data/lib/004-database.lua:82: [Result:getDataString] Result not set!
stack traceback:
[C]: in function 'error'
data/lib/004-database.lua:82: in function 'getDataString'
data/movements/scripts/efferus/castle-wars.lua:64: in function <data/movements/scripts/efferus/castle-wars.lua:1>
data/movements/scripts/efferus/castle-wars.luanStepIn
Description:
data/lib/004-database.lua:82: [Result:getDataString] Result not set!
stack traceback:
[C]: in function 'error'
data/lib/004-database.lua:82: in function 'getDataString'
data/movements/scripts/efferus/castle-wars.lua:64: in function <data/movements/scripts/efferus/castle-wars.lua:1>
Movement file.lua that i think is giving the error:
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
if isPlayer(cid) then
local id = getThingfromPos({x=1445,y=1273,z=7,stackpos=0}).actionid - 50000
local guild = db.getResult("SELECT `guild` FROM `castle_wars` WHERE `id` = " .. id .." ORDER BY `id` DESC;")
if item.actionid == 2518 then
if getPlayerGuildId(cid) ~= 0 then
if getPlayerGuildName(cid) == guild:getDataString("guild") then
doTeleportThing(cid, {x=2526,y=1525,z=7})
doSendMagicEffect(getCreaturePosition(cid), 10)
else
doTeleportThing(cid, {x=2526,y=1548,z=7})
doSendMagicEffect(getCreaturePosition(cid), 10)
end
else
doTeleportThing(cid, {x=1430,y=1240,z=9})
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Você precisa fazer parte de uma guild para poder participar desse evento.")
doSendMagicEffect(getCreaturePosition(cid), 10)
end
elseif item.actionid == 50093 then
if getPlayerStorageValue(cid, 50093) > os.time() then
doTeleportThing(cid, {x=2526,y=1525,z=7})
doSendMagicEffect({x=2526,y=1525,z=7}, 13)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Você precisa esperar " .. (getPlayerStorageValue(cid, 50093)-os.time()) .. " segundos para poder voltar.")
else
doTeleportThing(cid, {x=2486,y=1508,z=7})
doSendMagicEffect(getCreaturePosition(cid), 10)
end
elseif item.actionid == 50094 then
if getPlayerStorageValue(cid, 50093) > os.time() then
doTeleportThing(cid, {x=2526,y=1548,z=7})
doSendMagicEffect({x=2526,y=1548,z=7}, 13)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Você precisa esperar " .. (getPlayerStorageValue(cid, 50093)-os.time()) .. " segundos para poder voltar.")
else
doTeleportThing(cid, {x=2483,y=1550,z=7})
doSendMagicEffect(getCreaturePosition(cid), 10)
end
elseif item.actionid == 50095 then
local posEntrando = {
{x=1488,y=1201,z=7},
{x=1489,y=1201,z=7},
{x=1490,y=1201,z=7},
{x=1491,y=1201,z=7},
{x=1536,y=1232,z=6},
{x=1537,y=1232,z=6}
}
local posSaindo = {
{x=1488,y=1203,z=7},
{x=1489,y=1203,z=7},
{x=1490,y=1203,z=7},
{x=1491,y=1203,z=7},
{x=1534,y=1234,z=6},
{x=1535,y=1234,z=6},
{x=1536,y=1234,z=6},
{x=1537,y=1234,z=6}
}
local id = getThingfromPos({x=1445,y=1273,z=7,stackpos=0}).actionid - 50000
local guild = db.getResult("SELECT `guild` FROM `castle_wars` WHERE `id` = " .. id .." ORDER BY `id` DESC;")
if getPlayerStorageValue(cid, 50095) < os.time() then
for t=1,#posEntrando do
if (fromPosition.x == posEntrando[t].x and fromPosition.y == posEntrando[t].y and fromPosition.z == posEntrando[t].z) then
if guild:getDataString("guild") ~= "" then
doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,"Bem vindo à cidade de Agniter, controlada pela guild "..guild:getDataString("guild")..".")
doPlayerSetStorageValue(cid, 50095, os.time() + 60)
end
end
end
for t=1,#posSaindo do
if (fromPosition.x == posSaindo[t].x and fromPosition.y == posSaindo[t].y and fromPosition.z == posSaindo[t].z) then
if guild:getDataString("guild") ~= "" then
doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,"Você está deixando Agniter, cidade controlada pela guild "..guild:getDataString("guild")..".")
doPlayerSetStorageValue(cid, 50095, os.time() + 60)
end
end
end
end
end
end
return true
end
if isPlayer(cid) then
local id = getThingfromPos({x=1445,y=1273,z=7,stackpos=0}).actionid - 50000
local guild = db.getResult("SELECT `guild` FROM `castle_wars` WHERE `id` = " .. id .." ORDER BY `id` DESC;")
if item.actionid == 2518 then
if getPlayerGuildId(cid) ~= 0 then
if getPlayerGuildName(cid) == guild:getDataString("guild") then
doTeleportThing(cid, {x=2526,y=1525,z=7})
doSendMagicEffect(getCreaturePosition(cid), 10)
else
doTeleportThing(cid, {x=2526,y=1548,z=7})
doSendMagicEffect(getCreaturePosition(cid), 10)
end
else
doTeleportThing(cid, {x=1430,y=1240,z=9})
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Você precisa fazer parte de uma guild para poder participar desse evento.")
doSendMagicEffect(getCreaturePosition(cid), 10)
end
elseif item.actionid == 50093 then
if getPlayerStorageValue(cid, 50093) > os.time() then
doTeleportThing(cid, {x=2526,y=1525,z=7})
doSendMagicEffect({x=2526,y=1525,z=7}, 13)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Você precisa esperar " .. (getPlayerStorageValue(cid, 50093)-os.time()) .. " segundos para poder voltar.")
else
doTeleportThing(cid, {x=2486,y=1508,z=7})
doSendMagicEffect(getCreaturePosition(cid), 10)
end
elseif item.actionid == 50094 then
if getPlayerStorageValue(cid, 50093) > os.time() then
doTeleportThing(cid, {x=2526,y=1548,z=7})
doSendMagicEffect({x=2526,y=1548,z=7}, 13)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Você precisa esperar " .. (getPlayerStorageValue(cid, 50093)-os.time()) .. " segundos para poder voltar.")
else
doTeleportThing(cid, {x=2483,y=1550,z=7})
doSendMagicEffect(getCreaturePosition(cid), 10)
end
elseif item.actionid == 50095 then
local posEntrando = {
{x=1488,y=1201,z=7},
{x=1489,y=1201,z=7},
{x=1490,y=1201,z=7},
{x=1491,y=1201,z=7},
{x=1536,y=1232,z=6},
{x=1537,y=1232,z=6}
}
local posSaindo = {
{x=1488,y=1203,z=7},
{x=1489,y=1203,z=7},
{x=1490,y=1203,z=7},
{x=1491,y=1203,z=7},
{x=1534,y=1234,z=6},
{x=1535,y=1234,z=6},
{x=1536,y=1234,z=6},
{x=1537,y=1234,z=6}
}
local id = getThingfromPos({x=1445,y=1273,z=7,stackpos=0}).actionid - 50000
local guild = db.getResult("SELECT `guild` FROM `castle_wars` WHERE `id` = " .. id .." ORDER BY `id` DESC;")
if getPlayerStorageValue(cid, 50095) < os.time() then
for t=1,#posEntrando do
if (fromPosition.x == posEntrando[t].x and fromPosition.y == posEntrando[t].y and fromPosition.z == posEntrando[t].z) then
if guild:getDataString("guild") ~= "" then
doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,"Bem vindo à cidade de Agniter, controlada pela guild "..guild:getDataString("guild")..".")
doPlayerSetStorageValue(cid, 50095, os.time() + 60)
end
end
end
for t=1,#posSaindo do
if (fromPosition.x == posSaindo[t].x and fromPosition.y == posSaindo[t].y and fromPosition.z == posSaindo[t].z) then
if guild:getDataString("guild") ~= "" then
doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,"Você está deixando Agniter, cidade controlada pela guild "..guild:getDataString("guild")..".")
doPlayerSetStorageValue(cid, 50095, os.time() + 60)
end
end
end
end
end
end
return true
end
Query i executing:
CREATE TABLE IF NOT EXISTS castle_wars (
id int(11) NOT NULL auto_increment,
castle_name varchar(255) NOT NULL,
guild varchar(255) NOT NULL,
castle_war varchar(255) NOT NULL,
last_conqueror varchar(255) NOT NULL,
PRIMARY KEY (id)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1
CREATE TABLE IF NOT EXISTS castles_war (
castle_id int(5) NOT NULL,
guild_id int(5) NOT NULL,
damage int(20) NOT NULL,
time int(50) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
id int(11) NOT NULL auto_increment,
castle_name varchar(255) NOT NULL,
guild varchar(255) NOT NULL,
castle_war varchar(255) NOT NULL,
last_conqueror varchar(255) NOT NULL,
PRIMARY KEY (id)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1
CREATE TABLE IF NOT EXISTS castles_war (
castle_id int(5) NOT NULL,
guild_id int(5) NOT NULL,
damage int(20) NOT NULL,
time int(50) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
complete lib 004-database:
db.updateQueryLimitOperator = db.updateLimiter
db.stringComparisonOperator = db.stringComparer
db.stringComparison = db.stringComparer
db.executeQuery = db.query
db.quote = db.escapeString
if(result == nil) then
print("> WARNING: Couldn't load database lib.")
return
end
Result = createClass(nil)
Result:setAttributes({
id = -1,
query = ""
})
function Result:getID()
return self.id
end
function Result:setID(_id)
self.id = _id
end
function Result:getQuery()
return self.query
end
function Result:setQuery(_query)
self.query = _query
end
function Result:create(_query)
self:setQuery(_query)
local _id = db.storeQuery(self:getQuery())
if(_id) then
self:setID(_id)
end
return self:getID()
end
function Result:getRows(free)
local free = free or false
if(self:getID() == -1) then
error("[Result:getRows] Result not set!")
end
local c = 0
repeat
c = c + 1
until not self:next()
local _query = self:getQuery()
self:free()
if(not free) then
self:create(_query)
end
return c
end
function Result:getDataInt(s)
if(self:getID() == -1) then
error("[Result:getDataInt] Result not set!")
end
return result.getDataInt(self:getID(), s)
end
function Result:getDataLong(s)
if(self:getID() == -1) then
error("[Result:getDataLong] Result not set!")
end
return result.getDataLong(self:getID(), s)
end
function Result:getDataString(s)
if(self:getID() == -1) then
error("[Result:getDataString] Result not set!")
end
return result.getDataString(self:getID(), s)
end
function Result:getDataStream(s)
if(self:getID() == -1) then
error("[Result:getDataStream] Result not set!")
end
return result.getDataStream(self:getID(), s)
end
function Result:next()
if(self:getID() == -1) then
error("[Result:next] Result not set!")
end
return result.next(self:getID())
end
function Result:free()
if(self:getID() == -1) then
error("[Result:free] Result not set!")
end
self:setQuery("")
local ret = result.free(self:getID())
self:setID(-1)
return ret
end
Result.numRows = Result.getRows
function db.getResult(query)
if(type(query) ~= 'string') then
return nil
end
local ret = Result:new()
ret:create(query)
return ret
end
db.stringComparisonOperator = db.stringComparer
db.stringComparison = db.stringComparer
db.executeQuery = db.query
db.quote = db.escapeString
if(result == nil) then
print("> WARNING: Couldn't load database lib.")
return
end
Result = createClass(nil)
Result:setAttributes({
id = -1,
query = ""
})
function Result:getID()
return self.id
end
function Result:setID(_id)
self.id = _id
end
function Result:getQuery()
return self.query
end
function Result:setQuery(_query)
self.query = _query
end
function Result:create(_query)
self:setQuery(_query)
local _id = db.storeQuery(self:getQuery())
if(_id) then
self:setID(_id)
end
return self:getID()
end
function Result:getRows(free)
local free = free or false
if(self:getID() == -1) then
error("[Result:getRows] Result not set!")
end
local c = 0
repeat
c = c + 1
until not self:next()
local _query = self:getQuery()
self:free()
if(not free) then
self:create(_query)
end
return c
end
function Result:getDataInt(s)
if(self:getID() == -1) then
error("[Result:getDataInt] Result not set!")
end
return result.getDataInt(self:getID(), s)
end
function Result:getDataLong(s)
if(self:getID() == -1) then
error("[Result:getDataLong] Result not set!")
end
return result.getDataLong(self:getID(), s)
end
function Result:getDataString(s)
if(self:getID() == -1) then
error("[Result:getDataString] Result not set!")
end
return result.getDataString(self:getID(), s)
end
function Result:getDataStream(s)
if(self:getID() == -1) then
error("[Result:getDataStream] Result not set!")
end
return result.getDataStream(self:getID(), s)
end
function Result:next()
if(self:getID() == -1) then
error("[Result:next] Result not set!")
end
return result.next(self:getID())
end
function Result:free()
if(self:getID() == -1) then
error("[Result:free] Result not set!")
end
self:setQuery("")
local ret = result.free(self:getID())
self:setID(-1)
return ret
end
Result.numRows = Result.getRows
function db.getResult(query)
if(type(query) ~= 'string') then
return nil
end
local ret = Result:new()
ret:create(query)
return ret
end