[Znote AAC] Report bug system

Znote

<?php echo $title; ?>
Staff member
Global Moderator
Premium User
Joined
Feb 14, 2008
Messages
6,699
Best answers
211
Reaction score
1,401
Location
Norway, Oslo
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


The list:

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




Easily add and modify status types to fit your OT


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:

Colors

Joined
Mar 22, 2013
Messages
935
Best answers
3
Reaction score
251
Oh my god this is awesome, I'll try it later... thanks!
 

Ray Rewind

Doctor
Joined
Jun 6, 2009
Messages
1,348
Best answers
0
Reaction score
75
Location
Germany
Really nice ! :)

can you make the script work for 0.3.6 TFS too ?
 

Nottinghster

Tibia World RPG Developer
Joined
Oct 24, 2007
Messages
1,477
Best answers
3
Reaction score
336
Location
Brazil - Rio de Janeiro
@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() .. "')")
 

Hartass

Pedicabo
Joined
Mar 10, 2014
Messages
163
Best answers
0
Reaction score
125
Location
Sweden
Love to see a website being so constantly updated. If I ever will host a server, this is the website I'd use!
 

cbrm

Top Class brunet scripter
Staff member
Global Moderator
Joined
Jan 6, 2009
Messages
6,585
Best answers
3
Reaction score
853
Location
Caribbean Sea
Monokai style, good one.
 
OP
Znote

Znote

<?php echo $title; ?>
Staff member
Global Moderator
Premium User
Joined
Feb 14, 2008
Messages
6,699
Best answers
211
Reaction score
1,401
Location
Norway, Oslo
@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:

Maltexor

Active Member
Joined
Mar 9, 2014
Messages
214
Best answers
0
Reaction score
32
Location
Germany
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?
 
OP
Znote

Znote

<?php echo $title; ?>
Staff member
Global Moderator
Premium User
Joined
Feb 14, 2008
Messages
6,699
Best answers
211
Reaction score
1,401
Location
Norway, Oslo
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)
 

Maltexor

Active Member
Joined
Mar 9, 2014
Messages
214
Best answers
0
Reaction score
32
Location
Germany
Yea i found it out already iam using RL Tibia.com Layout and its not "widgets" it's "sub" folder and it works now :)
 

Nottinghster

Tibia World RPG Developer
Joined
Oct 24, 2007
Messages
1,477
Best answers
3
Reaction score
336
Location
Brazil - Rio de Janeiro
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?
The first option is great !!!
 

Maltexor

Active Member
Joined
Mar 9, 2014
Messages
214
Best answers
0
Reaction score
32
Location
Germany
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
 

psychosisneamia

~Beginner~
Joined
Jun 7, 2012
Messages
162
Best answers
0
Reaction score
7
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.
 
OP
Znote

Znote

<?php echo $title; ?>
Staff member
Global Moderator
Premium User
Joined
Feb 14, 2008
Messages
6,699
Best answers
211
Reaction score
1,401
Location
Norway, Oslo
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


And that PHP script fetch from: znote_player_reports
 

psychosisneamia

~Beginner~
Joined
Jun 7, 2012
Messages
162
Best answers
0
Reaction score
7
@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>
 
OP
Znote

Znote

<?php echo $title; ?>
Staff member
Global Moderator
Premium User
Joined
Feb 14, 2008
Messages
6,699
Best answers
211
Reaction score
1,401
Location
Norway, Oslo
@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
 
Top