so this script currently uses sq and it isnt working and i dont no anything about that type of saving id prefer to use y_ini to save, ive tried myself but i got a bunch of indexing errors and more when i following ******'s and smits tutorials. how can i convert this so when i assign a VIP level to a player it saves on disconnect. so when they log back in a i dont have to re-assign it. id like it saved in a folder VIP/%.ini
PHP код:
CMD:vsetvip( 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: {FFFF00}/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!" );
if ( level == 0 )
{
P_DATA[ giveplayerid ][ Vip ] = level;
format( Query, sizeof( Query ), "DELETE FROM `Vips` WHERE `Nume` = '%s'" , PlayerName2( giveplayerid ) );
db_free_result( db_query( Database, Query ) );
format( string, sizeof( string ), "Administrator %s has deleted you V.I.P account!", PlayerName2( playerid ) );
return SendClientMessage( giveplayerid, ABLUE, string );
}
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( giveplayerid, ABLUE, string );
format( Query, sizeof( Query ), "INSERT INTO `Vips` VALUES('%s','%d','%d')", PlayerName2( giveplayerid ), level, -1 );
db_free_result( db_query( Database, Query ) );
} else {
P_DATA[ giveplayerid ][ Vip ] = level;
format( string, sizeof( string ), "Administrator %s has set update your V.I.P level to %d!", PlayerName2( playerid ), level );
SendClientMessage( giveplayerid, ABLUE, string );
format( Query, sizeof( Query ), "UPDATE `Vips` SET `VipLevel` = '%d' WHERE `Nume` = '%s'", level, PlayerName2( giveplayerid ) );
db_free_result( db_query( Database, Query ) );
}
return 1;
}
You are mistaken. That script is using SQLite, not MySQL.
It really isn't worth changing unless you (for some odd reason) need to use a strictly file-based system.
Just read up on using SQLite on the SA:MP Wikipedia and you'll find that it's mostly pretty simple.