Raised This Month: $ Target: $400
 0% 

[HELP] Optimizing


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
The Inhabitant Of Heavens
Member
Join Date: Aug 2011
Old 09-20-2011 , 16:31   [HELP] Optimizing
Reply With Quote #1

How to optimize a code?

CPU 15 ~ %

PHP Code:
register_forward(FM_AddToFullPack"fm_fullpack"1
PHP Code:
public fm_fullpack(eseenthosthostflagsplayerpSet)
{
    if(!
is_user_connected(host))
    return 
FMRES_IGNORED
    
    
if(!pev_valid(ent))
    return 
FMRES_IGNORED

    
    
static classname[32]
    
pev(entpev_classnameclassname31)
    
    if(!
equal(classname"sprite"))
    return 
FMRES_IGNORED
    
    
static ptr
    
    ptr 
create_tr2()
    static 
Float:start[3], Float:end[3]
    
    
pev(hostpev_originstart)
    
pev(entpev_originend)
    
    
engfunc(EngFunc_TraceLinestartendIGNORE_MONSTERSentptr)
    
    static 
Float:fr
    get_tr2
(ptrTR_flFractionfr)
    if(
fr != 1.0)
    {
        
get_tr2(ptrTR_vecEndPosend)
        
get_tr2(ptrTR_vecPlaneNormalstart)
        
start[0] *= 10.0
        start
[1] *= 10.0
        start
[2] *= 10.0
        
        end
[0] += start[0]
        
end[1] += start[1]
        
end[2] += start[2]
        
        
set_es(esES_Originend)
        static 
Float:distFloat:scale
        
        pev
(entpev_originstart)
        
dist get_distance_f(startend) - 10.0
        
        scale 
500.0 dist

        
if(scale 1.0)
        
scale 1.0
        
        
if(scale 0.3)
        
scale 0.3
        
        set_es
(esES_Scalescale)
        
        
    }
    else
    {
        
set_es(esES_Effectsget_es(esES_Effects) | EF_NODRAW)
    }
    
    
free_tr2(ptr)
    
    return 
FMRES_IGNORED
    
    

The Inhabitant Of Heavens 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 19:39.


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