Raised This Month: $ Target: $400
 0% 

What is better way of printing this?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 06-02-2019 , 09:45   Re: What is better way of printing this?
Reply With Quote #6

Quote:
Originally Posted by OciXCrom View Post
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], iPnumiCountiCountAlli
    get_players
(iPlayersiPnum"ch")

    @
new_string:
    
szVips "^4VIPs Online: ^3"

    
for(new iPlayeriPnumi++)
    {
        
iPlayer iPlayers[i]

        if(
get_user_flags(iPlayer) & VIP_LEVEL)
        {
            
iCountAll++

            if(
iCount++ < iMax)
            {
                
add(szVipscharsmax(szVips), fmt("%n"iPlayer))

                if(
iPnum 1)
                {
                    
add(szVipscharsmax(szVips), "^4, ^3")
                }
            }
            else
            {
                
iCount 0
                client_print_color
(ididszVips)
                goto @
new_string
            
}
        }
    }

    if(
iCountAll)
    {
        
client_print_color(ididszVips)
    }
    else
    {
        
client_print_color(idid"^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
__________________
HamletEagle is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 17:18.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode