Quote:
Originally Posted by Meller
PHP код:
CMD:vips(playerid, params[])
{
new string[128], acount = 0, Name[MAX_PLAYER_NAME];
foreach(Player, i) {
if(IsPlayerVipMember(i)) {
acount++;
}
}
if(acount > 0) {
SendClientMessage(playerid, COLOR_GREEN, "----------Online VIP's----------");
foreach(Player, i) {
if(IsPlayerVipMember(i)) {
GetPlayerName(i, Name, sizeof(Name));
format(string, sizeof string, "VIP: %s", Name);
SendClientMessage(playerid, COLOR_GREEN, string);
}
}
format(string, sizeof string, "Total VIP's online: %d.", acount);
SendClientMessage(playerid, -1, string);
}
else if(acount < 1) SendClientMessage(playerid, 0xD8D8D8FF, "There are no VIP's online!");
return 1;
}
You were checking if the player who typed /vips is a vip, you checked this GetPlayerPoolSize() (x) amount of times.
|
If you failed to understand what he meant to say,
You used the "playerid" passed from the /vips command into the loop.
Therefore, you were checking the current person who typed /vips is a vip.
For eg: If I'm vip and I used the command, it would take my player id and the IsPlayerVipMember() check would be true.
This will make your acount = 1 and it will only show you as the vip in /vips.
Did you understand?
Please try and understand the code!