Bean666 Posted April 29, 2015 Posted April 29, 2015 hi , is it possible for 2 different teams will not be able to kill each other? example : SWAT and Army are 2 different teams. is it possible that they will not be able to kill each other while they are on a different team.
Mr.unpredictable. Posted April 29, 2015 Posted April 29, 2015 yes it is possible, create a friendly fire script.
Walid Posted April 29, 2015 Posted April 29, 2015 (edited) hi , is it possible for 2 different teams will not be able to kill each other?example : SWAT and Army are 2 different teams. is it possible that they will not be able to kill each other while they are on a different team. yes it's , just check player team onClientPlayerDamage () example: addEventHandler("onClientPlayerDamage", localPlayer, function(attacker) if (attacker and getElementType(attacker) == "player" and attacker ~= source) then if (getTeamName(getPlayerTeam(attacker)) == "SWAT") and (getTeamName(getPlayerTeam(source)) == "Army") then cancelEvent() end end end ) Edited April 29, 2015 by Guest
TAPL Posted April 29, 2015 Posted April 29, 2015 ^ One 'end' is missing. What about if the attacker was in Army and the source was in SWAT? it won't work then.
Walid Posted April 29, 2015 Posted April 29, 2015 ^One 'end' is missing. What about if the attacker was in Army and the source was in SWAT? it won't work then. @TAPL it's just an example he can do the same thing attacker team will be Army , and source team will be SWAT
Mr.unpredictable. Posted April 29, 2015 Posted April 29, 2015 try this local flist = { ["SWAT"] = "Army", ["Army"] = "SWAT" } addEventHandler("onClientPlayerDamage", localPlayer, function(attacker) if attacker and getElementType(attacker) == "player" then local sTeam = getPlayerTeam(localPlayer) --------- swat team local aTeam = getPlayerTeam(attacker) --------- army team if aTeam and sTeam and flist[getTeamName(sTeam)] == getTeamName(aTeam) then cancelEvent() end end end ) but there is one problem both the team will still be able to kill with knife. you can use onClientPlayerStealthKill to fix it.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now