Raised This Month: $32 Target: $400
 8% 

func_breakable


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
safetymoose
Senior Member
Join Date: Feb 2015
Old 06-17-2015 , 16:30   func_breakable
Reply With Quote #1

How can i catch when someone destroys a func_breakable? I need the player's name...
safetymoose is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 06-17-2015 , 18:02   Re: func_breakable
Reply With Quote #2

PHP Code:
#include <amxmodx>
#include <hamsandwich>

public plugin_init()
{
    
RegisterHam(Ham_Killed"func_breakable""CBreakable_Killed"true);
}

public 
CBreakable_Killed(thisiAttackerboolbGib)
{
    if(
is_user_connected(iAttacker))
    {
        new 
szName[32];
        
get_user_name(iAttackerszNamecharsmax(szName));
        
// szName[] now contains killer's name
    
}

Not tested, but should work I guess.

Last edited by klippy; 06-17-2015 at 18:03.
klippy is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-18-2015 , 04:14   Re: func_breakable
Reply With Quote #3

Killed is not called on this entity. Hook TakeDamage as post ; and check if pev_health is <= 0.
__________________
Arkshine is offline
safetymoose
Senior Member
Join Date: Feb 2015
Old 06-18-2015 , 04:34   Re: func_breakable
Reply With Quote #4

wow, all that trouble with ham killed and takedamage... And the solution was under my nose, setting takedamage as post...

Thanks Arkshine, you're a life saver
safetymoose is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 06-18-2015 , 05:21   Re: func_breakable
Reply With Quote #5

Quote:
Originally Posted by Arkshine View Post
Killed is not called on this entity. Hook TakeDamage as post ; and check if pev_health is <= 0.
Just saw there's no CBreakable::Killed(), and that it calls CBaseEntity::Killed() upon reaching 0 health instead (I think?). My bad.

Last edited by klippy; 06-18-2015 at 05:21.
klippy is offline
Reply


Thread Tools
Display Modes

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 11:57.


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