Help with '/vips' command
#1

Hello.

So basically, when I am VIP and type the command "/vips", to see the online vips, I see myself there, but if I am not VIP and type the command again, it does not show the message, that there is no VIP's online.


Here is the code:

PHP код:
CMD:vips(playeridparams[])
{
        new 
vipstring[2000];
        if(
IsPlayerConnected(playerid))
        {
            for (new 
0MAX_PLAYERSi++)
            {
                if(
IsPlayerConnected(i))
                {
                    if(
pInfo[i][pVipLevel] > 0)
                    {
                        
format(vipstringsizeof(vipstring),"{ffffff}%s%s (ID:%d)\n"vipstringPlayerName(i), playerid);
                    }
                }
            }
            
ShowPlayerDialog(playerid,DIALOG_VIPS,DIALOG_STYLE_MSGBOX,"{B266FF}Online VIPs:",vipstring,"Close","");
        }
         else return 
SendClientMessage(playerid,-1,""chat" There are no VIP's online.");
           return 
1;

Please help me to fix this, thank you!
Reply
#2

Never mind lol
Reply
#3

PHP код:
CMD:vips(playeridparams[])
{
        new 
vipstring[2000],count=0;
        if(
IsPlayerConnected(playerid))
        {
            for (new 
0MAX_PLAYERSi++)
            {
                if(
IsPlayerConnected(i))
                {
                    if(
pInfo[i][pVipLevel] > 0)
                    {
                        
format(vipstringsizeof(vipstring),"{ffffff}%s%s (ID:%d)\n"vipstringPlayerName(i), playerid);
                        
count++;
                    }
                }
            }
            
ShowPlayerDialog(playerid,DIALOG_VIPS,DIALOG_STYLE_MSGBOX,"{B266FF}Online VIPs:",vipstring,"Close","");
        }
         if(
count == 0) return SendClientMessage(playerid,-1,""chat" There are no VIP's online.");
           return 
1;

Reply
#4

The code from Sh4d0w2 will work. Let me explain you, why it didn't work.

You checked first is the player who's typing this command online. If not it will return that there's no VIP online.

That means, you should count how many VIP's are online, then check if the variable is 0.
If it's true, then there is not any VIP online, so you can send your message.
Reply
#5

@Sh4d0w2, Thanks it worked! +REP

@jlalt, Your code did not worked, but thanks for trying to help, so +REP for you aswell.

@Skimmer, Thanks for your helpfull information! +REP
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)