Raised This Month: $ Target: $400
 0% 

what about optimizing it?lol


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-10-2009 , 16:22   Re: what about optimizing it?lol
Reply With Quote #1

I would use Snow's for the SetHamParamFloat if you are going to make those numbers consistent. Although, I don't know if the math is faste than the indexing of the array.

Using Bugsy's for the weapons is a must I think.

EDIT: Oops, didn't realize there was another post on the next page.

Those aren't literal substitutions, the declaring of the two arrays need to be at the top of the plugin and you have to replace the switch (for the weapons) with something like
Code:
damage *= Weapon_Multiplier[plrWeapId]
__________________

Last edited by fysiks; 05-10-2009 at 16:42.
fysiks is offline
_lol_
Senior Member
Join Date: Apr 2009
Old 05-10-2009 , 16:03   Re: what about optimizing it?lol
Reply With Quote #2

so...it is like this??

PHP Code:
switch (plrWeapId)
            {
                
// Primary Weapons
                
case (CSW_M3): damage *= 4.0
                
case (CSW_M249): damage *= 4.5
                
                
case (CSW_G3SG1): damage *= 2.5
                
case (CSW_SG550): damage *= 2.2
                
case (CSW_MP5NAVY): damage *= 4.1
                
                
case (CSW_AUG): damage *= 2.9
                
case (CSW_SG552): damage *= 2.8
                
                
case (CSW_AWP): damage *= 3.0
                
case (CSW_XM1014): damage *= 2.1
                
                
case (CSW_M4A1): damage *= 1.7
                
case (CSW_AK47): damage *= 1.7
                
                
case (CSW_SCOUT): damage *= 2.0
                
                
case (CSW_GALIL): damage *= 1.0
                
case (CSW_FAMAS): damage *= 1.0
                
                
                
//Secundary Weapons
                
case (CSW_GLOCK18): damage *= 6.7
                
case (CSW_ELITE): damage *= 3.0
                
case (CSW_FIVESEVEN): damage *= 2.0
                
case (CSW_DEAGLE): damage *= 1.7
                
case (CSW_P228): damage *= 1.3
                
case (CSW_USP): damage *= 1.0
            

--->

PHP Code:
new const FloatWeapon_Multiplier[] = 
{
    
0.0,    // ---
    
1.3,    // P228
    
0.0,    // ---
    
2.0,    // SCOUT
    
0.0,    // ---
    
2.2,    // XM1014
    
0.0,    // ---
    
2.3,    // MAC10
    
3.1,    // AUG
    
0.0,    // ---
    
3.0,    // ELITE
    
2.0,    // FIVESEVEN
    
2.4,    // UMP45
    
4.2,    // SG550
    
1.1,    // GALIL
    
1.1,    // FAMAS
    
2.2,    // USP
    
6.7,    // GLOCK18
    
3.0,    // AWP
    
4.1,    // MP5NAVY
    
4.5,    // M249
    
4.0,    // M3
    
1.9,    // M4A1
    
2.4,    // TMP
    
2.5,    // G3SG1
    
0.0,    // ---
    
1.7,    // DEAGLE
    
3.0,    // SG552
    
1.9,    // AK47
    
0.0,    // ---
    
2.0    // P90
}

new 
iWeapIDplrClipplrAmmo
iWeapID 
get_user_weapon(attackerplrClipplrAmmo)
damage *= Weapon_Multiplier[iWeapID
And...

PHP Code:
switch (g_level[attacker])
            {
                case (
1): SetHamParamFloat(4damage)
                case (
2): SetHamParamFloat(4damage*1.1)
                case (
3): SetHamParamFloat(4damage*1.2)
                case (
4): SetHamParamFloat(4damage*1.3)
                case (
5): SetHamParamFloat(4damage*1.4)
                case (
6): SetHamParamFloat(4damage*1.5)
                case (
7): SetHamParamFloat(4damage*1.6)
                case (
8): SetHamParamFloat(4damage*1.7)
                case (
9): SetHamParamFloat(4damage*1.8)
                case (
10): SetHamParamFloat(4damage*1.9)
                case (
11): SetHamParamFloat(4damage*2.9)
                case (
12): SetHamParamFloat(4damage*2.1)
                case (
13): SetHamParamFloat(4damage*2.2)
                case (
14): SetHamParamFloat(4damage*2.3)
                case (
15): SetHamParamFloat(4damage*2.4)
                case (
16): SetHamParamFloat(4damage*2.5)
                case (
17): SetHamParamFloat(4damage*2.6)
                case (
18): SetHamParamFloat(4damage*2.7)
                case (
19): SetHamParamFloat(4damage*2.8)
                case (
20): SetHamParamFloat(4damage*2.9)
            } 
---->

PHP Code:
new const Float:damage_factor[] = { 1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,1.9,2.9,2.1,2.2,2.3,2.4,2.5,2.6,2.7,2.8,3.0 
SetHamParamFloat(4,damage damage_factor[g_level[attacker]])) 
RIGHT?

Last edited by _lol_; 05-10-2009 at 16:07.
_lol_ 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 01:36.


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