Help with '/vips' command -
D1am0nd - 21.12.2015
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(playerid, params[])
{
new vipstring[2000];
if(IsPlayerConnected(playerid))
{
for (new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(pInfo[i][pVipLevel] > 0)
{
format(vipstring, sizeof(vipstring),"{ffffff}%s%s (ID:%d)\n", vipstring, PlayerName(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!
Re: Help with '/vips' command -
jlalt - 21.12.2015
Never mind lol
Re: Help with '/vips' command -
Sh4d0w2 - 21.12.2015
PHP код:
CMD:vips(playerid, params[])
{
new vipstring[2000],count=0;
if(IsPlayerConnected(playerid))
{
for (new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(pInfo[i][pVipLevel] > 0)
{
format(vipstring, sizeof(vipstring),"{ffffff}%s%s (ID:%d)\n", vipstring, PlayerName(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;
}
Re: Help with '/vips' command -
Skimmer - 21.12.2015
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.
Re: Help with '/vips' command -
D1am0nd - 21.12.2015
@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