Jump to content

[HELP]How to Team not get shot damage


Black2

Recommended Posts

You cana chieve this by using the OnClientPlayerDamage. The event returns the following parameters;

element attacker, int weapon, int bodypart [, float loss ]

all you have to do is create a simple check to see if there is a weapon (weapon id 0 is used for fist damage).

addEventHandler ( "onClientPlayerDamage", root, 
    function ( _, weapon ) 
        if ( weapon and weapon ~= 0 and getTeamName ( getPlayerTeam ( localPlayer ) ) == "PotatoTeam" ) then 
            cancelEvent(); 
        end 
    end 
); 

You might have to try and hit a player using a tank, I'm not sure if it returns a weapon. It might return weapon id 255, if that's the case. Then just add a new part to the if-statement; 'and weapon ~= 255'.

Link to comment
You cana chieve this by using the OnClientPlayerDamage. The event returns the following parameters;

element attacker, int weapon, int bodypart [, float loss ]

all you have to do is create a simple check to see if there is a weapon (weapon id 0 is used for fist damage).

addEventHandler ( "onClientPlayerDamage", root, 
    function ( _, weapon ) 
        if ( weapon and weapon ~= 0 and getTeamName ( getPlayerTeam ( localPlayer ) ) == "PotatoTeam" ) then 
            cancelEvent(); 
        end 
    end 
); 

You might have to try and hit a player using a tank, I'm not sure if it returns a weapon. It might return weapon id 255, if that's the case. Then just add a new part to the if-statement; 'and weapon ~= 255'.

Tank fires a projectile so you use the Id 59(tank grenade id) or 51 (explostion id - you should use this if you want to cancel event from all types of explostion other wise don't use this)

Link to comment

To avoid the other damage being cancelled, you can use an additional check;

if ( weapon > 46 ) then 
    return; 
end 

You can also extend your if-statement;

if ( weapon and weapon ~= 0 and weapon < 47 and getTeamName ( getPlayerTeam ( localPlayer ) ) == "PotatoTeam" ) then 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...