hi guys i was trying to adapt this Multiworld system by aurelion5670 · Pull Request #929 · opentibiabr/otservbr-global (https://github.com/opentibiabr/otservbr-global/pull/929/files) multiworld system in nostalrius engine i think the code did adapt sucessfully because it compile good i have setup everything correctly as i know but something is giving me error in console
this is my new edited startup.lua
and this one the old startup.lua
also i can't see characterlist with otcv8 when i see console it give me this error
Lua:
Aug 19 00:27:59 tester tfs[152622]: [Error - mysql_real_query] Query: TRUNCATE TABLE `players_online` WHERE `world_id` = 3306
Aug 19 00:27:59 tester tfs[152622]: Message: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'WHERE `world_id` = 3306' at line 1
Aug 19 00:27:59 tester tfs[152622]: [Error - mysql_real_query] Query: SELECT `id`, `world_id`, `highest_bidder`, `last_bid`, (SELECT `balance` FROM `players` WHERE `players`.`id` = `highest_bidder`) AS `balance` FROM `houses` WHERE `owner` = 0 AND `world_id` = 3306 AND `bid_end` != 0 AND `bid_end` < 1597796879
Aug 19 00:27:59 tester tfs[152622]: Message: Unknown column 'world_id' in 'field list'
Aug 19 00:27:59 tester tfs[152622]: [Error - mysql_store_result] Query: SELECT `id`, `world_id`, `highest_bidder`, `last_bid`, (SELECT `balance` FROM `players` WHERE `players`.`id` = `highest_bidder`) AS `balance` FROM `houses` WHERE `owner` = 0 AND `world_id` = 3306 AND `bid_end` != 0 AND `bid_end` < 1597796879
Aug 19 00:27:59 tester tfs[152622]: Message: Commands out of sync; you can't run this command now
Lua:
function onStartup()
math.randomseed(os.mtime())
db.asyncQuery('TRUNCATE TABLE `players_online` WHERE `world_id` = '..configManager.getNumber(configKeys.WORLD_ID)..'')
db.asyncQuery("DELETE FROM `guild_wars` WHERE `status` = 0")
db.asyncQuery("DELETE FROM `players` WHERE `deletion` != 0 AND `deletion` < " .. os.time())
db.asyncQuery("DELETE FROM `ip_bans` WHERE `expires_at` != 0 AND `expires_at` <= " .. os.time())
-- Move expired bans to ban history
local resultId = db.storeQuery("SELECT * FROM `account_bans` WHERE `expires_at` != 0 AND `expires_at` <= " .. os.time())
if resultId ~= false then
repeat
local accountId = result.getDataInt(resultId, "account_id")
db.asyncQuery("INSERT INTO `account_ban_history` (`account_id`, `reason`, `banned_at`, `expired_at`, `banned_by`) VALUES (" .. accountId .. ", " .. db.escapeString(result.getDataString(resultId, "reason")) .. ", " .. result.getDataLong(resultId, "banned_at") .. ", " .. result.getDataLong(resultId, "expires_at") .. ", " .. result.getDataInt(resultId, "banned_by") .. ")")
db.asyncQuery("DELETE FROM `account_bans` WHERE `account_id` = " .. accountId)
until not result.next(resultId)
result.free(resultId)
end
-- Check house auctions
local resultId = db.storeQuery('SELECT `id`, `world_id`, `highest_bidder`, `last_bid`, (SELECT `balance` FROM `players` WHERE `players`.`id` = `highest_bidder`) AS `balance` FROM `houses` WHERE `owner` = 0 AND `world_id` = '..configManager.getNumber(configKeys.WORLD_ID)..' AND `bid_end` != 0 AND `bid_end` < ' .. os.time())
if resultId ~= false then
repeat
local house = House(result.getDataInt(resultId, "id"))
if house ~= nil then
local highestBidder = result.getDataInt(resultId, "highest_bidder")
local balance = result.getDataLong(resultId, "balance")
local lastBid = result.getDataInt(resultId, "last_bid")
if balance >= lastBid then
db.query("UPDATE `players` SET `balance` = " .. (balance - lastBid) .. " WHERE `id` = " .. highestBidder)
house:setOwnerGuid(highestBidder)
end
db.asyncQuery('UPDATE `houses` SET `last_bid` = 0, `bid_end` = 0, `highest_bidder` = 0, `bid` = 0 WHERE `world_id` = '..configManager.getNumber(configKeys.WORLD_ID)..' and `id` = ' .. house:getId())
end
until not result.next(resultId)
result.free(resultId)
end
-- Remove murders that are more than 60 days old
local resultId = db.storeQuery("SELECT * FROM `player_murders` WHERE `date` <= " .. os.time() - 60 * 24 * 60 * 60)
if resultId ~= false then
repeat
local playerId = result.getDataInt(resultId, "player_id")
local id = result.getDataLong(resultId, "id")
db.asyncQuery("DELETE FROM `player_murders` WHERE `player_id` = " .. playerId .. " AND `id` = " .. id)
until not result.next(resultId)
result.free(resultId)
end
end
and this one the old startup.lua
Lua:
function onStartup()
math.randomseed(os.mtime())
db.query("TRUNCATE TABLE `players_online`")
db.asyncQuery("DELETE FROM `guild_wars` WHERE `status` = 0")
db.asyncQuery("DELETE FROM `players` WHERE `deletion` != 0 AND `deletion` < " .. os.time())
db.asyncQuery("DELETE FROM `ip_bans` WHERE `expires_at` != 0 AND `expires_at` <= " .. os.time())
-- Move expired bans to ban history
local resultId = db.storeQuery("SELECT * FROM `account_bans` WHERE `expires_at` != 0 AND `expires_at` <= " .. os.time())
if resultId ~= false then
repeat
local accountId = result.getDataInt(resultId, "account_id")
db.asyncQuery("INSERT INTO `account_ban_history` (`account_id`, `reason`, `banned_at`, `expired_at`, `banned_by`) VALUES (" .. accountId .. ", " .. db.escapeString(result.getDataString(resultId, "reason")) .. ", " .. result.getDataLong(resultId, "banned_at") .. ", " .. result.getDataLong(resultId, "expires_at") .. ", " .. result.getDataInt(resultId, "banned_by") .. ")")
db.asyncQuery("DELETE FROM `account_bans` WHERE `account_id` = " .. accountId)
until not result.next(resultId)
result.free(resultId)
end
-- Check house auctions
local resultId = db.storeQuery("SELECT `id`, `highest_bidder`, `last_bid`, (SELECT `balance` FROM `players` WHERE `players`.`id` = `highest_bidder`) AS `balance` FROM `houses` WHERE `owner` = 0 AND `bid_end` != 0 AND `bid_end` < " .. os.time())
if resultId ~= false then
repeat
local house = House(result.getDataInt(resultId, "id"))
if house ~= nil then
local highestBidder = result.getDataInt(resultId, "highest_bidder")
local balance = result.getDataLong(resultId, "balance")
local lastBid = result.getDataInt(resultId, "last_bid")
if balance >= lastBid then
db.query("UPDATE `players` SET `balance` = " .. (balance - lastBid) .. " WHERE `id` = " .. highestBidder)
house:setOwnerGuid(highestBidder)
end
db.asyncQuery("UPDATE `houses` SET `last_bid` = 0, `bid_end` = 0, `highest_bidder` = 0, `bid` = 0 WHERE `id` = " .. house:getId())
end
until not result.next(resultId)
result.free(resultId)
end
-- Remove murders that are more than 60 days old
local resultId = db.storeQuery("SELECT * FROM `player_murders` WHERE `date` <= " .. os.time() - 60 * 24 * 60 * 60)
if resultId ~= false then
repeat
local playerId = result.getDataInt(resultId, "player_id")
local id = result.getDataLong(resultId, "id")
db.asyncQuery("DELETE FROM `player_murders` WHERE `player_id` = " .. playerId .. " AND `id` = " .. id)
until not result.next(resultId)
result.free(resultId)
end
end
Code:
ERROR: protected lua call failed: C++ call failed: InputMessage eof reached
stack traceback:
[builtin#146]: at 0x011ef230
[C]: in function 'getString'
/modules/gamelib/protocollogin.lua:247: in function 'parseCharacterList'
/modules/gamelib/protocollogin.lua:178: in function </modules/gamelib/protocollogin.lua:159>