• 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!

AAC powergamers/insomaniacs Znote error

ItsMeMagic

Old Tibia Player.
Joined
Sep 11, 2008
Messages
318
Reaction score
25
Location
exiva "Magic~
when i hit the button powergamers...:
Code:
Notice: Undefined index: type in C:\xampp\htdocs\powergamers.php on line 18
string(435) "SELECT `a`.`id`, `b`.`player_id`, `a`.`name`, `a`.`vocation`, `a`.`level`, `a`.`group_id`, `a`.`experience`, `b`.`exphist_lastexp`, `b`.`exphist1`, `b`.`exphist2`, `b`.`exphist3`, `b`.`exphist4`, `b`.`exphist5`, `b`.`exphist6`, `b`.`exphist7`, (`a`.`experience` - `b`.`exphist_lastexp`) AS `expdiff` FROM `players` `a` JOIN `znote_players` `b` ON `a`.`id` = `b`.`player_id` WHERE `a`.`group_id` < 2 ORDER BY `expdiff` DESC LIMIT 25"
(query - SQL error)
Type: select_multi (select multiple rows from database)

Unknown column 'b.exphist_lastexp' in 'field list'

(i know i need to add tables like CREATE TABLE but i dont know the correct "command" to put in SQL

and when i hit the button insomaniacs:

Code:
Notice: Undefined index: type in C:\xampp\htdocs\insomaniacs.php on line 17
string(153) "SELECT * FROM `znote_players` AS `z` JOIN `players` AS `p` WHERE `p`.`id`=`z`.`player_id` and `p`.`group_id` < 3 ORDER BY `onlinetimetoday` DESC LIMIT 25"
(query - SQL error)
Type: select_multi (select multiple rows from database)

Unknown column 'onlinetimetoday' in 'order clause'

what do i need to do here?
 
According to @ATT3 who created this system on Znote AAC:

If using TFS 1.x:
globalevents.xml
XML:
<globalevent name="PowerGamers" interval="60000" script="powergamers.lua"/>

powergamers.lua
ZnoteAAC/powergamers.lua at master · Znote/ZnoteAAC · GitHub
Lua:
-- getEternalStorage and setEternalStorage 
-- can be added to data/global.lua if you want to use eternal storage for another purpose than this.
-- Regular TFS global storage values get reset every time server reboots. This does not.
local function getEternalStorage(key, parser)
    local value = result.getDataString(db.storeQuery("SELECT `value` FROM `znote_global_storage` WHERE `key` = ".. key .. ";"), "value")
    if not value then
        if parser then
            return false
        else
            return -1
        end
    end
    return tonumber(value) or value
end

local function setEternalStorage(key, value)
    if getEternalStorage(key, true) then
        db.query("UPDATE `znote_global_storage` SET `value` = '".. value .. "' WHERE `key` = ".. key .. ";")
    else
        db.query("INSERT INTO `znote_global_storage` (`key`, `value`) VALUES (".. key ..", ".. value ..");")
    end
    return true
end

function onThink(interval, lastExecution, thinkInterval)
    if tonumber(os.date("%d")) ~= getEternalStorage(23856) then
        setEternalStorage(23856, (tonumber(os.date("%d"))))
        db.query("UPDATE `znote_players` SET `onlinetime7`=`onlinetime6`, `onlinetime6`=`onlinetime5`, `onlinetime5`=`onlinetime4`, `onlinetime4`=`onlinetime3`, `onlinetime3`=`onlinetime2`, `onlinetime2`=`onlinetime1`, `onlinetime1`=`onlinetimetoday`, `onlinetimetoday`=0;")
        db.query("UPDATE `znote_players` `z` INNER JOIN `players` `p` ON `p`.`id`=`z`.`player_id` SET `z`.`exphist7`=`z`.`exphist6`,  `z`.`exphist6`=`z`.`exphist5`, `z`.`exphist5`=`z`.`exphist4`, `z`.`exphist4`=`z`.`exphist3`, `z`.`exphist3`=`z`.`exphist2`, `z`.`exphist2`=`z`.`exphist1`, `z`.`exphist1`=`p`.`experience`-`z`.`exphist_lastexp`, `z`.`exphist_lastexp`=`p`.`experience`;")
    end
    db.query("UPDATE `znote_players` SET `onlinetimetoday` = `onlinetimetoday` + 60, `onlinetimeall` = `onlinetimeall` + 60 WHERE `player_id` IN (SELECT `player_id` FROM `players_online` WHERE `players_online`.`player_id` = `znote_players`.`player_id`)")
    return true
end


Execute SQL code in phpmyadmin for the database:
SQL:
ALTER TABLE `znote_players`
ADD `exphist_lastexp` BIGINT( 255 ) NOT NULL DEFAULT '0',
ADD `exphist1` BIGINT( 255 ) NOT NULL DEFAULT '0',
ADD `exphist2` BIGINT( 255 ) NOT NULL DEFAULT '0',
ADD `exphist3` BIGINT( 255 ) NOT NULL DEFAULT '0',
ADD `exphist4` BIGINT( 255 ) NOT NULL DEFAULT '0',
ADD `exphist5` BIGINT( 255 ) NOT NULL DEFAULT '0',
ADD `exphist6` BIGINT( 255 ) NOT NULL DEFAULT '0',
ADD `exphist7` BIGINT( 255 ) NOT NULL DEFAULT '0',
ADD `onlinetimetoday` BIGINT( 20 ) NOT NULL DEFAULT '0',
ADD `onlinetime1` BIGINT( 20 ) NOT NULL DEFAULT '0',
ADD `onlinetime2` BIGINT( 20 ) NOT NULL DEFAULT '0',
ADD `onlinetime3` BIGINT( 20 ) NOT NULL DEFAULT '0',
ADD `onlinetime4` BIGINT( 20 ) NOT NULL DEFAULT '0',
ADD `onlinetime5` BIGINT( 20 ) NOT NULL DEFAULT '0',
ADD `onlinetime6` BIGINT( 20 ) NOT NULL DEFAULT '0',
ADD `onlinetime7` BIGINT( 20 ) NOT NULL DEFAULT '0',
ADD `onlinetimeall` BIGINT( 20 ) NOT NULL DEFAULT '0';

Then:
SQL:
UPDATE `znote_players` AS `z` INNER JOIN  `players` AS `p` ON `p`.`id`=`z`.`player_id` SET `z`.`exphist_lastexp`=`p`.`experience`
 
i did all what u said znote and:



Code:
Notice: Undefined index: powergamers in C:\xampp\htdocs\powergamers.php on line 4
This page has been disabled at config.php.
 
Replace:
Code:
$type = $_GET['type'];

with:
Code:
$type = isset($_GET['type']);

same applies to both insomaniacs.php and powergamers.php
 
Last edited:
Back
Top