Raised This Month: $ Target: $400
 0% 

SetHamParamFloat,if not float char?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 02-13-2009 , 10:27   SetHamParamFloat,if not float char?
Reply With Quote #1

If in SetHamParamFloat I will do this:
SetHamParamFloat(4, damage * 2)

If "2" is not float, then damage won't multiple x2 ?
xbatista is offline
Send a message via Skype™ to xbatista
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 02-13-2009 , 11:10   Re: SetHamParamFloat,if not float char?
Reply With Quote #2

Yes it will, as soon as damage is a float

Float * integer = Float
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 02-13-2009 , 11:20   Re: SetHamParamFloat,if not float char?
Reply With Quote #3

In same cases it wont work, but I guess you can do this in SetHamParamFloat().
__________________
hleV is offline
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 02-13-2009 , 11:25   Re: SetHamParamFloat,if not float char?
Reply With Quote #4

OK thx for the info.
And I have this problem:
PHP Code:
new BulletLevel[33]
#define sb_perlevel 0.2 
PHP Code:
public TakeDamage(i_Victimi_Inflictori_AttackerFloat:damage)
{
    if(
BulletLevel[i_Attacker] > && is_user_connected(i_Attacker) && get_user_team i_Victim ) != get_user_team i_Attacker ) && get_user_team(i_Attacker) == && get_pcvar_num(sb_enable) == && get_user_weapon(i_Attacker) == CSW_USP || get_user_weapon(i_Attacker) == CSW_DEAGLE || get_user_weapon(i_Attacker) == CSW_P228 || get_user_weapon(i_Attacker) == CSW_FIVESEVEN || get_user_weapon(i_Attacker) == CSW_ELITE || get_user_weapon(i_Attacker) == CSW_GLOCK18)
    {
        
SetHamParamFloat(4damage * (1.0 BulletLevel[i_Attacker] * sb_perlevel)); 
    }

I need to do FLOAT on hamTkaedamage not on the top new Float:BulletLevel[33].
I need to float this in HamTakedamage: BulletLevel[i_Attacker], how to do this?.

Last edited by xbatista; 02-13-2009 at 11:28.
xbatista is offline
Send a message via Skype™ to xbatista
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-13-2009 , 11:35   Re: SetHamParamFloat,if not float char?
Reply With Quote #5

float()
Arkshine is offline
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 02-13-2009 , 11:39   Re: SetHamParamFloat,if not float char?
Reply With Quote #6

Quote:
float()

Yes it is thx.
And please check this:
I've good checked?
If you are ct ,damage increased and if he has usp,glock etc.
PHP Code:
   if(is_user_connected(i_Attacker) && get_user_team i_Victim ) != get_user_team i_Attacker ) && get_user_team(i_Attacker) == && get_user_weapon(i_Attacker) == CSW_USP || get_user_weapon(i_Attacker) == CSW_DEAGLE || get_user_weapon(i_Attacker) == CSW_P228 || get_user_weapon(i_Attacker) == CSW_FIVESEVEN || get_user_weapon(i_Attacker) == CSW_ELITE || get_user_weapon(i_Attacker) == CSW_GLOCK18

Last edited by xbatista; 02-13-2009 at 11:43.
xbatista is offline
Send a message via Skype™ to xbatista
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 02-13-2009 , 12:24   Re: SetHamParamFloat,if not float char?
Reply With Quote #7

PHP Code:
   if(is_user_connected(i_Attacker) && get_user_team i_Victim ) != get_user_team i_Attacker ) && get_user_team(i_Attacker) == && get_user_weapon(i_Attacker) == CSW_USP
|| get_user_weapon(i_Attacker) == CSW_DEAGLE
|| get_user_weapon(i_Attacker) == CSW_P228
|| get_user_weapon(i_Attacker) == CSW_FIVESEVEN
|| get_user_weapon(i_Attacker) == CSW_ELITE
|| get_user_weapon(i_Attacker) == CSW_GLOCK18
This is what your code is translated to because you didn't use parenthesis around the weapon.

Here is the better way of doing it, so that you don't call get_user_team() twice for the attacker and get_user_weapon() 6 times for the attacker:

Code:
// at top of plugin #define SECONDARY_WEAPONS_BIT (1<<CSW_USP|1<<CSW_DEAGLE|1<<CSW_P228|1<<CSW_DEAGLE|1<<CSW_GLOCK18|1<<CSW_ELITE) #define UsingSecondaryWeapon(%1) ((1<<get_user_weapon(%1)) & SECONDARY_WEAPONS_BIT) if( !is_user_connected(i_Attacker) ) // return; new ateam = get_user_team(i_Attacker); if( get_user_team(i_Victim) == ateam || ateam != 2 ) // return; if( !UsingSecondaryWeapon(i_Attacker) ) // return; // your code
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 02-13-2009 , 12:29   Re: SetHamParamFloat,if not float char?
Reply With Quote #8

Yeah thx ;;;;;;)))))
xbatista is offline
Send a message via Skype™ to xbatista
Reply


Thread Tools
Display Modes

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 16:54.


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