Advertisement
RenaldasJ

Rekordo sistema by Renas.

Feb 5th, 2014
466
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.04 KB | None | 0 0
  1. enum _srInfo
  2. {
  3.  
  4.     zRekordas
  5.    
  6. };
  7. new srInfo [ _srInfo ] ;
  8.  
  9. public OnPlayerConnect ( playerid )
  10. {
  11.     new
  12.         str [ 80 ]  
  13.     ;
  14.     mysql_query ( "SELECT Rekordas FROM serverionust" ) ;
  15.     mysql_store_result ( ) ;
  16.     mysql_retrieve_row ( ) ;
  17.    
  18.     srInfo [ zRekordas ] = mysql_fetch_int ( ) ;
  19.  
  20.     if( GetPlayersOnline ( ) > srInfo [ zRekordas ] )
  21.     {
  22.         format ( str , 80 , "Pasiektas naujas rekordas: %i žaidėjai (ų)",srInfo [ zRekordas ] ) ;
  23.         SendClientMessageToAll ( -1,str ) ;
  24.         srInfo [ zRekordas ] = GetPlayersOnline ( ) ;
  25.         UpdateRecord();
  26.     }
  27.     mysql_free_result ( ) ;
  28.            
  29.     return 1;
  30.  
  31. }
  32. stock UpdateRecord ( )
  33. {
  34.     new
  35.         Query [ 80 ]
  36.     ;
  37.     format ( Query, sizeof(Query), "UPDATE `serverionust` Rekordas = '%i'",srInfo [ zRekordas ] ) ;
  38.     mysql_query ( Query ) ;
  39.  
  40.     printf("[ SAVED RECORD ]: %i ",srInfo [ zRekordas ] ) ;
  41. }
  42. stock GetOnlinePlayers ( )
  43. {
  44.     new pOnline;
  45.     for ( new i = 0; i < MAX_PLAYERS; i ++ )
  46.     {
  47.         if(IsPlayerConnected( i ) )
  48.                 pOnline++;
  49.         printf("[ PLAYERS ONLINE ]: %i",pOnline ) ;
  50.     }
  51.     return pOnline;
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement