• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Page guild error Gesior

Grillo1995

New Member
Joined
Feb 8, 2018
Messages
21
Solutions
1
Reaction score
1
Location
Brazil
Hello, when I try to ask for a guild in war the screen goes white with the error 500 in nginx!

This page is not working. Motor.com is unable to meet this request at this time.
HTTP ERROR 500

I think there must be some table missing from the database, could you help me? I'll leave here the error log you gave me on ubuntu in log / nginx

Log errors:
Code:
2020/03/04 09:43:33 [error] 28608#28608: *211 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught Error: Call to a member function fetchAll() on boolean in /var/www/html/classes/databaselist.php:68
Stack trace:
#0 /var/www/html/classes/databaselist.php(155): DatabaseList->load()
#1 /var/www/html/pages/guilds.php(1409): DatabaseList->rewind()
#2 /var/www/html/system/load.page.php(7): include('/var/www/html/p...')
#3 /var/www/html/index.php(37): include_once('/var/www/html/s...')
#4 {main}
  thrown in /var/www/html/classes/databaselist.php on line 68" while reading response header from upstream, client: 172.69.3.161, server: toran.twifysoft.com, request: "GET /?view=guilds&action=guildwarstart&guild=3 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.2-fpm.sock:", host: "toran.twifysoft.com", referrer: "https://toran.twifysoft.com/?view=guilds&action=show&guild=3"
2020/03/04 09:43:41 [error] 28608#28608: *215 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught Error: Call to a member function fetchAll() on boolean in /var/www/html/classes/databaselist.php:68
Stack trace:
#0 /var/www/html/classes/databaselist.php(155): DatabaseList->load()
#1 /var/www/html/pages/guilds.php(1409): DatabaseList->rewind()
#2 /var/www/html/system/load.page.php(7): include('/var/www/html/p...')
#3 /var/www/html/index.php(37): include_once('/var/www/html/s...')
#4 {main}
  thrown in /var/www/html/classes/databaselist.php on line 68" while reading response header from upstream, client: 172.69.3.161, server: toran.twifysoft.com, request: "GET /?view=guilds&action=guildwarstart&guild=3 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.2-fpm.sock:", host: "toran.twifysoft.com", referrer: "https://toran.twifysoft.com/?view=guilds&action=show&guild=3"

My page guilds.php


I wait, thank !
 
Next I managed to fix the error on the site, but when the guild war ends it is not updating the STATUS and ENDED in database, which is finished and frags count! Do I have this on TFS or Em globalevents? where is ?

I sent my playerdeath.lua

Code:
local deathListEnabled = true
local maxDeathRecords = 5

