View Single Post
SweatyBanana
BANNED
Join Date: Sep 2005
Location: LOL
Old 10-21-2006 , 09:26   Re: Client Checker
Reply With Quote #4

Some of your code is very repeticious..

ex:

in cc_messagetype, you use this like 3 times when you can simply put it above all three if() statements..

PHP Code:
new players get_playersnum()
for (
0;<= players;i++)
{
            if (
is_user_admin(i))
            {
                       
//Your client_prints
            
}

I would also suggest changing the if() statements in there to a switch() statement like so:

PHP Code:
    new players get_playersnum()
    for (
0;<= players;i++)

    switch(
type)
    {
        case 
0:
        {
            return 
PLUGIN_HANDLED;
        }
        
        case 
1:
        {
            if(
is_user_admin(i))
            {
                
client_print(iprint_chat"%d %s: %s %s"idnamecvarvalue)
            }
        }
        
        case 
2:
        {
            
client_print(idprint_chat"%d %s: %s %s"idname ,cvarvalue)
            if (
is_user_admin(i))
            {
                
client_print(iprint_chat"%d %s: %s %s"idnamecvarvalue)
            }
        }
        
        case 
3:
        {
            
client_print(iprint_chat"%d %s: %s %s"idnamecvarvalue)
        }
    } 
SweatyBanana is offline
Send a message via AIM to SweatyBanana Send a message via Yahoo to SweatyBanana