Jump to content

Anti-Team kill


goofie88

Recommended Posts

hello I wanted to make an anti-team kill but it's not working :/

  
function team ( attacker, weapon, bodypart, loss ) 
       local attacker = getPlayerTeam ( source )           
       local victim = getPlayerTeam ( attacker ) 
           if ( attacker == victim) then 
           cancelEvent () 
          end 
end 
addEventHandler ( "onPlayerDamage", getRootElement (), team ) 
  

Link to comment

hello sorry for bump but I have a problem with teamkill when used with medic, seems friendlyfire disabled any hit and now you cant heal with flowers :/

here's medic script

Client

function stopDamage ( theplayer , attacker, weapon, bodypart ) 
            cancelEvent() 
    end 
addEventHandler ( "onClientPlayerDamage", getLocalPlayer(), stopDamage ) 

Server

function heal (attacker, attackerweapon, bodypart, loss) 
  hp = getElementHealth (source) 
        if (attackerweapon == 14) and (loss > 1) and ( hp < 99 ) then 
          setElementHealth ( source, hp + 15 )  
      end 
end 
addEventHandler ("onPlayerDamage", getRootElement(), heal ) 

and how to make friendlyfire for 2 teams, exemple if team A shoot team B then no damage

Link to comment

Triple-post again and we will take actions.

Friendly fire means shooting team members. You can't simply disable friendly fire for members of 2 teams because members of other team are not "friends" (where the name comes from "friendly fire").

You cancel onClientPlayerDamage, why would you expect to receive any damage including flower damage? Think about it.

Link to comment
  • 5 years later...

Tenho essa funçao de Ant-Kill,mais ela é por Team queria passar para Acl,como faço ?

function createTeamsOnStart ()
local allTeams = getElementsByType ( "team" )
for index, theTeam in ipairs(allTeams) do
    if ( getTeamFriendlyFire ( theTeam ) == true ) then
        setTeamFriendlyFire ( theTeam, false )
    end
end
end
addEventHandler("onResourceStart", resourceRoot, createTeamsOnStart)

Link to comment
11 minutes ago, FeniXMTA said:

Tenho essa funçao de Ant-Kill,mais ela é por Team queria passar para Acl,como faço ?

function createTeamsOnStart ()
local allTeams = getElementsByType ( "team" )
for index, theTeam in ipairs(allTeams) do
    if ( getTeamFriendlyFire ( theTeam ) == true ) then
        setTeamFriendlyFire ( theTeam, false )
    end
end
end
addEventHandler("onResourceStart", resourceRoot, createTeamsOnStart)

team = createTeam("MINHA TEAM", 255, 165, 0)

addEventHandler("onPlayerLogin", root,
function()
    local account = getAccountName(getPlayerAccount(source))

    if (isObjectInACLGroup("user." ..account, aclGetGroup("teamName"))) then -- "teamName" é o nome do seu grupo que você criou na acl.
        setPlayerTeam(source, team)
        setTeamFriendlyFire(team, false)
    end
end)

addEventHandler("onPlayerLogout", root,
function()
    setPlayerTeam(source, nil)
end)

 

Edited by MUR1LLO
Link to comment

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