Black2 Posted May 22, 2015 Share Posted May 22, 2015 Hello,I was wondering how do I not receive team shot damage,but continue to receive other types of damage.Thx Link to comment
tosfera Posted May 22, 2015 Share Posted May 22, 2015 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
Mr.unpredictable. Posted May 22, 2015 Share Posted May 22, 2015 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
tosfera Posted May 22, 2015 Share Posted May 22, 2015 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now