10.07.2011, 23:13
Try this :
pawn Код:
CMD:setvip( playerid, params[ ] ) {
if( !IsPlayerAdmin( playerid ) )
return SendClientMessage( playerid, -1, "You need to be a RCON admin to use this. " ); // You need to be RCON to set someone's VIP
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( vip > 2 || vip < 0 )
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 );
//new name[MAX_PLAYER_NAME]; // I've add it
GetPlayerName(playerid, pName, sizeof(pName)); // I've add it
format(file, sizeof(file), "RicAdmin/users/%s.ini", pName); // I've add it
// Added a Debug
if ( fexist( file ) ) {
print( "It works!" ); // See your samp-server.exe, and it should print "It works!"
dini_IntSet(file, "VIP", vip); // I've changed it
}
return SendClientMessage( playerid, -1, str );
}