I suggest you to use sscanf:
pawn Код:
dcmd_givevip(playerid, params[])
{
if(PlayerInfo[playerid][Level] < 5) return SendClientMessage(playerid, red, "You're not allowed to use this command!");
new
id,
string[128];
if(sscanf(params, "u", id)) return SendClientMessage(playerid, red, "USAGE: /givevip [playerid]");
else if(!IsPlayerConnected(id)) return SendClientMessage(playerid, red, "That player is not connected to the server!");
// else if(GetPlayerRank(params) == 1) return SendClientMessage(playerid, red, "That player is a V.I.P already!");
else
{
new
pName[MAX_PLAYER_NAME];
SetPlayerRank(id, 1);
GetPlayerName(id, pName, sizeof(pName));
format(string, sizeof(string), "You've made %s a V.I.P!", pName);
SendClientMessage(playerid, blue, string);
format(string, sizeof(string), "You're now a V.I.P!");
SendClientMessage(id, red, string);
}
return 1;
}
Or:
pawn Код:
dcmd_givevip(playerid, params[])
{
if(PlayerInfo[playerid][Level] < 5) return SendClientMessage(playerid, red, "You're not allowed to use this command!");
new
string[128];
else if(strlen(params) < 1) return SendClientMessage(playerid, red, "USAGE: /givevip [playerid]");
else if(!IsPlayerConnected(params)) return SendClientMessage(playerid, red, "That player is not connected to the server!");
// else if(GetPlayerRank(id) == 1) return SendClientMessage(playerid, red, "That player is a V.I.P already!");
else
{
new
pName[MAX_PLAYER_NAME];
SetPlayerRank(params, 1);
GetPlayerName(params, pName, sizeof(pName));
format(string, sizeof(string), "You've made %s a V.I.P!", pName);
SendClientMessage(playerid, blue, string);
format(string, sizeof(string), "You're now a V.I.P!");
SendClientMessage(params, red, string);
}
return 1;
}