ArcAngeL

Can not disable friendyfire for teams

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

 

Share this post


Link to post

Are you sure this code has been executed last?

 

 

Share this post


Link to post

Yes IIYAMA. Really its likr a bug.friendyfire is saved.i did restart server and again teams cant kill each other. 

Share this post


Link to post

@ArcAngeL

Just to be sure:

/start runcode

/srun setTeamFriendlyFire ( root, false )

 

 

Share this post


Link to post
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

Share this post


Link to post

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.