Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <amxmodx>
- #include <amxmisc>
- #define PLUGIN "Report Plug-In"
- #define VERSION "1.0"
- #define AUTHOR "DarthMan"
- public plugin_init()
- {
- register_plugin(PLUGIN, VERSION, AUTHOR)
- register_clcmd("say", "handle_say")
- register_clcmd("say_team", "handle_say")
- new i_CvarInterval = register_cvar("report_msg_interval", "300")
- set_task( floatclamp( get_pcvar_float( i_CvarInterval ), 10.0, 1000.0 ), "task_interval", _, _, _, "b" )
- }
- public task_interval(id)
- {
- switch( random_num( 0, 1 ) )
- {
- case 0:
- {
- client_print(id,print_chat,"* To report a player simply type /report followed by the player name.")
- }
- case 1:
- {
- set_hudmessage(0, 255, 0, -1.0, 0.0, 2, 0.0, 8.0, 1.0, 1.0, -1)
- show_hudmessage(id, "To report a player simply type /report followed by the player name.")
- }
- }
- }
- public handle_say(id)
- {
- new sString[192], sCmd[10], sPlayerID[32], sReason[150];
- read_args(sString, charsmax(sString))
- remove_quotes(sString) // we remove these " " :)
- strtok(sString, sCmd, charsmax(sCmd), sString, charsmax(sString), ' ')
- strtok(sString, sPlayerID, charsmax(sPlayerID), sReason, charsmax(sReason), ' ')
- if ( !equal( sCmd, "/report" ) )
- return PLUGIN_CONTINUE;
- new Player = cmd_target(id, sPlayerID);
- new flags = get_user_flags(Player);
- if(is_user_connected(Player))
- {
- new ReportedName[32];
- get_user_name(Player, ReportedName, 31);
- new ReporterName[32];
- get_user_name(id, ReporterName, charsmax(ReporterName));
- static configdir_report[512], conffile_report[512];
- new file_report[512];
- new linetoadd=-1;
- get_user_name(id, ReporterName, 31);
- get_configsdir(configdir_report,511)
- format(conffile_report,511,"%s/reports.ini",configdir_report)
- //new buffer;
- //read_file(conffile_report, line, file_report, 127, buffer)
- format(file_report,511,"%s reported %s to admins. Reason: %s",ReporterName,ReportedName,sReason)
- if (( ReporterName[id] != ReportedName[id] ) && !(flags & ADMIN_IMMUNITY))
- {
- write_file(conffile_report,file_report,linetoadd)
- client_print(0,print_chat,"* %s reported %s to admins. Reason: %s",ReporterName,ReportedName,sReason)
- }
- else if (ReporterName[id] == ReportedName[id] )
- {
- client_print(id,print_chat,"* You can not report yourself.")
- }
- if (is_user_admin(Player) && (flags & ADMIN_IMMUNITY) && ReporterName[id] != ReportedName[id])
- {
- client_print(id,print_chat,"* You can't report an admin with immunity.")
- }
- }
- else
- {
- client_print(id,print_chat,"* Sorry, but no player with this name was found on the server.")
- }
- return PLUGIN_HANDLED;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement