Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Top of your script
- #define MAX_REPORTS 1000
- #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)
- //Commands
- CMD:report( playerid, params[] )
- {
- new
- ReportReason[ 128 ],
- string[ 128 ],
- p_Name[ MAX_PLAYER_NAME ];
- if( sscanf( params, "s[128]", ReportReason) )
- return SendClientMessage( playerid, c_LIME, "< USAGE > /report "#WHITE"< Report Text (Try to summarize the problem) >" );
- if( strlen( ReportReason ) > 64 )
- return SendClientMessage( playerid, c_DARKRED, "< ERROR > R"#WHITE"eport text is too long!" );
- GetPlayerName( playerid, p_Name, sizeof( p_Name ) );
- #if defined ENABLE_LOGGING
- format( string, sizeof( string ), "Logs/Reports/Report%d.ini", FindNextReportID( ) );
- new
- INI:rFile = INI_Open( string );
- INI_SetTag( rFile, "Report" );
- INI_WriteString( rFile, "Reporter", p_Name );
- format( string, sizeof( string ), "%s", ReportReason );
- INI_WriteString( rFile, "Report Text", string );
- INI_Close( rFile );
- #endif
- format( string, sizeof( string ), ""#ORANGE"[REPORT] %s: "#WHITE"%s", p_Name, ReportReason );
- SendClientMessageToAdmins( c_ORANGE, string );
- return true;
- }
- //Stocks
- stock FindNextReportID( )
- {
- new repStr[ 32 ],
- rID;
- for( new r; r < MAX_REPORTS; r ++ )
- {
- format( repStr, sizeof( repStr ), "Logs/Reports/Report%d.ini", r );
- if( !fexist( repStr ) ) {
- return rID = r;
- }
- }
- return rID;
- }
- stock SendClientMessageToAdmins( colour, message[128] )
- {
- for( new u; u < MAX_PLAYERS; u ++ )
- {
- if(IsPlayerAdmin( u ) )
- {
- SendClientMessage( u, colour, message );
- }
- }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement