Raised This Month: $45 Target: $400
 11% 

[Request] Report system


Post New Thread Reply   
 
Thread Tools Display Modes
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 03-22-2015 , 10:15   Re: [Request] Report system
Reply With Quote #11

Quote:
Originally Posted by Frizzakis View Post
Hey, and thanks for replying. But as i said before i want a simple plugin exactly like Gizmo's but without Mysql.Also im not able to pay... :/
No one requested you to pay anything, just wait a bit. I think I will do that.

Edit: almost ready.
__________________

Last edited by HamletEagle; 03-22-2015 at 10:53.
HamletEagle is offline
Frizzakis
Junior Member
Join Date: Mar 2015
Old 03-22-2015 , 10:57   Re: [Request] Report system
Reply With Quote #12

Quote:
Originally Posted by HamletEagle View Post
No one requested you to pay anything, just wait a bit. I think I will do that.

Edit: almost ready.
Thanks for helping! Also when i translated the website, it was saying something about private - selling. xD thats why i said that i can't pay.
Frizzakis is offline
Frizzakis
Junior Member
Join Date: Mar 2015
Old 03-22-2015 , 16:17   Re: [Request] Report system
Reply With Quote #13

Hey, HamletEagle. Any progress man?
Frizzakis is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 03-22-2015 , 17:05   Re: [Request] Report system
Reply With Quote #14

Come on, you just wait 5 hours and bumped your thread while rules said to wait 14 days. I usually don't help peoples which are unable to wait. Do you think that developing a plugin takes two seconds or that I spend all of my free time making plugins?
__________________
HamletEagle is offline
Frizzakis
Junior Member
Join Date: Mar 2015
Old 03-22-2015 , 17:40   Re: [Request] Report system
Reply With Quote #15

Quote:
Originally Posted by HamletEagle View Post
Come on, you just wait 5 hours and bumped your thread while rules said to wait 14 days. I usually don't help peoples which are unable to wait. Do you think that developing a plugin takes two seconds or that I spend all of my free time making plugins?
Damn, sorry :/ I forgot about that rule. Plus i was just too excited when you edited your message saying: almost ready. My bad..Never gonna happen again.
Frizzakis is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 03-23-2015 , 14:34   Re: [Request] Report system
Reply With Quote #16

