Jump to content

friendy fire


Castillo

Recommended Posts

Posted

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.

Posted

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.

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

Posted

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.

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

Posted
sweet, but tell me if setting this to true is working maybe?

if its true it means you can kill your team mates and false works but the problem is that it sets when it resource starts, maybe when player join would work too?

Posted

If you want to fully disable Friendly Fire, you should make this client-side and apply "onClientPreRender" event to set the friendly fire off all the time, or use setTimer function (if your script doesn't work, try it)...

Posted

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

Posted

nobody of you seems to understand (the last 2 persons) i have fixed it already, and what i wanted was to disable ALL teams friendy fire ;)

can close topic before it starts a fight :P

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

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