11.07.2011, 21:29
Quote:
Hi, I have another problem.. I've find an VIP script on this forum, and I've add to it savedata, it's work perfectly when I use a fonction who verify the dini VIP = 2 but no when I want to write in the player's ini.
But, If I do the command, /setvip 'myid' 2, it's work perfectly! In my stat, I've VIP=2, but if I try to make a friend VIP, with the same command, the VIP lign in the .ini of my friend stay to VIP=0. Here the code, I've tryed so many solutions, but I don't know where is my error, I think it's at the end, in the write part.. pawn Код:
|
PHP код:
CMD:setvip( playerid, params[ ] )
{
if( !IsPlayerAdmin( playerid ) ) return SendClientMessage( playerid, -1, "You need to be a RCON admin to use this. " );
new id, vip;
if( sscanf( params, "ud", id, vip ) ) return SendClientMessage( playerid, -1, "USAGE: /setvip [ID] [1 for silver, 2 for gold, 0 if you want to remove VIP]." );
if( !IsPlayerConnected( id ) || id == INVALID_PLAYER_ID ) return SendClientMessage( playerid, -1, "Invalid player ID (player not connected). " );
if(0 > vip > 2) return SendClientMessage( playerid, -1, "The VIP rank must be between 0 and 2. " );
SetPVarInt( id, "VIP", vip );
new str[ 128 ], pName[ 24 ], aName[ 24 ], vipstr[ 8 ];
if( vip == 0 ) { vipstr = "none"; }
if( vip == 1 ) { vipstr = "silver"; }
if( vip == 2 ) { vipstr = "gold"; }
GetPlayerName( id, pName, 24 );
GetPlayerName( playerid, aName, 24 );
format( str, sizeof str, "RCON administrator %s has set your donor rank to %s.", aName, vipstr );
SendClientMessage( id, -1, str );
format( str, sizeof str, "You have set %s's donor rank to %s.", pName, vipstr );
SendClientMessage( playerid, -1, str );
format( str, sizeof(str), "/RicAdmin/users/%s.ini", pName);
PlayerInfo[id][VIP] = vip;
if(!fexist(str)) { dini_Create(str); }
dini_IntSet(str, "VIP", PlayerInfo[id][VIP]);
return 1;
}