Raised This Month: $32 Target: $400
 8% 

[Request] Report system


Post New Thread Reply   
 
Thread Tools Display Modes
Frizzakis
Junior Member
Join Date: Mar 2015
Old 03-24-2015 , 12:17   Re: [Request] Report system
Reply With Quote #21

Quote:
Originally Posted by HamletEagle View Post
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 edit and do so.
Thanks! and no problem xD

Lolz0r Thats really helpful man! Thank you for helping
Frizzakis is offline
Frizzakis
Junior Member
Join Date: Mar 2015
Old 04-07-2015 , 06:00   Re: [Request] Report system
Reply With Quote #22

Hey HamletEagle ,
14 days passed and I think you forgot to fix the plugin. I would really appreciate it if you would be able to do it & add the following features too:

Add a cvar something like: amx_nextreport (time in minutes on how long the player should wait to report again).
You can't report yourself or players with flag "A".
If the server closes-restarts, the reports clear automatically.
If the reporter or reported player leaves the server, the report is automatically removed from the list.

I hope this is possible for you since I really like your work and the fact you are helping me Take your time and I will wait. Thanks
Frizzakis is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 04-07-2015 , 12:52   Re: [Request] Report system
Reply With Quote #23

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]

new 
CvarReportLimit
new Float:FullReportTime[33]
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)
    
    
CvarReportLimit register_cvar("amx_nextreport""10")
    
    
ArrayReasons ArrayCreate(128)
    
ArrayReports ArrayCreate(ReportData)

    
get_configsdir(ConfigsDirPathcharsmax(ConfigsDirPath))
    
ParseReasonsFile()
    
ParseReportsFile()
}

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

public 
client_disconnect(id)
{
    new 
Size ArraySize(ArrayReports), Data[ReportData]
    for(new 
iSizei++)
    {
        
ArrayGetArray(ArrayReportsiData)
        if
        ( 
            
id == get_user_index(Data[ReporterName]) ||
            
id == get_user_index(Data[ReportedName])
        )
        {
            
ArrayDeleteItem(ArrayReportsi)
        }
    }
}

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)
    }

    new 
FilePointer fopen(ConfigFilePath"wt"), Data[ReportData]
    if(
FilePointer)
    {
        new 
Size ArraySize(ArrayReports)
        for(new 
iSizei++)
        {
            
ArrayGetArray(ArrayReportsiData)
            
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 
Float:GameTime get_gametime()
    if(
GameTime FullReportTime[id])
    {
        new 
ReportMenu menu_create("Report:""HandleReportMenu")

        new 
Players[32], PlayersNumindex
        get_players
(PlayersPlayersNum)

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

            
menu_additem(ReportMenuPlayerNameUserId0)
        }

        
menu_display(idReportMenu0)
        
FullReportTime[id] = GameTime + (float(get_pcvar_num(CvarReportLimit)) * 60.0)
    }
    else
    {
        
client_print(idprint_chat"You must wait: %.1f in order to report again"FullReportTime[id] - GameTime)
    }
}

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")
        }
    }

1 and 3 done. 2 is not possible(you can't know when server crashed). Please remind me, what should be fixed ?
__________________
HamletEagle is offline
Fuck For Fun
Veteran Member
Join Date: Nov 2013
Old 04-07-2015 , 21:36   Re: [Request] Report system
Reply With Quote #24

Quote:
Originally Posted by HamletEagle View Post
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]

new 
CvarReportLimit
new Float:FullReportTime[33]
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)
    
    
CvarReportLimit register_cvar("amx_nextreport""10")
    
    
ArrayReasons ArrayCreate(128)
    
ArrayReports ArrayCreate(ReportData)

    
get_configsdir(ConfigsDirPathcharsmax(ConfigsDirPath))
    
ParseReasonsFile()
    
ParseReportsFile()
}

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

public 
client_disconnect(id)
{
    new 
Size ArraySize(ArrayReports), Data[ReportData]
    for(new 
iSizei++)
    {
        
ArrayGetArray(ArrayReportsiData)
        if
        ( 
            
id == get_user_index(Data[ReporterName]) ||
            
id == get_user_index(Data[ReportedName])
        )
        {
            
ArrayDeleteItem(ArrayReportsi)
        }
    }
}

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)
    }

    new 
FilePointer fopen(ConfigFilePath"wt"), Data[ReportData]
    if(
FilePointer)
    {
        new 
Size ArraySize(ArrayReports)
        for(new 
iSizei++)
        {
            
ArrayGetArray(ArrayReportsiData)
            
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 
Float:GameTime get_gametime()
    if(
GameTime FullReportTime[id])
    {
        new 
ReportMenu menu_create("Report:""HandleReportMenu")

        new 
Players[32], PlayersNumindex
        get_players
(PlayersPlayersNum)

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

            
menu_additem(ReportMenuPlayerNameUserId0)
        }

        
menu_display(idReportMenu0)
        
FullReportTime[id] = GameTime + (float(get_pcvar_num(CvarReportLimit)) * 60.0)
    }
    else
    {
        
client_print(idprint_chat"You must wait: %.1f in order to report again"FullReportTime[id] - GameTime)
    }
}

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")
        }
    }

