Raised This Month: $ Target: $400
 0% 

hp based glow


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ezio_auditore
Senior Member
Join Date: May 2013
Old 01-07-2014 , 01:45   Re: hp based glow
Reply With Quote #1

Quote:
Originally Posted by ConnorMcLeod View Post
His previous code is better than... this

now what part in the previous code is bad...


as per DavidJr's explaination, a bad code is something which can be coded by anyone else...

Now, Dare.Devil has suggested a harder code, and the last reply is much harder.

So, Connor my friend, what exactly is "badly coded"
__________________

Last edited by ezio_auditore; 01-07-2014 at 02:12.
ezio_auditore is offline
Send a message via Skype™ to ezio_auditore
11922911
Senior Member
Join Date: Dec 2011
Location: Yuen Long Country
Old 01-07-2014 , 02:33   Re: hp based glow
Reply With Quote #2

Quote:
Originally Posted by ezio_auditore View Post
now what part in the previous code is bad...


as per DavidJr's explaination, a bad code is something which can be coded by anyone else...

Now, Dare.Devil has suggested a harder code, and the last reply is much harder.

So, Connor my friend, what exactly is "baldy coded"
Something like:
PHP Code:
    new HP get_user_health(ent)
    if (
HP >= 100)
    {
        
set_es es_handleES_RenderColor, { 5116887 } )
    }
    else if (
HP 100 && HP >= 75)
    {
        
set_es es_handleES_RenderColor, { 5116887 } )
    }
    else if (
HP 75 && HP >= 50)
    {
        
set_es es_handleES_RenderColor, { 597212 } )
    }
    else if (
HP 50 && HP >= 25)
    {
        
set_es es_handleES_RenderColor, { 25518959 } )
    }
    else if (
HP 25)
    {
        
set_es es_handleES_RenderColor, { 2550} )
    } 
You can optimize like this:
PHP Code:
    new HP get_user_health(ent)
    if (
HP >= 75)
    {
        
set_es es_handleES_RenderColor, { 5116887 } )
    }
    else if (
HP >= 50)
    {
        
set_es es_handleES_RenderColor, { 597212 } )
    }
    else if (
HP >= 25)
    {
        
set_es es_handleES_RenderColor, { 25518959 } )
    }
    else
    {
        
set_es es_handleES_RenderColor, { 2550} )
    } 
And don't use too much check or native inside a forward which is called many times (like AddToFullPack), it's faster and better to use a global variable instead of a native function.

That's what I think about "badly coded".
__________________
youtube:
@holla16

Last edited by 11922911; 01-07-2014 at 02:38.
11922911 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:13.


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