#3

Quote:
Originally Posted by Meller
Посмотреть сообщение
PHP код:
CMD:vips(playeridparams[])
{
    new 
string[128], acount 0Name[MAX_PLAYER_NAME];
    foreach(
Playeri) {
        if(
IsPlayerVipMember(i)) {
            
acount++;
        }
    }
    if(
acount 0) {
        
SendClientMessage(playeridCOLOR_GREEN"----------Online VIP's----------");
        foreach(
Playeri) {
            if(
IsPlayerVipMember(i)) {
                
GetPlayerName(iNamesizeof(Name));
                
format(stringsizeof string"VIP: %s"Name);
                
SendClientMessage(playeridCOLOR_GREENstring);
            }
        }
        
format(stringsizeof string"Total VIP's online: %d."acount);
        
SendClientMessage(playerid, -1string);
    }
    else if(
acount 1SendClientMessage(playerid0xD8D8D8FF"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!
Reply


Messages In This Thread
Help - by SeifGeny - 04.07.2017, 18:54
Re: Help - by Meller - 04.07.2017, 19:19
Re: Help - by SpaceX - 04.07.2017, 20:03
Re: Help - by SeifGeny - 04.07.2017, 20:20

Forum Jump:


Users browsing this thread: 1 Guest(s)