1. Sign up for news, events and more!

    You're currently visiting the official DarkRP Forums as a guest. Sign up now to participate in our community and we'll let you know when we have news.

How to close FF for specific jobs in DarkRP

Discussion in 'DarkRP Modding Questions & Help' started by Victor Hugo, Sep 10, 2017.

  1. Victor Hugo

    Victor Hugo New Member

    I would like to close FF for specific jobs in my server.
    Not like just Citizens only i am making an Army for MilitaryRP
  2. Sir Klutch

    Sir Klutch Active Member

    Code (Lua):

    local tFriendly = {
        [TEAM_US] = {
            [TEAM_GERMANY] = true,
            [TEAM_US] = true
        }, -- US cannot damage Germany or the US

        [TEAM_GERMANY] = {
            [TEAM_US] = true
        }, -- Germany cannot damage the US

        [TEAM_RUSSIA] = {
            [TEAM_CHINA] = true
        } -- Russia cannot damage China

    hook.Add("EntityTakeDamage", "friendly_fire", function(pVictim, dmg)
        local tAttacker = dmg:GetAttacker()

        if tAttacker:IsPlayer() then
            local tRelationship = tFriendly[pVictim:Team()]

            if tRelationship ~= nil and tRelationship[tAttacker:Team()] then
                return true
    Richard Hammer likes this.

Share This Page