AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [HELP] ExecuteHam(Ham_TakeDamage) (https://forums.alliedmods.net/showthread.php?t=272870)

Depresie 10-08-2015 04:53

[HELP] ExecuteHam(Ham_TakeDamage)
 
so i this explosive flare grenade code, but for some reason it doesn't deal damage all the time, even tho the damage is printed in chat

PHP Code:

public flare_explode(entity)
{
    if (!
pev_valid(entity))
    {
        return
    }
    
    static 
Float:origin[3// 
    
pev(entitypev_originorigin)
    
    
create_blast2(origin)
     
    
explode(entityorigin)
     
    static 
attacker;
    
attacker pev(entitypev_owner)
     
    static 
victim
    victim 
= -1
     
    
while ((victim engfunc(EngFunc_FindEntityInSpherevictimoriginFloat:260.0)) != 0)
    {
        
// Only effect alive humans
        
if (!is_user_alive(victim) || !zp_core_is_zombie(victim) || zp_item_zombie_madness_get(victim))
            continue;
 
        static 
Float:orig[3], Float:dmgFloat:knockback[3]
        
pev(victimpev_originorig)
        
dmg get_pcvar_float(cvar_grenade_damage) - get_distance_f(originorig)
        
knockback[0] = get_pcvar_float(cvar_grenade_knockback) - get_distance_f(originorig) * 0.5
        knockback
[1] = get_pcvar_float(cvar_grenade_knockback) - get_distance_f(originorig) * 0.5
        knockback
[2] = get_pcvar_float(cvar_grenade_knockback) - get_distance_f(originorig) * 0.5
         
        ExecuteHamB
(Ham_TakeDamagevictimentityattackerdmg, (1<<24))
        
set_pev(victimpev_velocityknockback)
        static 
name[32]; get_user_name(victimnamecharsmax(name))
        
zp_colored_print(attacker"Damage to^x04 %s^x01 ::^x04 %0.0f damage"namedmg)
        
    }

    
// Get rid of the grenade
    
engfunc(EngFunc_RemoveEntityentity)
 



devilicioux 10-27-2015 09:28

Re: [HELP] ExecuteHam(Ham_TakeDamage)
 
PHP Code:

ExecuteHamB(Ham_TakeDamagevictimentityattackerdmg, (1<<24)) 

#1
Maybe you can try using some other stock code to deal damage to entities ?

#2
Try changing ExecuteHamB to ExecuteHam since using ExecuteHamB doesnt make much sense here as it is going to call all the similar hooks in other plugins as well which might be creating the issue..


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

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