Jump to content

friendy fire


Castillo

Recommended Posts

hey, i got a big problem i want to disable the friendy fire for all teams but dunno why my code isn't working, if someone

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

thanks in advance.

Link to comment
Do you even put the players into a team?

I never worked with teams before, but I guess that they have to be all in the same team in the first place so that they can't shoot each other.

what do you mean? i just start the resource and that should disable it, if it works like you say then its useless cause i don't want to restart resource every time.

Link to comment

AFAIK players are in no team, when they join the server.

What you do is to say that players within a team can't kill each other.

But when the players are in no team, this has no effect on them.

So you should put all players into one team, this would be just one line in the "onPlayerJoin" event.

Link to comment
AFAIK players are in no team, when they join the server.

What you do is to say that players within a team can't kill each other.

But when the players are in no team, this has no effect on them.

So you should put all players into one team, this would be just one line in the "onPlayerJoin" event.

I don't get what do you mean, my mode works like this, you join you got a menu with many teams and when you click on one and click button of spawn it spawns you.

Link to comment

if u want it to start when someone join then

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

replaced onResourceStart with onPlayerJoin

Link to comment
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...