My idea was to make player teams which don't take any damage from their weapons only from enemy weps. How can I do it? Is it something like Ent:OnTakeDamage?
I don't understand your question, you clearly understood the concept behind this, but aren't you sure how to implement it or what
You will have to create a hook with hook.Add using the hook GM/PlayerShouldTakeDamage, checking on it if the attacker is a player via Entity/IsPlayer and, then check if both players have the same team via Player/Team, and if their team is the same, you will have to return false to prevent the players from taking the damage.
hook.Add( "PlayerShouldTakeDamage", "PlayerShouldTakeDamage:AvoidTeamDamage", function( victim, attacker )
if ( IsValid( victim ) && IsValid( attacker ) && victim:IsPlayer( ) && attacker:IsPlayer( ) ) then
local teamA = victim:Team( );
local teamB = attacker:Team( );
if ( teamA == teamB ) then
return false;
end
end
end );
Try this ;) made it for my gamemode.
Sorry, you need to Log In to post a reply to this thread.