AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Radius damage with setting killer/attacker (https://forums.alliedmods.net/showthread.php?t=224923)

GuskiS 08-29-2013 16:31

Radius damage with setting killer/attacker
 
Is there a stock or funcion that does radius damage and where you can set attacker/killer id? I used radius_damage but it didn't work as planned. Any help appreciated.

EDIT: Or, provide me of any other explosion type something :D I need to hurt players in radius where player explodes. Currently I'm using stock with env_explosion found on forum, but it seems to work only for one round/explosion :/

RateX 08-30-2013 04:11

Re: Radius damage with setting killer/attacker
 
This is my radius damage script:
PHP Code:

public plugin_init()
{
    
register_touch("at4rocket""*""fw_rocket_touch")
}

public 
fw_rocket_touch(RocketEnttouch)
{
    if(!
pev_valid(RocketEnt))
        return    
        
    if(
is_user_alive(touch) && pev(RocketEntpev_owner) == touch)
        return
        
    static 
Float:Origin[3]
    
pev(RocketEntpev_originOrigin)    

    static 
owner
    
new FM_NULLENT
    owner 
pev(RocketEntpev_owner)
    new 
Float:aOrigin ]
    while((
find_ent_in_sphere(a,Origin,get_pcvar_float(cvar_radius))) != 0)
    {
        if(
pev(a,pev_takedamage)!=DAMAGE_NO)
        {
            if(
IsValidUser(a))
            {
                
pev apev_originaOrigin )
                new 
Float:flDistance get_distance_f OriginaOrigin )
                new 
Float:damage = (get_pcvar_float(cvar_damage)/get_pcvar_float(cvar_radius))*(get_pcvar_float(cvar_radius)-flDistance)
                if(
damage 0.0ExecuteHam(Ham_TakeDamageaownerownerdamageDMG_BULLET)    
            }
            else 
ExecuteHam(Ham_TakeDamageaownerownerget_pcvar_float(cvar_damage), DMG_BULLET)    
        }
    }        
    
engfunc(EngFunc_RemoveEntityRocketEnt

cvar_damage is max damage
cvar_radius is the radius that player(s) and entity take damage

GuskiS 08-30-2013 05:34

Re: Radius damage with setting killer/attacker
 
Sweet dude, works like a charm :) Thank you :)


All times are GMT -4. The time now is 19:09.

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