AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How to avoid damage for players from my team? (https://forums.alliedmods.net/showthread.php?t=295327)

Krtola 03-22-2017 14:40

How to avoid damage for players from my team?
 
PHP Code:

HamRadiusDamage(entFloat:radiusFloat:damagebits
{
    new 
target 0Float:origin[3], Float:o[3], maxplayers get_maxplayers(), los g_losFloat:fakeorig[3]
    
pev(entpev_originorigin)

    new 
owner pev(entpev_owner)

    
xs_vec_copy(originfakeorig)
    
fakeorig[2] += 2.0

    
while(( target engfunc(EngFunc_FindEntityInSpheretargetoriginradius) )) 
    {  
        if (
maxplayers target)
            break

        if (!
is_user_alive(target))
            continue

        if (
target == owner)
            continue

        if (!
is_user_zombie(target))
            continue

        
pev(targetpev_origino

        if (
los && !is_in_los(fakeorigo))
            continue

        
xs_vec_sub(originoo

        if (
xs_vec_len(o) > radius
            continue 

        
Ham_ExecDamageB(targetentpev(entpev_owner), damage * ((1.0 - (xs_vec_len(o) / radius))*2.0), HIT_GENERICbits

        
Create_TE_BEAMENTSenttargetg_lightningSpr01510201525500255)
    }


As you can see there is check for zombie. But I delete that check because I will use this for public mod. But then I have problem:
The damage is done for enemy team but also for the players from my team.
How can I block this to doo damage to players from my team?

Depresie 03-22-2017 15:26

Re: How to avoid damage for players from my team?
 
PHP Code:

HamRadiusDamage(entFloat:radiusFloat:damagebits)  

    new 
target 0Float:origin[3], Float:o[3], maxplayers get_maxplayers(), los g_losFloat:fakeorig[3
    
pev(entpev_originorigin

    new 
owner pev(entpev_owner

    
xs_vec_copy(originfakeorig
    
fakeorig[2] += 2.0 

    
new iOwnerTeam get_user_team(owner)
    
    while(( 
target engfunc(EngFunc_FindEntityInSpheretargetoriginradius) ))  
    {   
        if (
maxplayers target
            break 

        if (!
is_user_alive(target)) 
            continue 

        if (
iOwnerTeam == get_user_team(target)) 
            continue 

        
pev(targetpev_origino)  

        if (
los && !is_in_los(fakeorigo)) 
            continue 

        
xs_vec_sub(originoo)  

        if (
xs_vec_len(o) > radius)  
            continue  

        
Ham_ExecDamageB(targetentpev(entpev_owner), damage * ((1.0 - (xs_vec_len(o) / radius))*2.0), HIT_GENERICbits)  

        
Create_TE_BEAMENTSenttargetg_lightningSpr01510201525500255
    } 



Krtola 03-22-2017 15:46

Re: How to avoid damage for players from my team?
 
Ok it work nice. I will use your code.

Anyway I just find code from napalm nade but ther is linux of set and stuff like that so i will stick with your code.


All times are GMT -4. The time now is 17:56.

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