(help)friendly gang peds

Hey, I’m not sure if this is working.

SetRelationshipBetweenGroups(5, GetHashKey(relations.groove), GetHashKey(relations.ballas)) --hate each other
SetRelationshipBetweenGroups(5, GetHashKey(relations.ballas), GetHashKey(relations.groove)) --hate each other
SetRelationshipBetweenGroups(1, GetHashKey(relations.groove), GetHashKey(relations.groove))
SetRelationshipBetweenGroups(1, GetHashKey(relations.ballas), GetHashKey(relations.ballas))

SetPedRelationshipGroupDefaultHash(ped, GetHashKey(relations.groove)) --relations.groove located in variables_c.lua
SetPedRelationshipGroupHash(ped, GetHashKey(relations.groove))

They are not shooting at me, but is it normal if I aim at them that they shoot me?
If thats normal, is there a way to stop it that they shoot at me if I aim at them

you have to trigger it each frame.
not just once.

you mean with a while or for loop?

“while” is a loop too :slight_smile:

try it with:

while true do
     Citizen.Wait(0)
     -- your code here
end

they are still attacking me if I aim at them

Citizen.CreateThread(function()
    local groove_randomspawn = {} local random_anim_hood = {}
    while true do
        Citizen.Wait(50)
        if ped_groove_hood.chiller_load == true then
            for i = 1, #ped_groove_hood.chiller, 1 do
                TriggerEvent("PedRelation", ped_groove_hood.chiller[i], 'groove')
            end
        end
    end
end)

AddEventHandler("PedRelation", function(ped, group)
    if group == "groove" then
        SetPedRelationshipGroupDefaultHash(ped, GetHashKey(relations.groove))
        SetPedRelationshipGroupHash(ped, GetHashKey(relations.groove))
        SetEntityCanBeDamagedByRelationshipGroup(ped, false, GetHashKey(relations.groove))
    elseif group == "ballas" then
        SetPedRelationshipGroupDefaultHash(ped, GetHashKey(relations.ballas))
        SetPedRelationshipGroupHash(ped, GetHashKey(relations.ballas))
        SetEntityCanBeDamagedByRelationshipGroup(ped, false, GetHashKey(relations.ballas))
    else return nil end
    SetRelationshipBetweenGroups(5, GetHashKey(relations.groove), GetHashKey(relations.ballas)) --hate each other
    SetRelationshipBetweenGroups(5, GetHashKey(relations.ballas), GetHashKey(relations.groove)) --hate each other
    SetRelationshipBetweenGroups(1, GetHashKey(relations.groove), GetHashKey(relations.groove))
    SetRelationshipBetweenGroups(1, GetHashKey(relations.ballas), GetHashKey(relations.ballas))
end)

Try it with Citizen.Wait(0)
I think you have to set the relations each frame

any updates to this, i have a mafia job that needs the ballas to be friendly with them