Raised This Month: $ Target: $400
 0% 

give hat by rank


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Caldeum
Senior Member
Join Date: Jul 2010
Location: United Kingdom
Old 09-16-2012 , 13:58   give hat by rank
Reply With Quote #1

Hello, can anyone optimize this code ? cause server get laggy after 10~ rounds.

PHP Code:
new g_topEnt33 ];

new 
MODEL_1[ ] = "models/1.mdl";
new 
MODEL_2[ ] = "models/2.mdl";

public 
CheckPlayerRankid )
{
    new 
stats], bodyhits];
    new 
iRank;
     
iRank get_user_statsidstatsbodyhits );
    
    if ( 
iRank && <= iRank <= 10 )
        
GiveHatidMODEL_1 );
    else if ( 
iRank && 11 <= iRank <= 20 )
        
GiveHatidMODEL_2 );
    
    return 
PLUGIN_CONTINUE;
}

public 
GiveHatid, const s_Model[ ] )
{
    if ( 
is_user_aliveid ) )
    {
        new 
iEnt g_topEntid ];
        if ( !
pev_validiEnt ) )
        {
            
iEnt engfuncEngFunc_CreateNamedEntityengfuncEngFunc_AllocString"info_target" ) );
            
set_peviEntpev_movetypeMOVETYPE_FOLLOW );
            
set_peviEntpev_aimentid );
            
engfuncEngFunc_SetModeliEnts_Model );
        }
        else
            
engfuncEngFunc_RemoveEntityiEnt );
    }
}

public 
client_infochangedid )
{
    new 
player_name32 ], newName32 ];
    
get_user_nameidplayer_name31 );
    
get_user_infoid"name"newName31 );
    
    if ( !
equalinewNameplayer_name ) )
        
set_task1.0"CheckPlayerRank"id );

__________________
Of all the things I lost, I miss my brain the most.
Caldeum 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 08:22.


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