Castillo Posted September 25, 2010 Share Posted September 25, 2010 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
dzek (varez) Posted September 26, 2010 Share Posted September 26, 2010 You have already created topic about this, You didnt say if advice from this post was working or not (i mean, set FF to true) Link to comment
MaddDogg Posted September 26, 2010 Share Posted September 26, 2010 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. Link to comment
Castillo Posted September 26, 2010 Author Share Posted September 26, 2010 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
MaddDogg Posted September 26, 2010 Share Posted September 26, 2010 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
Castillo Posted September 26, 2010 Author Share Posted September 26, 2010 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
dzek (varez) Posted September 26, 2010 Share Posted September 26, 2010 dont ignore my reply again Link to comment
Castillo Posted September 26, 2010 Author Share Posted September 26, 2010 dont ignore my reply again Sorry varez, i totally forgot about my old topic (i'm not lying) Link to comment
dzek (varez) Posted September 26, 2010 Share Posted September 26, 2010 sweet, but tell me if setting this to true is working maybe? Link to comment
Castillo Posted September 26, 2010 Author Share Posted September 26, 2010 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? Link to comment
dzek (varez) Posted September 26, 2010 Share Posted September 26, 2010 and false works so it works or not? i dont get you now.. Link to comment
Castillo Posted September 26, 2010 Author Share Posted September 26, 2010 and false works so it works or not? i dont get you now.. well i will test on public server tomorrow when i get more players Link to comment
12p Posted September 27, 2010 Share Posted September 27, 2010 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)... Link to comment
[DMC] Posted September 27, 2010 Share Posted September 27, 2010 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
Castillo Posted September 27, 2010 Author Share Posted September 27, 2010 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 Link to comment
Recommended Posts