Raised This Month: $ Target: $400
 0% 

FM_ClientKill not triggering on Enviromental Deaths


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
gabuch2
AlliedModders Donor
Join Date: Mar 2011
Location: Chile
Old 04-14-2016 , 22:13   FM_ClientKill not triggering on Enviromental Deaths
Reply With Quote #1

As the title says, this is not hooking environmental deaths (fall, trigger_hurt, amx_slap/slay or death by monsters).

Suicides hook correctly.

Game: Sven Co-op
__________________

Last edited by gabuch2; 04-14-2016 at 22:14.
gabuch2 is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-15-2016 , 04:03   Re: FM_ClientKill not triggering on Enviromental Deaths
Reply With Quote #2

It's expected. This engine function has been always triggered only when "kill" command is used from a player's console.
__________________
Arkshine is offline
NiHiLaNTh
Way Past Expiration
Join Date: May 2009
Location: Latvia
Old 04-15-2016 , 04:26   Re: FM_ClientKill not triggering on Enviromental Deaths
Reply With Quote #3

you simply need to hook Ham_Killed and check whether attacker is the monster or there are no attacker at all.
__________________

NiHiLaNTh is offline
Send a message via Skype™ to NiHiLaNTh
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 04-15-2016 , 07:28   Re: FM_ClientKill not triggering on Enviromental Deaths
Reply With Quote #4

Quote:
Originally Posted by NiHiLaNTh View Post
you simply need to hook Ham_Killed and check whether attacker is the monster or there are no attacker at all.
Hamsandwich is pretty hardcoded and doesn't support all HL mods, Sven Co-op 5.0+ being one of them.

Lynx, try the following:
PHP Code:
const HamHam_SC_Killed Ham_IsTriggered
and then just hook Ham_SC_Killed.

Looks like Killed is located at index 20, where it previously was at 17. The previous code works because, regarding current hamdata.ini, IsTrigger is found at index 20 for (older version of) SC. That code just makes an alias for it, kind of.

