SA-MP Forums Archive
[HELP]: /Vips command. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [HELP]: /Vips command. (/showthread.php?tid=563833)



[HELP]: /Vips command. - HY - 17.02.2015

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!


Re: [HELP]: /Vips command. - ZombieNest - 17.02.2015

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


Re: [HELP]: /Vips command. - HazardouS - 17.02.2015

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.


Re: [HELP]: /Vips command. - HY - 17.02.2015

Thanks @HazardouS.


Re: [HELP]: /Vips command. - DavidBilla - 17.02.2015

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


Re: [HELP]: /Vips command. - HY - 17.02.2015

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.