20.03.2015, 05:24
Try this.
pawn Код:
CMD:setvip(playerid, params[])
{
if(IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, RCONERROR);
{
if(PlayerInfo[playerid][pVipLevel] == 1) { vrank = "Bronze V.I.P"; }
else if(PlayerInfo[playerid][pVipLevel] == 2) { vrank = "Silver V.I.P"; }
else if(PlayerInfo[playerid][pVipLevel] == 3) { vrank = "Gold V.I.P"; }
{
new victimname[MAX_PLAYER_NAME], vipname[MAX_PLAYER_NAME], notice[20],viplevel, giveplayerid, string[128];
if(sscanf(params, "ui", giveplayerid, viplevel)) return SendClientMessage(playerid, COLOR_DGRAY, "Syntax: /setvip [playerid] [level]");
if(giveplayerid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "ERROR: Player is not connected");
if(viplevel > 3 || viplevel < 0) return SendClientMessage(playerid, COLOR_RED, "ERROR: Valid levels: 1-3");
PlayerInfo[giveplayerid][pVipLevel] = viplevel;
if(PlayerInfo[giveplayerid][pVipLevel] > viplevel) { notice="Promoted"; }
else notice="Demoted"; }
GetPlayerName(giveplayerid, victimname, sizeof(victimname));
GetPlayerName(playerid, vipname, sizeof(vipname));
PlayerInfo[giveplayerid][pVipLevel] = viplevel;
GetPlayerName(giveplayerid, victimname, sizeof(victimname));
GetPlayerName(playerid, vipname, sizeof(vipname));
format(string,sizeof(string),"Administrator %s(%d) has %s you to VIP Status! [Level: %i]", vipname, playerid,notice, viplevel, giveplayerid);
SendClientMessage(playerid, COLOR_AQUA, string);
format(string, sizeof(string), ">> You set %s(%d) VIP level to '%i'", victimname, playerid, viplevel, giveplayerid);
SendClientMessage(playerid, COLOR_DGRAY, string);
}
}
return 1;
}