Here is a table I dumped with IDA from the SC server binary, although it's a few months old one as I got it just as SC 5.0 got released.
It would be great if someone could upload the newest released server binary (Linux).
Code:
// Auto reconstructed from vtable block @ 0x007D3CA0
// from "sc50__server.so", by ida_vtables.idc
0	_ZN11CBaseEntity8PreSpawnEv_localalias_32
1	CBaseEntity::Spawn(void)
2	CBaseEntity::PostSpawn(void)
3	CBaseEntity::Precache(void)
4	CBaseEntity::KeyValue(KeyValueData_s *)
5	CBaseEntity::GetKeyValue(char  const*,entvartype_s &)
6	CBaseEntity::Save(CSave &)
7	CBaseEntity::Restore(CRestore &)
8	CBaseEntity::ObjectCaps(void)
9	CBaseEntity::Activate(void)
10	CBaseEntity::SetObjectCollisionBox(void)
11	_ZN11CBaseEntity17GetClassificationEi_localalias_71
12	CBaseEntity::SetClassification(int)
13	CBaseEntity::IRelationship(CBaseEntity*)
14	CBaseEntity::Classify(void)
15	CBaseEntity::DeathNotice(entvars_s *)
16	CBaseEntity::TraceAttack(entvars_s *,float,Vector,TraceResult *,int)
17	CBaseEntity::TakeDamage(entvars_s *,entvars_s *,float,int)
18	CBaseEntity::TakeHealth(float,int,int)
19	CBaseEntity::TakeArmor(float,int,int)
20	CBaseEntity::Killed(entvars_s *,int)
21	CBaseEntity::BloodColor(void)
22	CBaseEntity::TraceBleed(float,Vector,TraceResult *,int)
23	CBaseEntity::IsTriggered(CBaseEntity*)
24	CBaseEntity::MyMonsterPointer(void)
25	CBaseEntity::MySquadMonsterPointer(void)
26	CBaseEntity::MyCustomPointer(void)
27	CBaseEntity::MyItemPointer(void)
28	CBaseEntity::GetToggleState(void)
29	CBaseEntity::AddPoints(int,int)
30	CBaseEntity::AddPointsToTeam(int,int)
31	CBaseEntity::AddPlayerItem(CBasePlayerItem *)
32	CBaseEntity::RemovePlayerItem(CBasePlayerItem *)
33	CBaseEntity::GiveAmmo(int,char *,int,bool)
34	CBaseEntity::GetDelay(void)
35	CBaseEntity::IsMoving(void)
36	CBaseEntity::OverrideReset(void)
37	CBaseEntity::DamageDecal(int)
38	CBaseEntity::SetToggleState(int)
39	CBaseEntity::StartSneaking(void)
40	CBaseEntity::StopSneaking(void)
41	CBaseEntity::OnControls(entvars_s *)
42	CBaseEntity::IsSneaking(void)
43	CBaseEntity::IsAlive(void)
44	CBaseEntity::IsBSPModel(void)
45	CBaseEntity::ReflectGauss(void)
46	CBaseEntity::HasTarget(int)
47	CBaseEntity::IsInWorld(void)
48	CBaseEntity::IsMonster(void)
49	CBaseEntity::IsPlayer(void)
50	CBaseEntity::IsNetClient(void)
51	CBaseEntity::IsPointEnt(void)
52	CBaseEntity::IsMachine(void)
53	CBaseEntity::TeamID(void)
54	CBaseEntity::CriticalRemove(void)
55	CBaseEntity::GetNextTarget(void)
56	CBaseEntity::Think(void)
57	CBaseEntity::Touch(CBaseEntity*)
58	CBaseEntity::Use(CBaseEntity*,CBaseEntity*,USE_TYPE,float)
59	CBaseEntity::Blocked(CBaseEntity*)
60	CBaseEntity::UpdateOnRemove(void)
61	CBaseEntity::Respawn(void)
62	CBaseEntity::UpdateOwner(void)
63	CBaseEntity::FBecomeProne(void)
64	CBaseEntity::Center(void)
65	CBaseEntity::EyePosition(void)
66	CBaseEntity::EarPosition(void)
67	CBaseEntity::BodyTarget(Vector  const&)
68	CBaseEntity::Illumination(void)
69	CBaseEntity::FVisible(CBaseEntity*,bool)
70	CBaseEntity::FVisible(Vector  const&)
71	CBaseEntity::FVisibleFromPos(Vector  const&,Vector  const&)
72	CBaseEntity::IsFacing(entvars_s *,float)
73	CBaseEntity::GetPointsForDamage(float)
74	CBaseEntity::GetDamagePoints(entvars_s *,entvars_s *,float)
75	CBaseEntity::SetPlayerAlly(bool)
76	CBaseEntity::~CBaseEntity()
77	CBaseEntity::~CBaseEntity()
78	CBaseEntity::OnCreate(void)
79	CBaseEntity::OnDestroy(void)
80	CBaseEntity::IsRevivable(void)
81	CBaseEntity::BeginRevive(float)
82	CBaseEntity::EndRevive(float)
83	CBaseEntity::ShowHUDInfo(void)
84	CBaseEntity::ShouldDisablePlayerCollisions(void)const
85	__cxa_free_exception
86	`typeinfo name for'CCfgCommand

Last edited by klippy; 04-15-2016 at 07:32.
klippy is offline
gabuch2
AlliedModders Donor
Join Date: Mar 2011
Location: Chile
Old 04-15-2016 , 09:02   Re: FM_ClientKill not triggering on Enviromental Deaths
Reply With Quote #5

edit: nvm it doesn't work

Your method does though! Thank you!

Also, I can give you an updated linux library of the current SC ver. (5.03), but I doubt the table changed since it was mostly bugfixes.

Quote:
Originally Posted by Arkshine View Post
It's expected. This engine function has been always triggered only when "kill" command is used from a player's console.
So, I assume FM_ClientDisconnect will work the same way isn't? I mean, not hooking if the client times out or gets kicked
__________________

Last edited by gabuch2; 04-15-2016 at 10:49.
gabuch2 is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 04-15-2016 , 12:13   Re: FM_ClientKill not triggering on Enviromental Deaths
Reply With Quote #6

Quote:
Originally Posted by Shattered Heart Lynx View Post
edit: nvm it doesn't work
I think I saw your post before you edited it out, was it about:
PHP Code:
const HamHam_YourHam Ham69
?
You can't put raw numbers in there because these Ham_* constants aren't actually virtual table indexes, but just some numbers that Hamsandwich identifies and does stuff with the virtual function that constant represents for the running mod on your server. That's why we don't need Spawn to be prefixed for every mod, like Ham_CS_Spawn and Ham_TFC_Spawn, as these indexes are found in hamdata.ini.
Some Ham constants that represent certain virtual functions are prefixed because these virtual functions exist only in one or a few games.
So just look at hamdata.ini at "svencoop" Linux section and you'll find which ones you can use to "hack" around hamdata.ini not being updated yet for SC5.0.

Quote:
Originally Posted by Shattered Heart Lynx View Post
Also, I can give you an updated linux library of the current SC ver. (5.03), but I doubt the table changed since it was mostly bugfixes.
Alrighty then.

Quote:
Originally Posted by Shattered Heart Lynx View Post
So, I assume FM_ClientDisconnect will work the same way isn't? I mean, not hooking if the client times out or gets kicked
I believe it works for all cases. The best would be to search around for your answer or just test it out. It's not something AMXX controls, these functions are exported directly from the GoldSrc/HL engine.
klippy is offline
gabuch2
AlliedModders Donor
Join Date: Mar 2011
Location: Chile
Old 04-15-2016 , 13:06   Re: FM_ClientKill not triggering on Enviromental Deaths
Reply With Quote #7

Quote:
Originally Posted by KliPPy View Post
I think I saw your post before you edited it out, was it about:
PHP Code:
const HamHam_YourHam Ham69
?
Yep, it was your snippet when I asked for a similar problem

Here's the latest linux server binary. (originally it's called server.so, but my metamod-p version required this specific name)
Attached Files
File Type: zip hl_i386.zip (3.06 MB, 84 views)
__________________
gabuch2 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 18:38.


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