Jump to content

Help


Focker

Recommended Posts

That will only prevent team members from attacking each others, not from being attacked and damaged by other teams. To protect a team from others you can disable damage for it's members by cancelling the event.

function protect_team(attacker, weapon, bodypart) 
    if not getPlayerTeam(source) or getPlayerTeam(source) ~= getTeamFromName("TEAM_NAME") then return end 
        cancelEvent() -- Cancel otherwise 
end 
addEventHandler("onClientPlayerDamage", localPlayer, protect_team) 

Updated

Edited by Guest
Link to comment

You have an extra end. And you don't need to check if source is not the localPlayer as the event is only attached to the localPlayer.

function protect_team(attacker, weapon, bodypart) 
    if getPlayerTeam(source) and getPlayerTeam(source) == getTeamFromName("TEAM_NAME") then 
        cancelEvent() 
    end 
end 
addEventHandler("onClientPlayerDamage", localPlayer, protect_team) 

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...