V.I.P with SQL help...
#1

Hi, all!

i make this command:
pawn Код:
CMD:setvip( playerid, params[ ] )
{
    new giveplayerid, level;
    new string[ 128 ], Query[ 256 ], DBResult:Resultat;
   
    if ( !IsPlayerAdmin( playerid ) ) return SendClientMessage( playerid, RED, "Only RCON Administrator can use this command!" );
    if ( sscanf( params, "ud", giveplayerid, level ) ) return SendClientMessage( playerid, RED, "USAGE: /setvip [ playerid ] [ level ]" );
    if ( giveplayerid == INVALID_PLAYER_ID ) return SendClientMessage( playerid, RED, "Player Is Not Connected!" );
    if ( level > 3 ) return SendClientMessage( playerid, RED, "Maximum V.I.P level is 3!" );
   
    format( Query, sizeof( Query ), "SELECT * FROM `Vips` WHERE `Nume` = '%s'", PlayerName2( playerid ) );
    Resultat = db_query( Database, Query );
    if ( db_num_rows( Resultat ) )
    {
        P_DATA[ giveplayerid ][ Vip ] = level;
        format( string, sizeof( string ), "Administrator %s has set your V.I.P level to %d!", PlayerName2( playerid ), level );
        SendClientMessage( playerid, ABLUE, string );
        format( Query, sizeof( Query ), "INSERT INTO `Vips` ( `Nume`,`VipLevel` ) VALUES('%s','%d')", PlayerName2( playerid ), level );
        db_free_result( db_query( Database, Query ) );
    }
    else
    {
        format( Query, sizeof( Query ), "UPDATE `Vips` SET ( `VipLevel` = '%d' ) WHERE `Nume` = '%s'", level, PlayerName2( giveplayerid ) );
        db_free_result( db_query( Database, Query ) );
        format( string, sizeof( string ), "Administrator %s has update your V.I.P level to %d", PlayerName2( playerid ), level );
        SendClientMessage( playerid, ABLUE, string );
    }
    return 1;
}
if i have name in the db it not to update my V.I.P level why? it only insert new row with my name and new V.I.P level wat's the problem?
Reply
#2

BUMP...anyone?
Reply
#3

Remove ( )
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)