Advertisement
DarthMan

Untitled

Mar 19th, 2017
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.62 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <amxmisc>
  3.  
  4. #define PLUGIN "Report Plug-In"
  5. #define VERSION "1.0"
  6. #define AUTHOR "DarthMan"
  7.  
  8. public plugin_init()
  9. {
  10.     register_plugin(PLUGIN, VERSION, AUTHOR)    
  11.    
  12.     register_clcmd("say", "handle_say")
  13.     register_clcmd("say_team", "handle_say")
  14.    
  15.     new i_CvarInterval = register_cvar("report_msg_interval", "300")
  16.  
  17.     set_task( floatclamp( get_pcvar_float( i_CvarInterval ), 10.0, 1000.0 ), "task_interval", _, _, _, "b" )
  18. }
  19.  
  20. public task_interval(id)
  21. {
  22.     switch( random_num( 0, 1 ) )
  23.     {
  24.         case 0:
  25.         {
  26.             client_print(id,print_chat,"* To report a player simply type /report followed by the player name.")
  27.         }
  28.         case 1:
  29.         {
  30.             set_hudmessage(0, 255, 0, -1.0, 0.0, 2, 0.0, 8.0, 1.0, 1.0, -1)
  31.             show_hudmessage(id, "To report a player simply type /report followed by the player name.")
  32.         }
  33.     }
  34. }
  35.  
  36. public handle_say(id)
  37. {
  38.     new sString[192], sCmd[10], sPlayerID[32], sReason[150];
  39.     read_args(sString, charsmax(sString))
  40.     remove_quotes(sString) // we remove these " " :)
  41.    
  42.     strtok(sString, sCmd, charsmax(sCmd), sString, charsmax(sString), ' ')
  43.     strtok(sString, sPlayerID, charsmax(sPlayerID), sReason, charsmax(sReason), ' ')
  44.  
  45.     if ( !equal( sCmd, "/report" ) )
  46.         return PLUGIN_CONTINUE;
  47.  
  48.     new Player = cmd_target(id, sPlayerID);
  49.     new flags = get_user_flags(Player);
  50.    
  51.     if(is_user_connected(Player))
  52.     {
  53.         new ReportedName[32];
  54.         get_user_name(Player, ReportedName, 31);
  55.        
  56.         new ReporterName[32];
  57.         get_user_name(id, ReporterName, charsmax(ReporterName));
  58.        
  59.         static configdir_report[512], conffile_report[512];
  60.         new file_report[512];
  61.        
  62.         new linetoadd=-1;
  63.        
  64.         get_user_name(id, ReporterName, 31);
  65.         get_configsdir(configdir_report,511)
  66.        
  67.         format(conffile_report,511,"%s/reports.ini",configdir_report)  
  68.         //new buffer;
  69.         //read_file(conffile_report, line, file_report, 127, buffer)
  70.         format(file_report,511,"%s reported %s to admins. Reason: %s",ReporterName,ReportedName,sReason)
  71.        
  72.         if (( ReporterName[id] != ReportedName[id] ) && !(flags & ADMIN_IMMUNITY))
  73.         {
  74.             write_file(conffile_report,file_report,linetoadd)  
  75.             client_print(0,print_chat,"* %s reported %s to admins. Reason: %s",ReporterName,ReportedName,sReason)
  76.         }
  77.         else if  (ReporterName[id] == ReportedName[id] )
  78.         {
  79.             client_print(id,print_chat,"* You can not report yourself.")
  80.         }
  81.         if (is_user_admin(Player) && (flags & ADMIN_IMMUNITY) && ReporterName[id] != ReportedName[id])
  82.         {
  83.             client_print(id,print_chat,"* You can't report an admin with immunity.")       
  84.         }
  85.     }  
  86.     else   
  87.     {
  88.         client_print(id,print_chat,"* Sorry, but no player with this name was found on the server.")
  89.     }
  90.     return PLUGIN_HANDLED;
  91. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement