AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Ham_Killed (https://forums.alliedmods.net/showthread.php?t=184293)

Liverwiz 05-03-2012 12:37

Ham_Killed
 
When Ham_killed is called, and you're executing the function that you hooked to that. what does that shouldgib var mean?

Quote:

/**
* Description: Normally called whenever an entity dies.
* Forward params: function(this, idattacker, shouldgib)
* Return type: None.
* Execute params: ExecuteHam(Ham_Killed, this, idattacker, shouldgib);
*/
Ham_Killed,
and, also, what's the easiest way to determine the weapon in which a player was killed with?

EpicMonkey 05-03-2012 15:01

Re: Ham_Killed
 
Quote:

Originally Posted by Liverwiz (Post 1701245)
When Ham_killed is called, and you're executing the function that you hooked to that. what does that shouldgib var mean?



and, also, what's the easiest way to determine the weapon in which a player was killed with?

not sure about the first one , but the second one ... get the attackers weapon

Liverwiz 05-03-2012 19:34

Re: Ham_Killed
 
Quote:

Originally Posted by EpicMonkey (Post 1701346)
not sure about the first one , but the second one ... get the attackers weapon

Simply getting the attacker's weapon will return the weapon they are carrying. Quite often people will die by nade, while the attacker is holding a rifle.

Later in my search i found CSX module which includes client_death, returning the weaponID in which the victim was killed with. But is there a more popular module that has this functionality? I really hate using so many different headerfiles when i can use just one or two.

fysiks 05-04-2012 03:32

Re: Ham_Killed
 
Quote:

Originally Posted by Liverwiz (Post 1701523)
I really hate using so many different headerfiles when i can use just one or two.

That's a bad reason. Use what works. Have you looked at inflictor? I can't remember if it will give what you need.

If you don't need to modify the killed function then just use DeathMsg and you can get the weapon from the args.

Liverwiz 05-05-2012 09:00

Re: Ham_Killed
 
Quote:

Originally Posted by fysiks (Post 1701774)
If you don't need to modify the killed function then just use DeathMsg and you can get the weapon from the args.

Oh, can you? arg[3] i assume? 1 is killer, 2 is victim. yes?

GordonFreeman (RU) 05-05-2012 09:01

Re: Ham_Killed
 
shouldgiv.
KILLER -> RPG/Mp5 Grender -> Boom -> Victim -> blood, meat -> shouldgib=1

ConnorMcLeod 05-05-2012 09:48

Re: Ham_Killed
 
Code:

// when calling KILLED(), a value that governs gib behavior is expected to be
// one of these three values
#define GIB_NORMAL                        0// gib if entity was overkilled
#define GIB_NEVER                        1// never gib, no matter how much death damage is done ( freezing, etc )
#define GIB_ALWAYS                        2// always gib ( Houndeye Shock, Barnacle Bite )


Code:

void CBasePlayer::Killed( entvars_t *pevAttacker, int iGib )
// [ ... ]
        if ( ( pev->health < -40 && iGib != GIB_NEVER ) || iGib == GIB_ALWAYS )
        {
                pev->solid                        = SOLID_NOT;
                GibMonster();        // This clears pev->model
                pev->effects |= EF_NODRAW;
                return;
        }


Liverwiz 05-05-2012 10:15

Re: Ham_Killed
 
Much thanks Connor!
Appreciate it.


All times are GMT -4. The time now is 00:25.

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