[Znote AAC] Report bug system

Discussion in 'Website Applications' started by Znote, Mar 10, 2014.

  1. Znote

    Znote <?php echo $title; ?> Staff Member Global Moderator Premium User

    Joined:
    Feb 14, 2008
    Messages:
    6,361
    Likes Received:
    1,058
    Best Answers:
    148
    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
    [​IMG] [​IMG]

    The list:
    [​IMG]
    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
    [​IMG]

    [​IMG]

    Easily add and modify status types to fit your OT
    [​IMG]

    Installation:

    SQL:
    Code (Text):
    1.  
    2. CREATE TABLE IF NOT EXISTS `znote_player_reports` (
    3.   `id` int(11) NOT NULL AUTO_INCREMENT,
    4.   `name` varchar(50) NOT NULL,
    5.   `posx` int(6) NOT NULL,
    6.   `posy` int(6) NOT NULL,
    7.   `posz` int(6) NOT NULL,
    8.   `report_description` VARCHAR(255) NOT NULL,
    9.   `date` INT(11) NOT NULL,
    10.   `status` TINYINT(3) NOT NULL DEFAULT '0',
    11.   PRIMARY KEY (`id`)
    12. ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
    13.  
    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 (Text):
    1.  
    2.            <li>
    3.                 <a href='admin_reports.php'>Admin Reports</a>
    4.             </li>
    5.  
    LUA talkaction
    talkactions.xml:
    Code (Text):
    1. <talkaction words="!report" separator=" " script="adminreport.lua"/>
    Code (Lua):
    1.  
    2. -- Coded by Dark ShaoOz
    3. function onSay(cid, words, param, channel)
    4.     local storage = 6708 -- (You can change the storage if its already in use)
    5.     local delaytime = 30 -- (Exhaust In Seconds.)
    6.     local x = getPlayerPosition(cid).x -- (Do not edit this.)
    7.     local y = getPlayerPosition(cid).y -- (Do not edit this.)
    8.     local z =  getPlayerPosition(cid).z -- (Do not edit this.)
    9.     if(param == '') then
    10.         doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Command param required.")
    11.         return true
    12.     end
    13.     if (getPlayerStorageValue(cid, storage) <= os.time()) then
    14.         doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your report has been received successfully!")
    15.         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() .. "')")
    16.         setPlayerStorageValue(cid,storage,os.time()+delaytime)
    17.     else
    18.         doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You have to wait "..getPlayerStorageValue(cid, storage) - os.time().." seconds to report again.")
    19.     end
    20.     return TRUE
    21. end
    22.  
    Znote AAC 1.4 only (if you use 1.5+ ignore this step):
    Add to engine/function/general.php
    Code (Text):
    1.  
    2. function getClock($time = false, $format = false, $adjust = true) {
    3.     if ($time === false) $time = time();
    4.     // Date string representation
    5.     $date = "d F Y (H:i)"; // 15 July 2013 (13:50)
    6.     if ($adjust) $adjust = (1 * 3600); // Adjust to fit your timezone.
    7.     else $adjust = 0;
    8.     if ($format) return date($date, $time+$adjust);
    9.     else return $time+$adjust;
    10. }
    11.  
    Enjoy.
     
    Last edited: Mar 12, 2014
    nemec, Purple Cow, lopez65 and 6 others like this.
  2. Colors

    Colors

    Joined:
    Mar 22, 2013
    Messages:
    929
    Likes Received:
    258
    Best Answers:
    3
    Oh my god this is awesome, I'll try it later... thanks!
     
  3. Ganjita

    Ganjita Active Member

    Joined:
    Dec 15, 2009
    Messages:
    495
    Likes Received:
    37
    Best Answers:
    0
    Nice work, really nice
     
  4. Ray Rewind

    Ray Rewind Doctor

    Joined:
    Jun 6, 2009
    Messages:
    1,349
    Likes Received:
    74
    Best Answers:
    0
    Really nice ! :)

    can you make the script work for 0.3.6 TFS too ?
     
  5. Nottinghster

    Nottinghster Tibia World RPG Developer

    Joined:
    Oct 24, 2007
    Messages:
    1,436
    Likes Received:
    304
    Best Answers:
    2
    @Znote

    In talkaction script, change this:

    Code (Text):
    1.  
    2. 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 (Text):
    1.  
    2. 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() .. "')")
     
  6. Nottinghster

    Nottinghster Tibia World RPG Developer

    Joined:
    Oct 24, 2007
    Messages:
    1,436
    Likes Received:
    304
    Best Answers:
    2
    Also you can make an option to delete the reported bug fixed ;]
     
  7. Hartass

    Hartass Pedicabo

    Joined:
    Mar 10, 2014
    Messages:
    163
    Likes Received:
    118
    Best Answers:
    0
    Love to see a website being so constantly updated. If I ever will host a server, this is the website I'd use!
     
  8. cbrm

    cbrm Just another mod Staff Member Global Moderator

    Joined:
    Jan 6, 2009
    Messages:
    6,541
    Likes Received:
    834
    Best Answers:
    0
    Monokai style, good one.
     
  9. Nottinghster

    Nottinghster Tibia World RPG Developer

    Joined:
    Oct 24, 2007
    Messages:
    1,436
    Likes Received:
    304
    Best Answers:
    2
    @Znote

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

    Znote <?php echo $title; ?> Staff Member Global Moderator Premium User

    Joined:
    Feb 14, 2008
    Messages:
    6,361
    Likes Received:
    1,058
    Best Answers:
    148
    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: Mar 10, 2014
    HalfAway likes this.
  11. Maltexor

    Maltexor Active Member

    Joined:
    Mar 9, 2014
    Messages:
    214
    Likes Received:
    38
    Best Answers:
    0
    If i add

    Code (Text):
    1.             <li>
    2.                 <a href='admin_reports.php'>Admin Reports</a>
    3.             </li>

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

    Znote <?php echo $title; ?> Staff Member Global Moderator Premium User

    Joined:
    Feb 14, 2008
    Messages:
    6,361
    Likes Received:
    1,058
    Best Answers:
    148
    It depends on what layout you use, you gotta find out where admin links are and add it there. (Like admin_news)
     
  13. Maltexor

    Maltexor Active Member

    Joined:
    Mar 9, 2014
    Messages:
    214
    Likes Received:
    38
    Best Answers:
    0
    Yea i found it out already iam using RL Tibia.com Layout and its not "widgets" it's "sub" folder and it works now :)
     
  14. Nottinghster

    Nottinghster Tibia World RPG Developer

    Joined:
    Oct 24, 2007
    Messages:
    1,436
    Likes Received:
    304
    Best Answers:
    2
    The first option is great !!!
     
  15. Maltexor

    Maltexor Active Member

    Joined:
    Mar 9, 2014
    Messages:
    214
    Likes Received:
    38
    Best Answers:
    0
    Iam kinda confused i get now this error:

    Code (Text):
    1. string(111) "SELECT id, name, posx, posy, posz, report_description, date, status FROM znote_player_reports ORDER BY id DESC;"
    2. (query - SQL error)
    3. Type: select_multi (select multiple rows from database)
    4.  
    5. 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
     
  16. psychosisneamia

    psychosisneamia ~Beginner~

    Joined:
    Jun 7, 2012
    Messages:
    162
    Likes Received:
    7
    Best Answers:
    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.
     
  17. Znote

    Znote <?php echo $title; ?> Staff Member Global Moderator Premium User

    Joined:
    Feb 14, 2008
    Messages:
    6,361
    Likes Received:
    1,058
    Best Answers:
    148
    Add this to SQL:
    Code (Text):
    1.  
    2. ALTER TABLE `znote_player_reports` ADD `status` TINYINT(3) NOT NULL DEFAULT '0';
    3.  
    Make sure LUA SQL query add to: znote_player_reports
    [​IMG]

    And that PHP script fetch from: znote_player_reports
    [​IMG]
     
  18. Maltexor

    Maltexor Active Member

    Joined:
    Mar 9, 2014
    Messages:
    214
    Likes Received:
    38
    Best Answers:
    0
    Thanks fixed it :)
     
  19. psychosisneamia

    psychosisneamia ~Beginner~

    Joined:
    Jun 7, 2012
    Messages:
    162
    Likes Received:
    7
    Best Answers:
    0
    @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>
     
  20. Znote

    Znote <?php echo $title; ?> Staff Member Global Moderator Premium User

    Joined:
    Feb 14, 2008
    Messages:
    6,361
    Likes Received:
    1,058
    Best Answers:
    148
    in LUA script change db.query with db.executeQuery
     

Share This Page

Loading...