 |
|
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
|

06-02-2019
, 09:45
Re: What is better way of printing this?
|
#6
|
Quote:
Originally Posted by OciXCrom
Your code is limited to only 2 arrays of vips. With 32 VIPs online, it won't print all of them.
PHP Code:
public print_online_vips(id)
{
static const iMax = 4
new szVips[160], iPlayers[MAX_PLAYERS], iPnum, iCount, iCountAll, i
get_players(iPlayers, iPnum, "ch")
@new_string:
szVips = "^4VIPs Online: ^3"
for(new iPlayer; i < iPnum; i++)
{
iPlayer = iPlayers[i]
if(get_user_flags(iPlayer) & VIP_LEVEL)
{
iCountAll++
if(iCount++ < iMax)
{
add(szVips, charsmax(szVips), fmt("%n", iPlayer))
if(i < iPnum - 1)
{
add(szVips, charsmax(szVips), "^4, ^3")
}
}
else
{
iCount = 0
client_print_color(id, id, szVips)
goto @new_string
}
}
}
if(iCountAll)
{
client_print_color(id, id, szVips)
}
else
{
client_print_color(id, id, "^4%l", "NO_VIP_ONLINE")
}
return PLUGIN_HANDLED
}
iMax is the maximum number of players that will get printed on each line.
|
goto and jumping backwards
__________________
|
|
|
|