AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   SetHamParamFloat,if not float char? (https://forums.alliedmods.net/showthread.php?t=85601)

xbatista 02-13-2009 10:27

SetHamParamFloat,if not float char?
 
If in SetHamParamFloat I will do this:
SetHamParamFloat(4, damage * 2)

If "2" is not float, then damage won't multiple x2 ?

ConnorMcLeod 02-13-2009 11:10

Re: SetHamParamFloat,if not float char?
 
Yes it will, as soon as damage is a float

Float * integer = Float

hleV 02-13-2009 11:20

Re: SetHamParamFloat,if not float char?
 
In same cases it wont work, but I guess you can do this in SetHamParamFloat().

xbatista 02-13-2009 11:25

Re: SetHamParamFloat,if not float char?
 
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?.

Arkshine 02-13-2009 11:35

Re: SetHamParamFloat,if not float char?
 
float()

xbatista 02-13-2009 11:39

Re: SetHamParamFloat,if not float char?
 
Quote:

float()
:shock: :shock: :shock:
Yes it is thx. :D
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


Exolent[jNr] 02-13-2009 12:24

Re: SetHamParamFloat,if not float char?
 
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

xbatista 02-13-2009 12:29

Re: SetHamParamFloat,if not float char?
 
Yeah thx ;;;;;;)))))


All times are GMT -4. The time now is 16:54.

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