1 and 3 done. 2 is not possible(you can't know when server crashed). Please remind me, what should be fixed ?
I checked the code

little bugs:
- hostname server show in menu /report_player
- i think there no getting nothing in reports_list.ini
- add every 5-10 mins can open /report_player or if player can't open in same round
Fuck For Fun is offline
Send a message via Skype™ to Fuck For Fun
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 04-08-2015 , 04:55   Re: [Request] Report system
Reply With Quote #25

1. Ah, that was the bug.
2. No, reports list is read well.
3. Not sure to understand. You have a cvar to control next report time.

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] new CvarReportLimit new Float:FullReportTime[33] 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)     CvarReportLimit = register_cvar("amx_nextreport", "10")     ArrayReasons = ArrayCreate(128)     ArrayReports = ArrayCreate(ReportData)     get_configsdir(ConfigsDirPath, charsmax(ConfigsDirPath))     ParseReasonsFile()     ParseReportsFile() } public plugin_end() {     AddReportsToFile()     ArrayDestroy(ArrayReasons)     ArrayDestroy(ArrayReports) } /* public client_disconnect(id) {     new Size = ArraySize(ArrayReports), Data[ReportData]     for(new i; i < Size; i++)     {         ArrayGetArray(ArrayReports, i, Data)         if         (             id == get_user_index(Data[ReporterName]) ||             id == get_user_index(Data[ReportedName])         )         {             ArrayDeleteItem(ArrayReports, i)         }     } } */ ParseReasonsFile() {     new const ReasonsFile[] = "report_reasons.ini"     formatex(ConfigFilePath, charsmax(ConfigFilePath), "%s/%s", ConfigsDirPath, ReasonsFile)     ReadFile(ConfigFilePath, ModeReasons) } ParseReportsFile() {     new const ReportsFile[] = "reports_list.ini"     formatex(ConfigFilePath, charsmax(ConfigFilePath), "%s/%s", ConfigsDirPath, ReportsFile)     ReadFile(ConfigFilePath, ModeReports) } AddReportsToFile() {     if(file_exists(ConfigFilePath))     {         delete_file(ConfigFilePath)     }     new FilePointer = fopen(ConfigFilePath, "wt"), Data[ReportData]     if(FilePointer)     {         new Size = ArraySize(ArrayReports)         for(new i; i < Size; i++)         {             ArrayGetArray(ArrayReports, i, Data)             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(FilePointer, FileData, charsmax(FileData))             trim(FileData)                         if(!FileData[0] || FileData[0] == ';' || FileData[0] == '#' || FileData[0] == '/')             {                 continue             }             switch(Mod)             {                 case ModeReasons:                 {                     ArrayPushString(ArrayReasons, FileData)                 }                 case ModeReports:                 {                     parse                     (                         FileData,                         Data[ReporterName], charsmax(Data[ReporterName]),                         Data[ReportedName], charsmax(Data[ReportedName]),                         Data[Reason      ], charsmax(Data[Reason      ])                     )                                         ArrayPushArray(ArrayReports, Data)                 }             }         }     }    } public ClientCommand_Report(id) {     new Float:GameTime = get_gametime()     if(GameTime > FullReportTime[id])     {         new ReportMenu = menu_create("Report:", "HandleReportMenu")         new Players[32], PlayersNum, index         get_players(Players, PlayersNum)         new PlayerName[32], UserId[6]                 for(new i ; i < PlayersNum; i++)         {             index = Players[i]             get_user_name(index, PlayerName, charsmax(PlayerName))             num_to_str(get_user_userid(index), UserId, charsmax(UserId))             menu_additem(ReportMenu, PlayerName, UserId, 0)         }         menu_display(id, ReportMenu, 0)         FullReportTime[id] = GameTime + (float(get_pcvar_num(CvarReportLimit)) * 60.0)     }     else     {         client_print(id, print_chat, "You must wait: %.1f in order to report again", FullReportTime[id] - GameTime)     } } public ClientCommand_ShowReports(id, level, cid) {     if(!cmd_access(id, level, cid, 0))     {         return 1     }     new Size = ArraySize(ArrayReports), Data[ReportData]     if(!Size)     {         console_print(id, "There are no reports open")     }     else     {         for(new i; i < Size; i++)         {             ArrayGetArray(ArrayReports, i, Data)             console_print(id, "[ %i ]Reporter: %s^nReported: %s^nReason:%s",i, Data[ReporterName], Data[ReportedName], Data[Reason])             console_print(id, "=========================================")         }         console_print(id, "Write amx_solvereport report_number to close it")     }     return 1 } public ClientCommand_SolveReport(id, level, cid) {     if(!cmd_access(id, level, cid, 1))     {         return 1     }     new Argument[5], Data[ReportData], ArrayEntry, Size = ArraySize(ArrayReports)     read_argv(1, Argument, charsmax(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(ArrayReports, ArrayEntry, Data)         console_print(id, "You closed the report with number %i", ArrayEntry)         client_print(0, print_chat, "%s reported %s for %s. Report is now closed", Data[ReporterName], Data[ReportedName], Data[Reason])         ArrayDeleteItem(ArrayReports, ArrayEntry)     }     return 1 } public ClientCommand_ClearReports(id, level, cid) {     if(!cmd_access(id, level, cid, 1))     {         return 1     }     ArrayClear(ArrayReports)     console_print(id, "You cleared all the reports")     return 1 } public HandleReportMenu(id, ReportMenu, item) {     if(item == MENU_EXIT)     {         menu_destroy(ReportMenu)         return     }     new UserId[6], Name[32], Access, CallBack     menu_item_getinfo(ReportMenu, item, Access, UserId, charsmax(UserId), Name, charsmax(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(id, print_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 i; i < Size; i++)     {         ArrayGetString(ArrayReasons, i, HandleReason, charsmax(HandleReason))         menu_additem(ReasonsMenu, HandleReason, "", 0)     }     menu_display(id, ReasonsMenu, 0) } public HandleReasonsMenu(id, ReasonsMenu, item) {     if(item == MENU_EXIT)     {         menu_destroy(ReasonsMenu)         return     }     //Get the reason for reporting     new HandleReason[128]     ArrayGetString(ArrayReasons, item, HandleReason, charsmax(HandleReason))     AddReport(id, ReportedPlayer[id], HandleReason)     client_print(id, print_chat, "Report was succesfully sent")     menu_destroy(ReasonsMenu) } AddReport(id, Target, const HandleReason[]) {     new Data[ReportData]     get_user_name(id, Data[ReporterName], charsmax(Data[ReporterName]))     get_user_name(Target, Data[ReportedName], charsmax(Data[ReportedName]))     copy(Data[Reason], charsmax(Data[Reason]), HandleReason)     ArrayPushArray(ArrayReports, Data)     new Players[32], Num, index     get_players(Players, Num, "c")     for(new i; i < Num; i++)     {         index = Players[i]         if(get_user_flags(index) & AdminFlag)         {             client_print(index, print_center, "A new report was send")         }     } }
Solved.
__________________

Last edited by HamletEagle; 11-22-2017 at 15:36.
HamletEagle is offline
Frizzakis
Junior Member
Join Date: Mar 2015
Old 04-08-2015 , 07:35   Re: [Request] Report system
Reply With Quote #26

Great job, HamletEagle!
Thanks a lot for making this I don't think we need any more features with high priority so, lets leave it like this Also, thank you Fuck For Fun too for making it easier for him with the situation
Frizzakis is offline
ZEDD_Intensity
Senior Member
Join Date: Jun 2016
Old 11-20-2017 , 16:25   Re: [Request] Report system
Reply With Quote #27

Quote:
Originally Posted by HamletEagle View Post
1. Ah, that was the bug.
2. No, reports list is read well.
3. Not sure to understand. You have a cvar to control next report time.

Solved.

Greetings,


I'm sorry if I misunderstood anything, but I'm getting a "Server has disabled this option" while trying saying /report. Is there any other dependencies this plugin has? As I couldn't find a cvar for turning the plugin ON or OFF, I thought it'd be the best to post here.

Thanks,
ZEDD
ZEDD_Intensity is offline
indraraj striker
Veteran Member
Join Date: Mar 2014
Location: Under the water
Old 11-21-2017 , 02:04   Re: [Request] Report system
Reply With Quote #28

Quote:
Originally Posted by ZEDD_Intensity View Post
Greetings,


I'm sorry if I misunderstood anything, but I'm getting a "Server has disabled this option" while trying saying /report. Is there any other dependencies this plugin has? As I couldn't find a cvar for turning the plugin ON or OFF, I thought it'd be the best to post here.

Thanks,
ZEDD
Put this plugin top of your plugin.ini
or
put this plugin above statsx.amxx in plugin.ini
indraraj striker is offline
TheWhitesmith
Senior Member
Join Date: Oct 2017
Location: Morocco :c
Old 11-22-2017 , 14:18   Re: [Request] Report system
Reply With Quote #29

Quote:
Originally Posted by ZEDD_Intensity View Post
Greetings,


I'm sorry if I misunderstood anything, but I'm getting a "Server has disabled this option" while trying saying /report. Is there any other dependencies this plugin has? As I couldn't find a cvar for turning the plugin ON or OFF, I thought it'd be the best to post here.

Thanks,
ZEDD
The actual command is not /report, but /report_player
TheWhitesmith is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 11-22-2017 , 15:37   Re: [Request] Report system
Reply With Quote #30

Quote:
Originally Posted by ZEDD_Intensity View Post
Greetings,


I'm sorry if I misunderstood anything, but I'm getting a "Server has disabled this option" while trying saying /report. Is there any other dependencies this plugin has? As I couldn't find a cvar for turning the plugin ON or OFF, I thought it'd be the best to post here.

Thanks,
ZEDD
It's /report_player. You should also recompile the plugin, because I noticed a potential bug and I've changed something.
__________________

Last edited by HamletEagle; 11-22-2017 at 15:37.
HamletEagle 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 08:31.


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