Jump to content

Can not disable friendyfire for teams


ArcAngeL

Recommended Posts

Hello Guys

ı was enabled friendlyfire for some tests but now ı deleted friendlyfire.But still teams cant kill each other.and ı maked some codes but still teams cant kill each other.what can ı do for this  ? 

local allTeams = getElementsByType ( "team" )
for index, theTeam in ipairs(allTeams) do
	if ( getTeamFriendlyFire ( theTeam ) == true ) then
		setTeamFriendlyFire ( theTeam, false )
	end
end

 

Link to comment

You can make your own Friendlyfire code tho which is going to be client sided.

 

function friendlyFire (attacker)
  if (isElement(source)) and (isElement(attacker)) and (getElementType(attacker) == "player") and (getElementType(source) == "player") then
  local aTeam = getPlayerTeam(attacker)
  local sTeam = getPlayerTeam(source)
  if (aTeam == sTeam) then
    cancelEvent()
   end
  end
end
addEventHandler("onClientPlayerDamage", root, friendlyFire)

 

 

Edited by UDC
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...