function onDeath(player, corpse, killer, mostDamageKiller, unjustified, mostDamageUnjustified)
    local playerId = player:getId()
    if nextUseStaminaTime[playerId] then
        nextUseStaminaTime[playerId] = nil
    end

    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You are dead.")
    if player:getStorageValue(Storage.SvargrondArena.Pit) > 0 then
        player:setStorageValue(Storage.SvargrondArena.Pit, 0)
    end
    if not deathListEnabled then
        return
    end

    local byPlayer = 0
    local killerName
    if killer then
        if killer:isPlayer() then
            byPlayer = 1
        else
            local master = killer:getMaster()
            if master and master ~= killer and master:isPlayer() then
                killer = master
                byPlayer = 1
            end
        end
        killerName = killer:getName()
    else
        killerName = "field item"
    end

    local byPlayerMostDamage = 0
    local mostDamageKillerName
    if mostDamageKiller then
        if mostDamageKiller:isPlayer() then
            byPlayerMostDamage = 1
        else
            local master = mostDamageKiller:getMaster()
            if master and master ~= mostDamageKiller and master:isPlayer() then
                mostDamageKiller = master
                byPlayerMostDamage = 1
            end
        end
        mostDamageName = mostDamageKiller:getName()
    else
        mostDamageName = "field item"
    end

    local playerGuid = player:getGuid()
    --local playerGuidd = killer:getGuid()
    --valuee = 1
    db.query("INSERT INTO `player_deaths` (`player_id`, `time`, `level`, `killed_by`, `is_player`, `mostdamage_by`, `mostdamage_is_player`, `unjustified`, `mostdamage_unjustified`) VALUES (" .. playerGuid .. ", " .. os.time() .. ", " .. player:getLevel() .. ", " .. db.escapeString(killerName) .. ", " .. byPlayer .. ", " .. db.escapeString(mostDamageName) .. ", " .. byPlayerMostDamage .. ", " .. (unjustified and 1 or 0) .. ", " .. (mostDamageUnjustified and 1 or 0) .. ")")
    --db.query("UPDATE `players` SET `frags_all` = `frags_all` + " .. valuee .. " WHERE `id` = " .. playerGuidd .. ";") 
    local resultId = db.storeQuery("SELECT `player_id` FROM `player_deaths` WHERE `player_id` = " .. playerGuid)

    local deathRecords = 0
    local tmpResultId = resultId
    while tmpResultId ~= false do
        tmpResultId = result.next(resultId)
        deathRecords = deathRecords + 1
    end

    if resultId ~= false then
        result.free(resultId)
    end

    local limit = deathRecords - maxDeathRecords
    if limit > 0 then
        db.asyncQuery("DELETE FROM `player_deaths` WHERE `player_id` = " .. playerGuid .. " ORDER BY `time` LIMIT " .. limit)
    end

    if byPlayer == 1 then
        local targetGuild = player:getGuild()
        targetGuild = targetGuild and targetGuild:getId() or 0
        if targetGuild ~= 0 then
            local killerGuild = killer:getGuild()
            killerGuild = killerGuild and killerGuild:getId() or 0
            if killerGuild ~= 0 and targetGuild ~= killerGuild and isInWar(playerId, killer:getId()) then
                local warId = false
                resultId = db.storeQuery("SELECT `id` FROM `guild_wars` WHERE `status` = 1 AND ((`guild1` = " .. killerGuild .. " AND `guild2` = " .. targetGuild .. ") OR (`guild1` = " .. targetGuild .. " AND `guild2` = " .. killerGuild .. "))")
                if resultId ~= false then
                    warId = result.getDataInt(resultId, "id")
                    result.free(resultId)
                end

                if warId ~= false then
                    db.asyncQuery("INSERT INTO `guildwar_kills` (`killer`, `target`, `killerguild`, `targetguild`, `time`, `warid`) VALUES (" .. db.escapeString(killerName) .. ", " .. db.escapeString(player:getName()) .. ", " .. killerGuild .. ", " .. targetGuild .. ", " .. os.time() .. ", " .. warId .. ")")
                end
            end
        end
    end
end

Code:
CREATE TABLE IF NOT EXISTS `guild_wars` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `guild1` int(11) NOT NULL DEFAULT '0',
  `guild2` int(11) NOT NULL DEFAULT '0',
  `name1` varchar(255) NOT NULL,
  `name2` varchar(255) NOT NULL,
  `status` tinyint(2) NOT NULL DEFAULT '0',
  `started` bigint(15) NOT NULL DEFAULT '0',
  `ended` bigint(15) NOT NULL DEFAULT '0',
  `fraglimit` tinyint(3) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `guild1` (`guild1`),
  KEY `guild2` (`guild2`)
) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8;

CREATE TABLE IF NOT EXISTS `guildwar_kills` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `killer` varchar(50) NOT NULL,
  `target` varchar(50) NOT NULL,
  `killerguild` int(11) NOT NULL DEFAULT '0',
  `targetguild` int(11) NOT NULL DEFAULT '0',
  `warid` int(11) NOT NULL DEFAULT '0',
  `time` bigint(15) NOT NULL,
  PRIMARY KEY (`id`),
  FOREIGN KEY (`warid`) REFERENCES `guild_wars` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8;

How do I change the ENDED in the database when the player dies? it needs to increase to count the frags, and when it reaches the limit, change the STATUS to '4'.

Thanks!
 
Last edited:
Back
Top