AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Module Coding (https://forums.alliedmods.net/forumdisplay.php?f=9)
-   -   [Metamod] VTable HookKilled() (https://forums.alliedmods.net/showthread.php?t=269428)

Rirre 08-08-2015 22:30

[Metamod] VTable HookKilled()
 
This is working just fine under Windows. But in Linux, when the entity gets killed by a HE grenade it result to a Segmentation fault. Always.
Any idea why this just happens with HEs?
Have tried without even AMXX to make sure no plugins conflict with it.
Code:
#ifdef _WIN32 void __fastcall HookKilled( void *pthis, int i, entvars_t *pevAttacker, int iGib ) #elif __linux__ void HookKilled( void *pthis, entvars_t *pevAttacker, int iGib ) #endif {     META_CONS("HookKilled"); #ifdef _WIN32     reinterpret_cast<int (__fastcall *)(void *, int, entvars_t *, int)>(g_Killed_Hook.address)(pthis, DUMMY_VAL, pevAttacker, iGib); #elif __linux__     reinterpret_cast<int (*)(void *, entvars_t *, int)>(g_Killed_Hook.address)(pthis, pevAttacker, iGib); // this is causing it (also tried with void* instead of int) #endif     META_CONS("HookKilled -- continue");     edict_t* pVictim = PrivateToEdict( pthis );     if (!IsValidPev(pVictim))     {         return;     } }

Arkshine 08-09-2015 08:01

Re: [Metamod] VTable HookKilled()
 
Code looks good. It reminds this issue someone has under windows though : https://github.com/ValveSoftware/halflife/issues/1646

Don't you have a backtrace?

Rirre 08-09-2015 08:51

Re: [Metamod] VTable HookKilled()
 
Had to remove the .so file since it didn't overwrite a old version I used to block every DamageType except DMG_HEGRENADE bit in TakeDamage().
Now it crashes whatever weapon I'm using when the entity should die. It's the same line in HookKilled() causing it.
Still works fine under Windows.

Too much to copy & paste in here so I attach a zipped file with the files.

Arkshine 08-09-2015 10:49

Re: [Metamod] VTable HookKilled()
 
You're setting base to 0x94 and diff to 2, does it mean you're running an old HLDS version before the Steam update in 2013?

Rirre 08-09-2015 15:29

Re: [Metamod] VTable HookKilled()
 
Quote:

Originally Posted by Arkshine (Post 2331204)
You're setting base to 0x94 and diff to 2, does it mean you're running an old HLDS version before the Steam update in 2013?

Aha! Just changed that and now it works. Thanks :) I got some help with this so no I did not set that by myself. Running the latest


All times are GMT -4. The time now is 06:23.

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