08.07.2011, 13:57
pawn Код:
public OnPlayerConnect( playerid )
{
new Query2[ 256 ];
new DBResult:RRezult;
format( Query2, sizeof( Query2 ), "SELECT 'Reputation' FROM `REPUTATION` WHERE `Name` = '%s'", CName( playerid ) );
RRezult = db_query( Database, Query2 );
if( db_num_rows( RRezult ) )
{
new Field[ 30 ];
new Reputation;
db_get_field_assoc( RRezult, #Reputation, Field, 30 );
Reputation = strval( Field );
RK_REP[ playerid ][ RK_REPUTATION ] = Reputation;
}
db_free_result( RRezult );
}
public OnPlayerDisconnect( playerid )
{
format( Query, sizeof( Query ), "UPDATE `REPUTATION` (`Name`, `Reputation`) VALUES('%s', '%d')", CName( playerid ), RK_REP[ playerid ][ RK_REPUTATION ] );
db_free_result( db_query( Database, Query ) );
}