Raised This Month: $ Target: $400
 0% 

How to avoid damage for players from my team?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Krtola
Veteran Member
Join Date: Oct 2013
Location: Serbia
Old 03-22-2017 , 14:40   How to avoid damage for players from my team?
Reply With Quote #1

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?
Krtola is offline
Send a message via Skype™ to Krtola
Depresie
Veteran Member
Join Date: Nov 2013
Old 03-22-2017 , 15:26   Re: How to avoid damage for players from my team?
Reply With Quote #2

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
    } 

__________________

Last edited by Depresie; 03-22-2017 at 15:30.
Depresie is offline
Krtola
Veteran Member
Join Date: Oct 2013
Location: Serbia
Old 03-22-2017 , 15:46   Re: How to avoid damage for players from my team?
Reply With Quote #3

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.
Krtola is offline
Send a message via Skype™ to Krtola
Reply



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 17:56.


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