Raised This Month: $ Target: $400
 0% 

Optimize this..


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
PattyBiena
BANNED
Join Date: Jul 2010
Location: Argentina
Old 07-07-2010 , 16:46   Re: Optimize this..
Reply With Quote #3

Quote:
Originally Posted by ConnorMcLeod View Post
For the damage formula, manage yourself, it hurts my eyes..

For the switch statements :

Use a lookup table, you have to implement all weapons, put 1.0 for no change.
PHP Code:
new const Floatg_flDamageFactor[CSW_P90+1] =
{
    
0.0,
    
1.0// CSW_P228
    
0.0,
    
1.4// CSW_SCOUT
    
etc..
}

damage *= g_flDamageFactorget_user_weapon(attacker) ] 
For the level and cost :

PHP Code:
            switch( level 10 )
            {
                case 
0costo *= 1
                
case 1costo *= 4
                
case 2costo *= 6
                
case 3costo *= 8
                etc
... 
Sorry for my English, I use google translator.

I do not understand the formula of the damage, That is fine?

PHP Code:
switch( Lvl[id] / 10 )
{
    case 
0g_extraitem_cost[item] *= 1
    
case 1g_extraitem_cost[item] *= 4
    
case 2g_extraitem_cost[item] *= 6
    
case 3g_extraitem_cost[item] *= 8
    
case 4g_extraitem_cost[item] *= 10
    
case 5g_extraitem_cost[item] *= 12
    
case 6g_extraitem_cost[item] *= 14
    
case 7g_extraitem_cost[item] *= 16
    
case 8g_extraitem_cost[item] *= 18
    
case 9g_extraitem_cost[item] *= 20
    
case 10g_extraitem_cost[item] *= 22
    
case 11g_extraitem_cost[item] *= 23
    
case 12g_extraitem_cost[item] *= 24
    
case 13g_extraitem_cost[item] *= 26
    
case 14g_extraitem_cost[item] *= 28
    
case 15g_extraitem_cost[item] *= 30
    
case 16g_extraitem_cost[item] *= 32
    
case 17g_extraitem_cost[item] *= 34
    
case 18g_extraitem_cost[item] *= 36
    
case 19g_extraitem_cost[item] *= 38
    
default: g_extraitem_cost[item] *= 40

PattyBiena 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 07:09.


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