Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // PAWN BATTLE REKORDO SISTEMA BIČAS VS SANCIO
- #include <a_samp>
- #include <a_mysql>
- #include <foreach>
- #define kiek_lt 1000
- #define kiek_xp 100
- new
- rekordas,
- data[ 31 ]
- ;
- public OnGameModeInit( )
- {
- LoadRecord( );
- return true;
- }
- public OnPlayerConnect( )
- {
- new
- masyvas[40];
- ;
- format( masyvas, sizeof( masyvas ), "Serverio rekordas - %d, pasiektas %s", rekordas, data );
- SendClientMessage( playerid, -1, masyvas );
- if( rekordas < GetOnlinePlayers( ) )
- {
- rekordas = GetOnlinePlayers( );
- data = GetDate( );
- SaveRecord( );
- foreach(new i : Player)
- {
- GivePlayerMoney( i, kiek_lt );
- SetPlayerScore( i, GetPlayerScore( i )+kiek_xp );
- }
- format( masyvas, sizeof( masyvas ), "Naujas rekordas - %d, visi gavo %dLT ir %dXP", rekordas, kiek_lt, kiek_xp );
- SendClientMessage( playerid, -1, masyvas );
- }
- return true;
- }
- LoadRecord( )
- {
- new
- query[ 128 ],
- fetch[ 16 ]
- ;
- format( query, sizeof( query ), "SELECT Rekordas, Kada FROM Rekordai" )
- mysql_query( query );
- mysql_store_result( );
- mysql_retrieve_row( );
- mysql_fetch_field_row( fetch, "Rekordas" ); rekordas = strval( fetch) ;
- mysql_fetch_field_row( data, "Kada" );
- mysql_free_result( );
- }
- SaveRecord( )
- {
- new
- query[ 128 ]
- ;
- format( query, sizeof( query ), "UPDATE Rekordas SET Rekordas = %d, Kada = %d", rekordas, data );
- mysql_query( query );
- }
- GetOnlinePlayers( )
- {
- new pOnline;
- for( new i = 0; i < MAX_PLAYERS; i ++ )
- {
- if( IsPlayerConnected( i ) ) pOnline++;
- }
- return pOnline;
- }
- GetDate( )
- {
- new
- masyvas[ 31 ],
- data[ 6 ]
- ;
- getdate( data[ 0 ], data[ 1 ], data[ 2 ] );
- gettime( data[ 3 ], data[ 4 ], data[ 5 ] );
- format( masyvas, 31, "%d-%02d-%02d %02d:%02d", data[ 0 ], data[ 1 ], data[ 2 ], data[ 3 ], data[ 4 ] );
- return masyvas;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement