Advertisement
2ky

aaron

2ky
Mar 13th, 2012
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1. //Top of your script
  2.  
  3. #define MAX_REPORTS 1000
  4.  
  5. #define ENABLE_LOGGING //Delete or comment this out if you don't want logging. (Make sure you create the folder "Logs/Reports" in your scriptfiles)
  6.  
  7. //Commands
  8.  
  9. CMD:report( playerid, params[] )
  10. {
  11. new
  12. ReportReason[ 128 ],
  13. string[ 128 ],
  14. p_Name[ MAX_PLAYER_NAME ];
  15.  
  16. if( sscanf( params, "s[128]", ReportReason) )
  17. return SendClientMessage( playerid, c_LIME, "< USAGE > /report "#WHITE"< Report Text (Try to summarize the problem) >" );
  18.  
  19. if( strlen( ReportReason ) > 64 )
  20. return SendClientMessage( playerid, c_DARKRED, "< ERROR > R"#WHITE"eport text is too long!" );
  21.  
  22. GetPlayerName( playerid, p_Name, sizeof( p_Name ) );
  23.  
  24. #if defined ENABLE_LOGGING
  25.  
  26. format( string, sizeof( string ), "Logs/Reports/Report%d.ini", FindNextReportID( ) );
  27. new
  28. INI:rFile = INI_Open( string );
  29.  
  30. INI_SetTag( rFile, "Report" );
  31.  
  32. INI_WriteString( rFile, "Reporter", p_Name );
  33.  
  34. format( string, sizeof( string ), "%s", ReportReason );
  35. INI_WriteString( rFile, "Report Text", string );
  36.  
  37. INI_Close( rFile );
  38.  
  39. #endif
  40.  
  41. format( string, sizeof( string ), ""#ORANGE"[REPORT] %s: "#WHITE"%s", p_Name, ReportReason );
  42. SendClientMessageToAdmins( c_ORANGE, string );
  43. return true;
  44. }
  45.  
  46. //Stocks
  47.  
  48. stock FindNextReportID( )
  49. {
  50. new repStr[ 32 ],
  51. rID;
  52.  
  53. for( new r; r < MAX_REPORTS; r ++ )
  54. {
  55. format( repStr, sizeof( repStr ), "Logs/Reports/Report%d.ini", r );
  56.  
  57. if( !fexist( repStr ) ) {
  58. return rID = r;
  59. }
  60. }
  61. return rID;
  62. }
  63.  
  64. stock SendClientMessageToAdmins( colour, message[128] )
  65. {
  66. for( new u; u < MAX_PLAYERS; u ++ )
  67. {
  68. if(IsPlayerAdmin( u ) )
  69. {
  70. SendClientMessage( u, colour, message );
  71. }
  72. }
  73. return true;
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement