Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #if defined ROAREC_V1_0_
- ================================================================================
- RoaRec v1.0 by Roach
- ================================================================================
- - Credits to Zh3r0 from some Examples( in The Eclipse ).
- - Credits to Y_Less for y_ini and foreach.
- - Credits to Zh3r0 for FormatMSG and FormatMSGToAll Function( Define ).
- - Credits to Zh3r0 for my Identitation.
- - Credits to stuntman from some ideeas and councils.
- - Thanks to Ryder_RO for helping and for the RoaRec( Record System ) Ideea.
- ================================================================================
- #endif
- //==============================================================================//
- // Includes //
- //==============================================================================//
- #include < a_samp > // Credits to the SA:MP - Developement Team
- #include <YSI\y_ini> // Credits to Y_Less
- #include < foreach > // Credits to Y_Less
- //==============================================================================//
- // RoaRec Timer Time //
- //==============================================================================//
- #define rTime 5000 // you can Modify this( in Miliseconds )
- //==============================================================================//
- // RoaRec Target //
- //==============================================================================//
- #define rRecTarget "rRecord.sav"
- //==============================================================================//
- // Repleaced/Shorcuts //
- //==============================================================================//
- #define Public:%0(%1) forward %0( %1 ); public %0( %1 )
- #define FormatMSG(%0,%1,%2,%3)\
- do\
- {\
- format( _S_T_R_, 10000, (%2), %3 );\
- SendClientMessage((%0),(%1), _S_T_R_);\
- }\
- while ( False )
- //------------------------------------------------------------------------------//
- new
- H[ 1 + 1 ], /*Hours + Minutes*/
- _S_T_R_[ 1000 ], /*Universal String*/
- rPlayers, /*Online Players*/
- rNRec[ MAX_PLAYER_NAME ], /*Name of the Player*/
- rARec, /*Amount of Players( Record )*/
- rDRec[ 3 ], /*Date of the Record*/
- rHRec[ 2 ] /*Hour of the Record*/
- ;
- new rMounth[ 12 ][ ] =
- {
- "January",
- "February",
- "March",
- "April",
- "May",
- "June",
- "July",
- "August",
- "September",
- "October",
- "November",
- "December"
- };
- stock
- bool:False = false /*Bool for FormatMSG*/
- ;
- public OnFilterScriptInit( )
- {
- rPlayers = OnlinePlayers( );
- INI_ParseFile(rRecTarget, "pRecord"); // ParseFile
- gettime( H[ 0 ], H[ 1 ] );
- print( "\n==========================================" );
- print( "|| -> RoaRec v1.0 By Roach Loaded ||" );
- print( "========================================== " );
- printf( "|| %02d:%02d || ", H[ 0 ], H[ 1 ] );
- print( "==================\n" );
- return ( 1 );
- }
- public OnFilterScriptExit( )
- {
- gettime( H[ 0 ], H[ 1 ] );
- print( "\n==========================================" );
- print( "|| -> RoaRec v1.0 By Roach UnLoaded ||" );
- print( "========================================== " );
- printf( "|| %02d:%02d || ", H[ 0 ], H[ 1 ] );
- print( "==================\n" );
- return ( 1 );
- }
- public OnPlayerConnect( playerid )
- {
- INI_ParseFile(rRecTarget, "pRecord"); // ParseFile
- SetTimerEx( "rRecord", rTime, false, "d", playerid );
- return ( 1 );
- }
- public OnPlayerDisconnect( playerid, reason )
- {
- rPlayers --;
- return( 1 );
- }
- //------------------------------------------------------------------------------//
- //==============================================================================
- // Usage: OnlinePlayers( );
- // Function: Use to see how many players are on the Server.
- //==============================================================================
- OnlinePlayers( )
- {
- new rConn;
- foreach(Player, i) rConn++;
- return ( rConn );
- }
- //==============================================================================
- // Usage: ---
- // Function: To check if is a new record or the Old.
- //==============================================================================
- Public:rRecord( playerid )
- {
- rPlayers ++;
- if( rARec ) FormatMSG( playerid, -1, "• Record for Online Players: {97FA17}%d{FFFFFF}, fixed {97FA17}%d %s %d{FFFFFF}, at {97FA17}%d:%d{FFFFFF} by {97FA17}%s{FFFFFF}.", rARec, rDRec[ 0 ], rMounth[ rDRec[ 1 ] - 1 ], rDRec[ 2 ], rHRec[ 0 ], rHRec[ 1 ], rNRec );
- if( rARec < rPlayers )
- {
- new Date[ 5 ];
- getdate( Date[ 0 ], Date[ 1 ], Date[ 2 ] );
- gettime( Date[ 3 ], Date[ 4 ] );
- format( rNRec, sizeof rNRec, "%s", pName( playerid ) );
- rARec = OnlinePlayers( );
- foreach(Player, i) FormatMSG( i, -1, "• New record for Online Players: {97FA17}%d{FFFFFF}, fixed on {97FA17}%d %s %d{FFFFFF}, at {97FA17}%d:%d{FFFFFF} by {97FA17}%s{FFFFFF}.", OnlinePlayers( ), Date[ 2 ], rMounth[ Date[ 1 ] - 1 ], Date[ 0 ], Date[ 3 ], Date[ 4 ], pName( playerid ) );
- rSaveRec( );
- }
- }
- //==============================================================================
- // Usage: ---
- // Function: To save the Data( Y_INI ).
- //==============================================================================
- Public:pRecord( name[ ], value[ ] )
- {
- if( !strcmp ( name, "rName" ) )
- {
- format( rNRec, sizeof rNRec, "%s", value );
- }
- if( !strcmp ( name, "rNumber" ) )
- {
- rARec = strval( value );
- }
- if( !strcmp ( name, "rDay" ) )
- {
- rDRec[ 0 ] = strval( value );
- }
- if( !strcmp ( name, "rMonth" ) )
- {
- rDRec[ 1 ] = strval( value );
- }
- if( !strcmp ( name, "rYear" ) )
- {
- rDRec[ 2 ] = strval( value );
- }
- if( !strcmp ( name, "rHour" ) )
- {
- rHRec[ 0 ] = strval( value );
- }
- if( !strcmp ( name, "rMins" ) )
- {
- rHRec[ 1 ] = strval( value );
- }
- }
- //==============================================================================
- // Usage: rSaveRec( );
- // Function: To write( with Y_INI ) in the rRecord.sav file.
- //==============================================================================
- rSaveRec( )
- {
- gettime( rHRec[ 0 ], rHRec[ 1 ] );
- getdate( rDRec[ 2 ], rDRec[ 1 ], rDRec[ 0 ] );
- new INI:rRec = INI_Open( rRecTarget );
- INI_WriteString( rRec, "rName", rNRec );
- INI_WriteInt( rRec, "rNumber", OnlinePlayers( ) );
- INI_WriteInt( rRec, "rDay", rDRec[ 0 ] );
- INI_WriteInt( rRec, "rMonth", rDRec[ 1 ] );
- INI_WriteInt( rRec, "rYear", rDRec[ 2 ] );
- INI_WriteInt( rRec, "rHour", rHRec[ 0 ] );
- INI_WriteInt( rRec, "rMins", rHRec[ 1 ] );
- INI_Close( rRec );
- }
- //==============================================================================
- // Usage: pName( playerid );
- // Function: Used to get the name of a player.
- //==============================================================================
- pName( p )
- {
- new NAME[ MAX_PLAYER_NAME ];
- GetPlayerName( p, NAME, MAX_PLAYER_NAME );
- return ( NAME );
- }
- //==============================================================================
- // Usage: rDate( )
- // Function: Used to get the Record Date.
- //==============================================================================
- stock rDate( Sec = false )
- {
- new zStr[ 30 ];
- if ( Sec )
- {
- new Date[ 6 ];
- getdate( Date[ 0 ], Date[ 1 ], Date[ 2 ] );
- gettime( Date[ 3 ], Date[ 4 ], Date[ 5 ] );
- format( zStr, 30, "{97FA17}%d %s %d{FFFFFF}, at {97FA17}%d:%d:%d{FFFFFF}", Date[ 2 ], Date[ 1 ], Date[ 0 ], Date[ 3 ], Date[ 4 ], Date[ 5 ] );
- }
- else
- {
- new Date[ 5 ];
- getdate( Date[ 0 ], Date[ 1 ], Date[ 2 ] );
- gettime( Date[ 3 ], Date[ 4 ] );
- format( zStr, 30, "{97FA17}%d %s %d{FFFFFF}, at {97FA17}%d:%d{FFFFFF}", Date[ 2 ], rMounth[ Date[ 1 ] - 1 ], Date[ 0 ], Date[ 3 ], Date[ 4 ] );
- }
- return ( zStr );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement