Raised This Month: $ Target: $400
 0% 

Online Vips


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 01-12-2020 , 07:49   Re: Online Vips
Reply With Quote #4

I'm currently using this code which i kinda stole from another plugin. The problem is that it doesn't show the vips correctly. For players without the VIP flag, it will always show "No vips online", while people who have the VIP flag will always get a message that outputs all the player names in the server. Any idea how i can fix this?

PHP Code:
public VipsOnline(id) {
    new 
bool:IsFirst trueszMessage[256], iLenTempID;
    
    for(
TempID 0TempID <= get_maxplayers(); TempID++)
    {
        if( !
is_user_connected(TempID) || !(get_user_flags(id) & VIP_LEVEL) )
        {
            continue;
        }
        
        if( !
IsFirst )
        {
            
szMessage[iLen++] = ' ';
            
szMessage[iLen++] = '|';
            
szMessage[iLen++] = ' ';
        }
        
        
szMessage[iLen++] = '^x04';
        
szMessage[iLen] = EOS;
        
        
iLen += get_user_name(TempIDszMessage[iLen], charsmax(szMessage) - iLen);
        
        
szMessage[iLen++] = '^x01';
        
szMessage[iLen] = EOS;
        
        
IsFirst false;
    }
    
    if( 
IsFirst )
    {

        
ColorChat(idGREEN"There are no vips online.");
        return 
PLUGIN_HANDLED;
    }
    else
    {
        
ColorChat(idTEAM_COLOR"Online Vips: %s"szMessage);
        return 
PLUGIN_HANDLED;        
    }
    
    return 
PLUGIN_CONTINUE

EDIT: I might've found the reason for this isue, i was using "id" instead of "TempID" on this line
PHP Code:
if( !is_user_connected(TempID) || !(get_user_flags(id) & VIP_LEVEL) ) 
__________________

Last edited by Napoleon_be; 01-12-2020 at 07:52.
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
 



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 02:40.


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