AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Hook entity damage [Half-Life] (https://forums.alliedmods.net/showthread.php?t=120858)

Flipper_SPb 03-08-2010 16:33

Hook entity damage [Half-Life]
 
How to hook the damage of entity with custom classname?
I use entity "item_flag". And I tried to catch the damage with
PHP Code:

RegisterHam(Ham_TakeDamage"item_flag""flag_damage"

Error: Failed to retrive classtype for "item_flag"

Flipper_SPb 03-08-2010 17:24

Re: Hook entity damage [Half-Life]
 
I need just detect of getting damage from trigger_hurt, without killing my entity.
Something like that:

PHP Code:


RegisterHam
(Ham_TakeDamage"item_flag""flag_damage"

.
.
.
.
.

public 
flag_damage(victiminflictorattackerFloat:damagedamage_type)
{
    new 
e_class[64]
    
entity_get_string(inflictorEV_SZ_classnamee_class63)
    
    if (
equal(e_class"trigger_hurt"))
    {
           
my_function()
    }
    return 
HAM_SUPERCEDE



ConnorMcLeod 03-09-2010 01:01

Re: Hook entity damage [Half-Life]
 
If item_flag is a custom entity you have to register ham forward with the original classname.


All times are GMT -4. The time now is 08:45.

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