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

[Znote AAC] Report bug system

Znote

<?php echo $title; ?>
Staff member
Global Moderator
Premium User
Joined
Feb 14, 2008
Messages
7,030
Solutions
256
Reaction score
2,115
Location
Norway
GitHub
Znote
Originally coded by @Dark ShaoOz for Gesior AAC, I converted it to Znote AAC and improved it.
Should work with TFS 0.2 and 1.0, Znote AAC 1.4 and 1.5+

In-game talkaction
4pt6w9.png
9zvfph.png


The list:
nQOMAL.png

You can copy the /pos command and paste it in tibia client to teleport to location if you are GM.

Editing a list entry, OPTIONAL: Give them points for their help
7I6VyD.png


ea1lQR.png


Easily add and modify status types to fit your OT
1QFu3S.png


Installation:

SQL:
Code:
CREATE TABLE IF NOT EXISTS `znote_player_reports` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(50) NOT NULL,
  `posx` int(6) NOT NULL,
  `posy` int(6) NOT NULL,
  `posz` int(6) NOT NULL,
  `report_description` VARCHAR(255) NOT NULL,
  `date` INT(11) NOT NULL,
  `status` TINYINT(3) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

PHP:
Create file admin_reports.php in www(Znote AAC files) directory
with this code:
https://raw.github.com/Znote/ZnoteAAC/master/admin_reports.php

Link to it from Admin Panel:
Add this to layout/widgets/Wadmin.php:
Code:
           <li>
                <a href='admin_reports.php'>Admin Reports</a>
            </li>
LUA talkaction
talkactions.xml:
Code:
<talkaction words="!report" separator=" " script="adminreport.lua"/>
Lua:
-- Coded by Dark ShaoOz
function onSay(cid, words, param, channel)
    local storage = 6708 -- (You can change the storage if its already in use)
    local delaytime = 30 -- (Exhaust In Seconds.)
    local x = getPlayerPosition(cid).x -- (Do not edit this.)
    local y = getPlayerPosition(cid).y -- (Do not edit this.)
    local z =  getPlayerPosition(cid).z -- (Do not edit this.)
    if(param == '') then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Command param required.")
        return true
    end
    if (getPlayerStorageValue(cid, storage) <= os.time()) then
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your report has been received successfully!")
        db.query("INSERT INTO  `znote_player_reports` (`id` ,`name` ,`posx` ,`posy` ,`posz` ,`report_description` ,`date`)VALUES (NULL ,  '" .. getPlayerName(cid) .. "',  '" .. x .. "',  '" .. y .. "',  '" .. z .. "',  " .. db.escapeString(param) .. ",  '" .. os.time() .. "')")
        setPlayerStorageValue(cid,storage,os.time()+delaytime)
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You have to wait "..getPlayerStorageValue(cid, storage) - os.time().." seconds to report again.")
    end
    return TRUE
end

Znote AAC 1.4 only (if you use 1.5+ ignore this step):
Add to engine/function/general.php
Code:
function getClock($time = false, $format = false, $adjust = true) {
    if ($time === false) $time = time();
    // Date string representation
    $date = "d F Y (H:i)"; // 15 July 2013 (13:50)
    if ($adjust) $adjust = (1 * 3600); // Adjust to fit your timezone.
    else $adjust = 0;
    if ($format) return date($date, $time+$adjust);
    else return $time+$adjust;
}
Enjoy.
 
Last edited:
Oh my god this is awesome, I'll try it later... thanks!
 
@Znote

In talkaction script, change this:

Code:
db.query("INSERT INTO `player_reports` (`id` ,`name` ,`posx` ,`posy` ,`posz` ,`report_description` ,`date`)VALUES (NULL , '" .. getPlayerName(cid) .. "', '" .. x .. "', '" .. y .. "', '" .. z .. "', '" .. string.gsub(param, "'", "\\'") .. "', '" .. os.time() .. "')")

For this:
Code:
db.query("INSERT INTO `znote_player_reports` (`id` ,`name` ,`posx` ,`posy` ,`posz` ,`report_description` ,`date`)VALUES (NULL , '" .. getPlayerName(cid) .. "', '" .. x .. "', '" .. y .. "', '" .. z .. "', '" .. string.gsub(param, "'", "\\'") .. "', '" .. os.time() .. "')")
 
Love to see a website being so constantly updated. If I ever will host a server, this is the website I'd use!
 
Monokai style, good one.
 
@Znote

What do you think about a bug tracker that players can see?
Like in Gesior AAC

Maybe bugs that are on "Fixed" can be available in a public list? Thus players can see bugfixes, but not bugs that are not fixed yet so they cant be exploited?

Or make an option to toggle reports as public?
 
Last edited:
If i add

Code:
            <li>
                <a href='admin_reports.php'>Admin Reports</a>
            </li>


It's not shown up same if i add it to loggedin.php any solution?
 
If i add

Code:
            <li>
                <a href='admin_reports.php'>Admin Reports</a>
            </li>


It's not shown up same if i add it to loggedin.php any solution?
It depends on what layout you use, you gotta find out where admin links are and add it there. (Like admin_news)
 
Yea i found it out already iam using RL Tibia.com Layout and its not "widgets" it's "sub" folder and it works now :)
 
Iam kinda confused i get now this error:

Code:
string(111) "SELECT id, name, posx, posy, posz, report_description, date, status FROM znote_player_reports ORDER BY id DESC;"
(query - SQL error)
Type: select_multi (select multiple rows from database)

Unknown column 'status' in 'field list'

I Use:
http://otland.net/threads/10-31-the-forgotten-server-1-0-915.207351/
Latest master.rar from Znote
 
I added everything and once you load the page it says there have been no reports. No error in the error log and in the game it acts as if it was sent.
 
Iam kinda confused i get now this error:

Code:
string(111) "SELECT id, name, posx, posy, posz, report_description, date, status FROM znote_player_reports ORDER BY id DESC;"
(query - SQL error)
Type: select_multi (select multiple rows from database)

Unknown column 'status' in 'field list'

I Use:
http://otland.net/threads/10-31-the-forgotten-server-1-0-915.207351/
Latest master.rar from Znote

Add this to SQL:
Code:
ALTER TABLE `znote_player_reports` ADD `status` TINYINT(3) NOT NULL DEFAULT '0';

I added everything and once you load the page it says there have been no reports. No error in the error log and in the game it acts as if it was sent.
Make sure LUA SQL query add to: znote_player_reports
FiOwsf.png


And that PHP script fetch from: znote_player_reports
DBoicZ.png
 
@Znote I am getting the error in console now "[Error- TalkAction Interface] data/talkactions/scripts/adminreport.lua:14: attempt to call field 'query' <a nil value> stack traceback: data/talkactions/scripts/adminreprot.lua:14: in function <data/talkactions/scripts/adminreprot.lua:2>
 
@Znote I am getting the error in console now "[Error- TalkAction Interface] data/talkactions/scripts/adminreport.lua:14: attempt to call field 'query' <a nil value> stack traceback: data/talkactions/scripts/adminreprot.lua:14: in function <data/talkactions/scripts/adminreprot.lua:2>
in LUA script change db.query with db.executeQuery
 
Back
Top