Raised This Month: $ Target: $400
 0% 

Double Damage don't work


Post New Thread Reply   
 
Thread Tools Display Modes
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 10-07-2014 , 07:32   Re: Double Damage don't work
Reply With Quote #11

Quote:
Originally Posted by aron9forever View Post
woops, sorry, I was high as fuck , that's when I start shitposting
he still needs return HAM_OVERRIDE instead of supercede
no, HAM_OVERRIDE is used when you change the return value
jimaway is offline
aron9forever
Veteran Member
Join Date: Feb 2013
Location: Rromania
Old 10-07-2014 , 07:35   Re: Double Damage don't work
Reply With Quote #12

Quote:
Originally Posted by jimaway View Post
no, HAM_OVERRIDE is used when you change the return value
and you don't change the returned damage?
I'm sorry it's just that I have some gaps with hamsandwich compared to other functions
__________________
Meanwhile, in 2050:
Quote:
Originally Posted by aron9forever
useless small optimizations
Quote:
Originally Posted by Black Rose View Post
On a map that is 512x512x128 units you end up with 3,355,443,200,000 different "positions". To store each one of those positions individually in the variable "user_or" you need 12 terabytes of memory.
aron9forever is offline
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 10-07-2014 , 07:41   Re: Double Damage don't work
Reply With Quote #13

Quote:
Originally Posted by aron9forever View Post
and you don't change the returned damage?
I'm sorry it's just that I have some gaps with hamsandwich compared to other functions
the TakeDamage function does not return damage, it returns 0 or 1

Code:
int CBaseEntity :: TakeDamage( entvars_t* pevInflictor, entvars_t* pevAttacker, float flDamage, int bitsDamageType )
{
	Vector			vecTemp;

	if (!pev->takedamage)
		return 0;

	// UNDONE: some entity types may be immune or resistant to some bitsDamageType
	
	// if Attacker == Inflictor, the attack was a melee or other instant-hit attack.
	// (that is, no actual entity projectile was involved in the attack so use the shooter's origin). 
	if ( pevAttacker == pevInflictor )	
	{
		vecTemp = pevInflictor->origin - ( VecBModelOrigin(pev) );
	}
	else
	// an actual missile was involved.
	{
		vecTemp = pevInflictor->origin - ( VecBModelOrigin(pev) );
	}

// this global is still used for glass and other non-monster killables, along with decals.
	g_vecAttackDir = vecTemp.Normalize();
		
// save damage based on the target's armor level

// figure momentum add (don't let hurt brushes or other triggers move player)
	if ((!FNullEnt(pevInflictor)) && (pev->movetype == MOVETYPE_WALK || pev->movetype == MOVETYPE_STEP) && (pevAttacker->solid != SOLID_TRIGGER) )
	{
		Vector vecDir = pev->origin - (pevInflictor->absmin + pevInflictor->absmax) * 0.5;
		vecDir = vecDir.Normalize();

		float flForce = flDamage * ((32 * 32 * 72.0) / (pev->size.x * pev->size.y * pev->size.z)) * 5;
		
		if (flForce > 1000.0) 
			flForce = 1000.0;
		pev->velocity = pev->velocity + vecDir * flForce;
	}

// do the damage
	pev->health -= flDamage;
	if (pev->health <= 0)
	{
		Killed( pevAttacker, GIB_NORMAL );
		return 0;
	}

	return 1;
}

Last edited by jimaway; 10-07-2014 at 07:41.
jimaway is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 10-07-2014 , 11:59   Re: Double Damage don't work
Reply With Quote #14

Quote:
Originally Posted by aron9forever View Post
woops, sorry, I was high as fuck , that's when I start shitposting
he still needs return HAM_OVERRIDE instead of supercede
HAM_HANDLED is what he needs to return.
__________________
HamletEagle is offline
NikKOo31
Senior Member
Join Date: May 2013
Location: Home
Old 10-07-2014 , 13:13   Re: Double Damage don't work
Reply With Quote #15

PHP Code:
public Damage(victiminflictorattackerFloat:damagedamagebits

    if(
is_user_connected(victim) || is_user_alive(victim))  
    { 
        if( 
get_user_weapon(attacker) == CSW_AK47 )
        {
            if (
AreGoldenAk[attacker])
            {
                
SetHamParamFloat4damage )
                return 
HAM_HANDLED
            
}
            if (
AreSuperAk[attacker])
            {
                
SetHamParamFloat4damage 3)
                return 
HAM_HANDLED
            
}
        }
    }
    return 
HAM_IGNORED



PHP Code:
public Damage(victiminflictorattackerFloat:damagedamagebits

    if(
is_user_connected(attacker) && is_user_alive(victim))  
    { 
        if( 
get_user_weapon(attacker) == CSW_AK47 )
        {
            if (
AreGoldenAk[attacker])
            {
                
SetHamParamFloat4damage 2.0 )
                return 
HAM_HANDLED
            
}
            if (
AreSuperAk[attacker])
            {
                
SetHamParamFloat4damage 3.0 )
                return 
HAM_HANDLED
            
}
        }
    }
    return 
HAM_IGNORED

__________________
Hey ^_^
NikKOo31 is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 10-07-2014 , 14:00   Re: Double Damage don't work
Reply With Quote #16

No,
Code:
public Damage(victim, inflictor, attacker, Float:damage, damagebits)   {       if( is_user_connected( attacker ) )       {           if( get_user_weapon(attacker) == CSW_AK47 )         {             if (AreGoldenAk[attacker])             {                 SetHamParamFloat( 4, damage * 2.0 )                 return HAM_HANDLED             }             if (AreSuperAk[attacker])             {                 SetHamParamFloat( 4, damage * 3.0 )                 return HAM_HANDLED             }         }     }     return HAM_IGNORED }
__________________
HamletEagle is offline
Nextra
Veteran Member
Join Date: Apr 2008
Location: Germany
Old 10-07-2014 , 15:49   Re: Double Damage don't work
Reply With Quote #17

He already said that he has fixed the issue and his code works. You can stop now.
__________________
In Flames we trust!
Nextra 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 17:56.


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