Jump to content

Can not disable friendyfire for teams


ArcAngeL

Recommended Posts

Posted

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

 

  • Moderators
Posted

Are you sure this code has been executed last?

 

 

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

  • Moderators
Posted

@ArcAngeL

Just to be sure:

/start runcode

/srun setTeamFriendlyFire ( root, false )

 

 

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

Posted (edited)

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

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