Jump to content

Friendly Fire


Klesh

Recommended Posts

Posted

I was reading on wiki.mta about friendly fire teams but the code on wiki no works;

addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), 
function () 
local allTeams = getElementsByType ( "team" ) 
for index, theTeam in ipairs(allTeams) do 
        setTeamFriendlyFire ( theTeam, false ) 
    end 
end) 

Thanks for Any help.

  • Discord Moderators
Posted

Could it be the teams are not created prior to this?

Posted

The Teams are created, but i put the scrip on folder with meta and that, but nothing.

And im trying to do no only a friendlyfire for team, for any player, i mean any player cant kill another player.

Posted

Disable the friendly fire for every team?

team1 = createTeam(text,r,g,b) 
setTeamFriendlyFire(team1,false) 

I had problems in the past setting for all the teams.

Posted

You mean a script with this?

friendlyfire.lua?

i was do, but not works and the are created in the server with a gamemode.

Thanks for any help.

Posted

The Friendly cant be true right, becuase this desactivates, i try all but nothing work, some help about how can disable friendly for all, any player cant damage another one.

Thanks for any help.

Posted

Sorry for Spam.

The code is the same from wiki.

addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), 
function () 
local allTeams = getElementsByType ( "team" ) 
for index, theTeam in ipairs(allTeams) do 
        setTeamFriendlyFire ( theTeam, false ) 
    end 
end) 

Teams created by a gamemode.

Citizens

Private Corp.

[s.T.A.R.S]

Girls

Tested, doesn t works!

Posted
Citizens = createTeam(text,r,g,b) 
[S.T.A.R.S] = createTeam(text,r,g,b) 
Private Corp = createTeam(text,r,g,b) 
Girls = createTeam(text,r,g,b) 
setTeamFriendlyFire(citizens,false) 
setTeamFriendlyFire([S.T.A.R.S],false) 
setTeamFriendlyFire(Private Corp,false) 
setTeamFriendlyFire(Girls,false) 
end) 

There is one, but the problem is how to enable for all friendly fire nobody cant kill another.

  • Discord Moderators
Posted

Oh you want to enable friendly fire for all teams?

addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), 
function () 
local allTeams = getElementsByType ( "team" ) 
for index, theTeam in ipairs(allTeams) do 
        setTeamFriendlyFire ( theTeam, true ) 
    end 
end) 

Posted
  
    Citizens = createTeam(text,r,g,b) 
    [S.T.A.R.S] = createTeam(text,r,g,b) 
    Private Corp = createTeam(text,r,g,b) 
    Girls = createTeam(text,r,g,b) 
    setTeamFriendlyFire(citizens,false) 
    setTeamFriendlyFire([S.T.A.R.S],false) 
    setTeamFriendlyFire(Private Corp,false) 
    setTeamFriendlyFire(Girls,false) 
    end) 
  

i found 7 syntax errors here, you should reread wiki.

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