Raised This Month: $ Target: $400
 0% 

Get entity killer.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
urban_ninja
Senior Member
Join Date: Feb 2009
Old 03-04-2013 , 15:09   Get entity killer.
Reply With Quote #1

How can I hook the death of an entity and get its attacker? I've tried
PHP Code:
RegisterHamHam_Killed"func_wall""Killed"); 
but it crashes the engine upon killing a monster.

Is ham really the only way to do this?

I've looks at some other examples on here but none of them work at all. At least this one can detect monster killed even tho it results in a crash.
__________________

Last edited by urban_ninja; 03-04-2013 at 15:17.
urban_ninja is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 03-04-2013 , 16:06   Re: Get entity killer.
Reply With Quote #2

Show your Killed() function.
__________________
hleV is offline
urban_ninja
Senior Member
Join Date: Feb 2009
Old 03-04-2013 , 16:17   Re: Get entity killer.
Reply With Quote #3

PHP Code:
public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
RegisterHamHam_Killed"func_wall""Killed");
}
public 
Killed( const monster, const attacker)
{
    
set_user_frags(attackerget_user_frags(attacker) + 1);

EDIT: I've just read in some other thread that team fortress classic has issues with Ham_Killed. Cant this be done without using ham?
__________________

Last edited by urban_ninja; 03-04-2013 at 17:28.
urban_ninja is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 03-04-2013 , 17:52   Re: Get entity killer.
Reply With Quote #4

Try
PHP Code:
public Killed(entityattacker)
{
    if (
is_user_connected(attacker))
        
set_user_frags(attackerget_user_frags(attacker) + 1);

and see if it helps.
__________________
hleV is offline
urban_ninja
Senior Member
Join Date: Feb 2009
Old 03-04-2013 , 18:51   Re: Get entity killer.
Reply With Quote #5

Nope. Still crashes.
__________________
urban_ninja is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 03-04-2013 , 19:02   Re: Get entity killer.
Reply With Quote #6

It stills happens with the unofficial version of Ham ?

It might crash because in TFC Killed could has different params count. But it's most likely not the case.

Is there a crash only when hooking on "func_wall" ? Or it crashes for all, "player", etc. ?
__________________

Last edited by Arkshine; 03-04-2013 at 19:17.
Arkshine is offline
Old 03-04-2013, 19:03
Arkshine
This message has been deleted by Arkshine. Reason: lag
urban_ninja
Senior Member
Join Date: Feb 2009
Old 03-04-2013 , 19:12   Re: Get entity killer.
Reply With Quote #7

Crash happens with any entity.
__________________
urban_ninja is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 03-04-2013 , 19:16   Re: Get entity killer.
Reply With Quote #8

Checked and it's actually one param in more: Killed(entvars_s *, entvars_s *, int). if it crashes it's most likely because it uses the wrong handler (HL uses (entvars_s *, int)). Will fix that tomorrow. I would need to add a specific constant Ham_TFC_Killed.
__________________

Last edited by Arkshine; 03-04-2013 at 19:18.
Arkshine is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 03-05-2013 , 04:13   Re: Get entity killer.
Reply With Quote #9

Tell me if it works. You have to use Ham_TFC_Killed. Updated include is provided.
Attached Files
File Type: dll hamsandwich_amxx.dll (265.5 KB, 176 views)
File Type: inc ham_const.inc (104.9 KB, 188 views)
__________________

Last edited by Arkshine; 03-05-2013 at 04:14.
Arkshine is offline
urban_ninja
Senior Member
Join Date: Feb 2009
Old 03-05-2013 , 16:54   Re: Get entity killer.
Reply With Quote #10

L 03/05/2013 - 16:50:24: [AMXX] Plugin ("MosterKiller.amxx") is setting itself as failed.
L 03/05/2013 - 16:50:24: [AMXX] Plugin says: Function tfc_killed is not configured in hamdata.ini.
L 03/05/2013 - 16:50:24: [AMXX] Displaying debug trace (plugin "MosterKiller.amxx")
L 03/05/2013 - 16:50:24: [AMXX] Run time error 1: forced exit
L 03/05/2013 - 16:50:24: [AMXX] [0] hamsandwich.inc::__fatal_ham_error (line 376)
__________________

Last edited by urban_ninja; 03-05-2013 at 16:55.
urban_ninja 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 21:42.


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