[HELP]: /Vips command.
#1

Hello.
I've just made a /vips command, wich will show online vips.
But there's a bug/issue, I can't find.
Everytime I do command: /vips, if there's 0 online players I doesn't receive ERROR message, and it shows me as Special VIP, level 3, even if i'm not vip.

pawn Код:
CMD:vips(playerid, params[])
{
    new vips[50], name[MAX_PLAYER_NAME], count;
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(VipInfo[i][Vip] >= 1)
            {
                count++;
                if(count == 0) return SendClientMessage(playerid, -1, "{FF0000}EROARE: {FFFFFF}Nu este online niciun {15FF00}VIP.");
                GetPlayerName(i, name, sizeof(name));
                format(vips, sizeof(vips), "{FF9900}[%s]: {FF0000}%s {15FF00}(%d)\n", GetPlayerVip(i), name, VipInfo[i][Vip]);
                ShowPlayerDialog(playerid, DIALOG_VIP, DIALOG_STYLE_MSGBOX, "{FFFFFF}Vipi online:", vips, "Iesi", "");
            }
        }
    }
    return 1;
}
If there's can be a problem with my GetPlayerVip command, then here you go:

pawn Код:
stock GetPlayerVip(playerid)
{
    new vrank[40];
    switch(VipInfo[playerid][Vip])
    {
        case 3: vrank = "Special VIP";
        case 2: vrank = "Gold VIP";
        case 1: vrank = "Silver VIP";
        default: vrank = "NONE";
    }
    return vrank;
}
Cheers,
+Rep for helper!
Reply
#2

Try
maybe as luck since I am not on my comp
case 0: vrank = "NONE";
Reply
#3

The error message is not existent, that's why it doesn't show. At the end of the command, between the "for" statement and the "return 1" check if "count" equals 0. If it does, send an error message to playerid. The VIP error occurs due to your VipInfo array not being loaded properly, because GetVip function is fine.
Reply
#4

Thanks @HazardouS.
Reply
#5

This may not be related to your issue
But the ShowPlayerDialog line is supposed to be outside the for loop.
Reply
#6

Quote:
Originally Posted by DavidBilla
Посмотреть сообщение
This may not be related to your issue
But the ShowPlayerDialog line is supposed to be outside the for loop.
@DavidBilla, thanks, but already solved my problem greetings @HazardouS.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)