Raised This Month: $ Target: $400
 0% 

VIPs doesn't appear in MotD


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Unkolix
Veteran Member
Join Date: Sep 2012
Old 04-29-2013 , 16:26   VIPs doesn't appear in MotD
Reply With Quote #1

The problem is that the code shows only me (maybe because others get free vip form 20:00)... I would like to see them in the motd too.
PHP Code:
new Array:g_Array;
/*Plugin Init*/
register_clcmd("say /vips","print_adminlist"
g_Array         ArrayCreate(64,32);
/***/
public client_authorized(id)
{
    if(
get_user_flags(id) & VIP_FLAG)
    {
        new 
g_Name[64];
        
get_user_name(id,g_Name,charsmax(g_Name));
            
        new 
g_Size ArraySize(g_Array);
        new 
szName[64];
            
        for(new 
0g_Sizei++)
        {
            
ArrayGetString(g_ArrayiszNamecharsmax(szName));
            
            if(
equal(g_NameszName))
            {
                return 
0;
            }
        }    
        
ArrayPushString(g_Array,g_Name);
    }
    return 
PLUGIN_CONTINUE
}

public 
client_disconnect(id)
{
    if(
get_user_flags(id) & VIP_FLAG)
    {
        new 
Name[64];
        
get_user_name(id,Name,charsmax(Name));
        
        new 
g_Size ArraySize(g_Array);
        new 
g_Name[64];
    
        for(new 
0g_Sizei++)
        {
            
ArrayGetString(g_Arrayig_Namecharsmax(g_Name));
            
            if(
equal(g_Name,Name))
            {
                
ArrayDeleteItem(g_Array,i);
                break;
            }
        }
    }
}
public 
client_infochanged(id)
{
    if(
get_user_flags(id) & VIP_FLAG)
    {
        new 
szName[64];
        
get_user_info(id,"name",szName,charsmax(szName));
        
        new 
Name[64];
        
get_user_name(id,Name,charsmax(Name));
        
        if(!
equal(szName,Name))
        {
            
ArrayPushString(g_Array,szName);
            
            new 
g_Size=ArraySize(g_Array);
            new 
g_Name[64];
            for(new 
0g_Sizei++)
            {
                
ArrayGetString(g_Arrayig_Namecharsmax(g_Name));
                
                if(
equal(g_Name,Name))
                {
                    
ArrayDeleteItem(g_Array,i);
                    break;
                }
            }
        }
    }
}
/*On Command*/
public print_adminlist(user
{
    new 
contact[112];
    
get_cvar_string("vip_contactinfo"contact63)
    new 
price[112];
    
get_cvar_string("vip_price"price63)
    new 
Data[g_Buffer], Leng_Name[64];
    
    
Len formatex(Data[Len], g_Buffer Len"<html><center><font color=yellow>%L <font color=green>%s.<font color=yellow> %L <font color=green>%s</font><body bgcolor=Black>"user"CONTACT"contactuser"MOTD_LINE_15"price);
    
Len += formatex(Data[Len], g_Buffer Len"<br><table border=1 width=300 cellspacing=0 bordercolor=#4A4344 style=color:#56A5EC;text-align:center;>");
    
Len += formatex(Data[Len], g_BufferLen"<tr><td><b>#</b></td><td><b>%L</b></td></tr>"user"VIPS_ONLINE");
    
    new 
g_Size ArraySize(g_Array);
    
    for(new 
0g_Sizei++)
    {
        
ArrayGetString(g_Arrayig_Namecharsmax(g_Name));
        
        
Len += formatex(Data[Len], g_Buffer Len"<tr><td><font color=Red>%d</font></td>"1);
        
Len += formatex(Data[Len], g_Buffer Len"<td>%s</td></tr>"g_Name);
    }
    
Len += formatex(Data[Len],g_Buffer Len,"</center></body></html>");
    new 
motd_name[64];
    
format(motd_name64"%L"user"WANTVIP_MOTD_NAME");
    
show_motd(userDatamotd_name);        


Last edited by Unkolix; 04-29-2013 at 16:28.
Unkolix is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-29-2013 , 17:59   Re: VIPs doesn't appear in MotD
Reply With Quote #2

Why do you bother setting a dynamic array ?
Just format the string when you need to show the motd and only check for admin flags ;)
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Reply



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 10:51.


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