PHP Code:
/*
    Copyleft 2015 @ HamletEagle

    ReportsSystem is free software;
    you can redistribute it and/or modify it under the terms of the
    GNU General Public License as published by the Free Software Foundation.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with ReportsSystem; if not, write to the
    Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/

#include <amxmodx>
#include <amxmisc>

#define PluginName    "ReportsSystem"
#define PluginVersion "1.0"
#define PluginAuthor  "HamletEagle"

enum _:ReportData
{
    
ReporterName[32],
    
ReportedName[32],
    
Reason[128]
}

enum _:Mode
{
    
ModeReasons,
    
ModeReports
}

const 
AdminFlag ADMIN_BAN

new Array:ArrayReasons
new Array:ArrayReports

new ReportedPlayer[33]
new 
ConfigsDirPath[80]
new 
ConfigFilePath[128]

public 
plugin_init()
{
    
register_plugin
    

        .
plugin_name PluginName,
        .
version     PluginVersion,
        .
author      PluginAuthor
    
)
    
    
register_clcmd("say /report_player""ClientCommand_Report")
    
register_clcmd("say_team /report_player""ClientCommand_Report")
    
register_concmd("amx_showreports""ClientCommand_ShowReports"AdminFlag)
    
register_concmd("amx_solvereport""ClientCommand_SolveReport"AdminFlag)
    
register_concmd("amx_clearreports""ClientCommand_ClearReports"AdminFlag)
    
    
ArrayReasons ArrayCreate(128)
    
ArrayReports ArrayCreate(ReportData)
    
    
get_configsdir(ConfigsDirPathcharsmax(ConfigsDirPath))
    
ParseReasonsFile()
    
ParseReportsFile()
}

public 
plugin_end()
{
    
AddReportsToFile()
    
ArrayDestroy(ArrayReasons)
    
ArrayDestroy(ArrayReports)
}

ParseReasonsFile()
{
    new const 
ReasonsFile[] = "report_reasons.ini"
    
formatex(ConfigFilePathcharsmax(ConfigFilePath), "%s/%s"ConfigsDirPathReasonsFile)
    
ReadFile(ConfigFilePathModeReasons)
}

ParseReportsFile()
{
    new const 
ReportsFile[] = "reports_list.ini"
    
formatex(ConfigFilePathcharsmax(ConfigFilePath), "%s/%s"ConfigsDirPathReportsFile)
    
ReadFile(ConfigFilePathModeReports)
}

AddReportsToFile()
{
    if(
file_exists(ConfigFilePath))
    {
        
delete_file(ConfigFilePath)
    }
    
    
server_print("Path: %s"ConfigFilePath)
    new 
FilePointer fopen(ConfigFilePath"wt"), Data[ReportData]
    if(
FilePointer)
    {
        new 
Size ArraySize(ArrayReports)
        for(new 
iSizei++)
        {
            
ArrayGetArray(ArrayReportsiData)
            
server_print"Get: %s %s %s"Data[ReporterName], Data[ReportedName], Data[Reason])
            
fprintf(FilePointer"%s %s %s^n"Data[ReporterName], Data[ReportedName], Data[Reason])
        }
        
fclose(FilePointer)
    }
}

ReadFile(File[], Mod)
{
    new 
FilePointer fopen(File"rt")
    if(
FilePointer)
    {
        new 
FileData[128], Data[ReportData]
        while(!
feof(FilePointer))
        {
            
fgets(FilePointerFileDatacharsmax(FileData))
            
trim(FileData)
            
            if(!
FileData[0] || FileData[0] == ';' || FileData[0] == '#' || FileData[0] == '/')
            {
                continue
            }
            
server_print("Reading from file: %s"FileData)
            switch(
Mod)
            {
                case 
ModeReasons:
                {
                    
server_print("Pushing to array")
                    
ArrayPushString(ArrayReasonsFileData)
                }
                case 
ModeReports:
                {
                    
parse
                    
(
                        
FileData
                        
Data[ReporterName], charsmax(Data[ReporterName]), 
                        
Data[ReportedName], charsmax(Data[ReportedName]),
                        
Data[Reason      ], charsmax(Data[Reason      ])
                    )
                    
                    
ArrayPushArray(ArrayReportsData)
                }
            }
        }
    }    
}

public 
ClientCommand_Report(id)
{
    new 
ReportMenu menu_create("Report:""HandleReportMenu")

    new 
Players[32], PlayersNumindex
    get_players
(PlayersPlayersNum)

    new 
PlayerName[32], UserId[6]
    for(new 
i<= PlayersNumi++)
    {
        
index Players[i]
        
get_user_name(indexPlayerNamecharsmax(PlayerName))
        
num_to_str(get_user_userid(index), UserIdcharsmax(UserId))

        
menu_additem(ReportMenuPlayerNameUserId0)
    }

    
menu_display(idReportMenu0)
}

public 
ClientCommand_ShowReports(idlevelcid)
{
    if(!
cmd_access(idlevelcid0))
    {
        return 
1
    
}
    
    new 
Size ArraySize(ArrayReports), Data[ReportData]
    if(!
Size)
    {
        
console_print(id"There are no reports open")
    }
    else
    {
        for(new 
iSizei++)
        {
            
ArrayGetArray(ArrayReportsiData)
            
console_print(id"[ %i ]Reporter: %s^nReported: %s^nReason:%s",iData[ReporterName], Data[ReportedName], Data[Reason])
            
console_print(id"=========================================")
        }
        
console_print(id"Write amx_solvereport report_number to close it")
    }
    return 
1
}

public 
ClientCommand_SolveReport(idlevelcid)
{
    if(!
cmd_access(idlevelcid1))
    {
        return 
1
    
}
    
    new 
Argument[5], Data[ReportData], ArrayEntrySize ArraySize(ArrayReports)
    
read_argv(1Argumentcharsmax(Argument))
    
    
ArrayEntry str_to_num(Argument)
    if(
ArrayEntry >= Size || ArrayEntry 0)
    {
        
console_print(id"Report number is invalid. Valid range: 0 - %i"Size)
    }
    else
    {
        
ArrayGetArray(ArrayReportsArrayEntryData)
        
console_print(id"You closed the report with number %i"ArrayEntry)
        
client_print(0print_chat"%s reported %s for %s. Report is now closed"Data[ReporterName], Data[ReportedName], Data[Reason])
    
        
ArrayDeleteItem(ArrayReportsArrayEntry)
    }
    return 
1
}

public 
ClientCommand_ClearReports(idlevelcid)
{
    if(!
cmd_access(idlevelcid1))
    {
        return 
1
    
}
    
    
ArrayClear(ArrayReports)
    
console_print(id"You cleared all the reports")
    return 
1
}

public 
HandleReportMenu(idReportMenuitem)
{
    if(
item == MENU_EXIT)
    {
        
menu_destroy(ReportMenu)
        return 
    }

    new 
UserId[6], Name[32], AccessCallBack
    menu_item_getinfo
(ReportMenuitemAccessUserIdcharsmax(UserId), Namecharsmax(Name), CallBack)

    new 
IntUserId str_to_num(UserId)
    new 
Target find_player("k"IntUserId//get reported player index

    
if(Target)
    {
        
ReportedPlayer[id] = Target
        BuildReasonsMenu
(id)
    }
    else
    {
        
client_print(idprint_chat"Target could not be found %s"Name)
    }

    
menu_destroy(ReportMenu)
}

BuildReasonsMenu(id)
{
    new 
ReasonsMenu menu_create("Select a reason""HandleReasonsMenu")
    
    new 
Size ArraySize(ArrayReasons), HandleReason[128]
    for(new 
iSizei++)
    {
        
ArrayGetString(ArrayReasonsiHandleReasoncharsmax(HandleReason))
        
menu_additem(ReasonsMenuHandleReason""0)
    }
    
menu_display(idReasonsMenu0)
}

public 
HandleReasonsMenu(idReasonsMenuitem)
{
    if(
item == MENU_EXIT)
    {
        
menu_destroy(ReasonsMenu)
        return 
    }
    
    
//Get the reason for reporting
    
new HandleReason[128]
    
ArrayGetString(ArrayReasonsitemHandleReasoncharsmax(HandleReason))
    
    
AddReport(idReportedPlayer[id], HandleReason)
    
    
client_print(idprint_chat"Report was succesfully sent")
    
menu_destroy(ReasonsMenu)
}

AddReport(idTarget, const HandleReason[])
{
    new 
Data[ReportData]
    
get_user_name(idData[ReporterName], charsmax(Data[ReporterName]))
    
get_user_name(TargetData[ReportedName], charsmax(Data[ReportedName]))
    
copy(Data[Reason], charsmax(Data[Reason]), HandleReason)
    
ArrayPushArray(ArrayReportsData)
    
    new 
Players[32], Numindex
    get_players
(PlayersNum"c")
    for(new 
iNumi++)
    {
        
index Players[i]
        if(
get_user_flags(index) & AdminFlag)
        {
            
client_print(indexprint_center"A new report was send")
        }
    }

Tested and working, but no cvars yet.

Code:
say /report_player to open report menu
say_team /report_player to open report menu
amx_showreports show all reports
amx_solvereport report_number solve a report
amx_clearreports clear all reports
Create in addons/amxmodx/configs two file called:
Code:
reports_list.ini
report_reasons.ini
You may edit only report_reasons.ini and add the reasons for reporting. First file is for storing reports, don't touch it. Change const AdminFlag = ADMIN_BAN from source to modify commands admin acces.
__________________

Last edited by HamletEagle; 03-23-2015 at 14:36.
HamletEagle is offline
Frizzakis
Junior Member
Join Date: Mar 2015
Old 03-23-2015 , 15:40   Re: [Request] Report system
Reply With Quote #17

Wow HamletEagle. Thanks alot for your time in creating this man Everything works great! Except when i type /report_player, i can see the players but i can also see the name of the server as you can see here:
http://i.imgur.com/P45cusu.jpg . Because im using 1 server only, can you remove it please? Also i would really appriciate it if you could add color support something like this: ^4 so i can make the chat messages & the Pop up message about the new report with colors Once again, thanks for your time . Oh and by the way, when you are about to add cvars (whenever you want of course) i think my only request is how long the player needs to wait till he reports again Thats all.

Last edited by Frizzakis; 03-23-2015 at 16:30. Reason: Cvars
Frizzakis is offline
Lolz0r
Veteran Member
Join Date: Nov 2010
Location: Balgaria
Old 03-23-2015 , 18:59   Re: [Request] Report system
Reply With Quote #18

HamletEagle, love your job, I said it once.

Can you do and SQL version for other people ?
Lolz0r is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 03-24-2015 , 11:25   Re: [Request] Report system
Reply With Quote #19

Quote:
Originally Posted by Frizzakis View Post
Wow HamletEagle. Thanks alot for your time in creating this man Everything works great! Except when i type /report_player, i can see the players but i can also see the name of the server as you can see here:
http://i.imgur.com/P45cusu.jpg . Because im using 1 server only, can you remove it please? Also i would really appriciate it if you could add color support something like this: ^4 so i can make the chat messages & the Pop up message about the new report with colors Once again, thanks for your time . Oh and by the way, when you are about to add cvars (whenever you want of course) i think my only request is how long the player needs to wait till he reports again Thats all.
Ok, for the first one, it will get fixed soon. I'm sorry but I won't add colors, I hate doing that. Maybe someone else will edit and do so.

Quote:
Originally Posted by Lolz0r View Post
HamletEagle, love your job, I said it once.

Can you do and SQL version for other people ?
Thanks, unfortunately I don't know mysql.
__________________

Last edited by HamletEagle; 03-24-2015 at 13:52.
HamletEagle is offline
Lolz0r
Veteran Member
Join Date: Nov 2010
Location: Balgaria
Old 03-24-2015 , 12:58   Re: [Request] Report system
Reply With Quote #20

Okay HamletEagle, I understood.

Try this, with color :

PHP Code:
/*
    Copyleft 2015 @ HamletEagle

    ReportsSystem is free software;
    you can redistribute it and/or modify it under the terms of the
    GNU General Public License as published by the Free Software Foundation.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with ReportsSystem; if not, write to the
    Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/

#include <amxmodx>
#include <amxmisc>
#include <chatcolor>

#define PluginName    "Reports System"
#define PluginVersion "1.0"
#define PluginAuthor  "HamletEagle"

enum _:ReportData
{
    
ReporterName[32],
    
ReportedName[32],
    
Reason[128]
}

enum _:Mode
{
    
ModeReasons,
    
ModeReports
}

const 
AdminFlag ADMIN_BAN

new Array:ArrayReasons
new Array:ArrayReports

new ReportedPlayer[33]
new 
ConfigsDirPath[80]
new 
ConfigFilePath[128]

public 
plugin_init()
{
    
register_plugin
    

        .
plugin_name PluginName,
        .
version     PluginVersion,
        .
author      PluginAuthor
    
)
    
    
register_clcmd("say /report""ClientCommand_Report")
    
register_clcmd("say_team /report""ClientCommand_Report")
    
register_concmd("amx_showreports""ClientCommand_ShowReports"AdminFlag)
    
register_concmd("amx_solvereport""ClientCommand_SolveReport"AdminFlag)
    
register_concmd("amx_clearreports""ClientCommand_ClearReports"AdminFlag)
    
    
ArrayReasons ArrayCreate(128)
    
ArrayReports ArrayCreate(ReportData)
    
    
get_configsdir(ConfigsDirPathcharsmax(ConfigsDirPath))
    
ParseReasonsFile()
    
ParseReportsFile()
}

public 
plugin_end()
{
    
AddReportsToFile()
    
ArrayDestroy(ArrayReasons)
    
ArrayDestroy(ArrayReports)
}

ParseReasonsFile()
{
    new const 
ReasonsFile[] = "report_reasons.ini"
    
formatex(ConfigFilePathcharsmax(ConfigFilePath), "%s/%s"ConfigsDirPathReasonsFile)
    
ReadFile(ConfigFilePathModeReasons)
}

ParseReportsFile()
{
    new const 
ReportsFile[] = "reports_list.ini"
    
formatex(ConfigFilePathcharsmax(ConfigFilePath), "%s/%s"ConfigsDirPathReportsFile)
    
ReadFile(ConfigFilePathModeReports)
}

AddReportsToFile()
{
    if(
file_exists(ConfigFilePath))
    {
        
delete_file(ConfigFilePath)
    }
    
    
server_print("Path: %s"ConfigFilePath)
    new 
FilePointer fopen(ConfigFilePath"wt"), Data[ReportData]
    if(
FilePointer)
    {
        new 
Size ArraySize(ArrayReports)
        for(new 
iSizei++)
        {
            
ArrayGetArray(ArrayReportsiData)
            
server_print"Get: %s %s %s"Data[ReporterName], Data[ReportedName], Data[Reason])
            
fprintf(FilePointer"%s %s %s^n"Data[ReporterName], Data[ReportedName], Data[Reason])
        }
        
fclose(FilePointer)
    }
}

ReadFile(File[], Mod)
{
    new 
FilePointer fopen(File"rt")
    if(
FilePointer)
    {
        new 
FileData[128], Data[ReportData]
        while(!
feof(FilePointer))
        {
            
fgets(FilePointerFileDatacharsmax(FileData))
            
trim(FileData)
            
            if(!
FileData[0] || FileData[0] == ';' || FileData[0] == '#' || FileData[0] == '/')
            {
                continue
            }
           
server_print("Reading from file: %s"FileData)
            switch(
Mod)
            {
                case 
ModeReasons:
                {
                    
server_print("Pushing to array")
                    
ArrayPushString(ArrayReasonsFileData)
                }
                case 
ModeReports:
                {
                    
parse
                    
(
                        
FileData
                        
Data[ReporterName], charsmax(Data[ReporterName]), 
                        
Data[ReportedName], charsmax(Data[ReportedName]),
                        
Data[Reason      ], charsmax(Data[Reason      ])
                    )
                    
                    
ArrayPushArray(ArrayReportsData)
                }
            }
        }
    }    
}

public 
ClientCommand_Report(id)
{
    new 
ReportMenu menu_create("Report:""HandleReportMenu")

    new 
Players[32], PlayersNumindex
    get_players
(PlayersPlayersNum)

    new 
PlayerName[32], UserId[6]
    for(new 
i<= PlayersNumi++)
    {
        
index Players[i]
        
get_user_name(indexPlayerNamecharsmax(PlayerName))
        
num_to_str(get_user_userid(index), UserIdcharsmax(UserId))

        
menu_additem(ReportMenuPlayerNameUserId0)
    }

    
menu_display(idReportMenu0)
}

public 
ClientCommand_ShowReports(idlevelcid)
{
    if(!
cmd_access(idlevelcid0))
    {
        return 
1
    
}
    
    new 
Size ArraySize(ArrayReports), Data[ReportData]
    if(!
Size)
    {
        
console_print(id"There are no reports open")
    }
    else
    {
        for(new 
iSizei++)
        {
            
ArrayGetArray(ArrayReportsiData)
            
console_print(id"[ %i ]Reporter: %s^nReported: %s^nReason:%s",iData[ReporterName], Data[ReportedName], Data[Reason])
            
console_print(id"=========================================")
        }
        
console_print(id"Write amx_solvereport report_number to close it")
    }
    return 
1
}

public 
ClientCommand_SolveReport(idlevelcid)
{
    if(!
cmd_access(idlevelcid1))
    {
        return 
1
    
}
    
    new 
Argument[5], Data[ReportData], ArrayEntrySize ArraySize(ArrayReports)
    
read_argv(1Argumentcharsmax(Argument))
    
    
ArrayEntry str_to_num(Argument)
    if(
ArrayEntry >= Size || ArrayEntry 0)
    {
        
console_print(id"Report number is invalid. Valid range: 0 - %i"Size)
    }
    else
    {
        
ArrayGetArray(ArrayReportsArrayEntryData)
        
console_print(id"You closed the report with number %i"ArrayEntry)
        
client_print_color(00"^4[Darknezz-zone] ^3%s ^1reported ^3%s ^1for ^3%s. ^1Report is now closed."Data[ReporterName], Data[ReportedName], Data[Reason])
    
        
ArrayDeleteItem(ArrayReportsArrayEntry)
    }
    return 
1
}

public 
ClientCommand_ClearReports(idlevelcid)
{
    if(!
cmd_access(idlevelcid1))
    {
        return 
1
    
}
    
    
ArrayClear(ArrayReports)
    
console_print(id"You cleared all the reports")
    return 
1
}

public 
HandleReportMenu(idReportMenuitem)
{
    if(
item == MENU_EXIT)
    {
        
menu_destroy(ReportMenu)
        return 
    }

    new 
UserId[6], Name[32], AccessCallBack
    menu_item_getinfo
(ReportMenuitemAccessUserIdcharsmax(UserId), Namecharsmax(Name), CallBack)

    new 
IntUserId str_to_num(UserId)
    new 
Target find_player("k"IntUserId//get reported player index

    
if(Target)
    {
        
ReportedPlayer[id] = Target
        BuildReasonsMenu
(id)
    }
    else
    {
        
client_print_color(idid"^4[Darknezz-zone] ^1Target could not be found ^3%s."Name)
    }

    
menu_destroy(ReportMenu)
}

BuildReasonsMenu(id)
{
    new 
ReasonsMenu menu_create("Select a reason""HandleReasonsMenu")
    
    new 
Size ArraySize(ArrayReasons), HandleReason[128]
    for(new 
iSizei++)
    {
        
ArrayGetString(ArrayReasonsiHandleReasoncharsmax(HandleReason))
        
menu_additem(ReasonsMenuHandleReason""0)
    }
    
menu_display(idReasonsMenu0)
}

public 
HandleReasonsMenu(idReasonsMenuitem)
{
    if(
item == MENU_EXIT)
    {
        
menu_destroy(ReasonsMenu)
        return 
    }
    
    
//Get the reason for reporting
    
new HandleReason[128]
    
ArrayGetString(ArrayReasonsitemHandleReasoncharsmax(HandleReason))
    
    
AddReport(idReportedPlayer[id], HandleReason)
    
    
client_print_color(idid"^4[Darknezz-zone] ^1Report was succesfully sent.")
    
menu_destroy(ReasonsMenu)
}

AddReport(idTarget, const HandleReason[])
{
    new 
Data[ReportData]
    
get_user_name(idData[ReporterName], charsmax(Data[ReporterName]))
    
get_user_name(TargetData[ReportedName], charsmax(Data[ReportedName]))
    
copy(Data[Reason], charsmax(Data[Reason]), HandleReason)
    
ArrayPushArray(ArrayReportsData)
    
    new 
Players[32], Numindex
    get_players
(PlayersNum"c")
    for(new 
iNumi++)
    {
        
index Players[i]
        if(
get_user_flags(index) & AdminFlag)
        {
            
client_print_color(indexindex"^4[Darknezz-zone] ^1A new report was send.")
        }
    }

I use only this for color chat messages :
https://forums.alliedmods.net/showthread.php?t=94960

just install the plugin.

Last edited by Lolz0r; 03-24-2015 at 12:59.
Lolz0r is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 15:07.


Powered by vBulletin®
Copyright ©2000 - 2022, vBulletin Solutions, Inc.
Theme made by Freecode