Grand opening25% off everything with FAM-261023-261025-UL4B9this weekendTick it in your cart Halloween Edition36 maps, limited runlimited runShop the drop

FREE TOOL · SetRelationshipBetweenGroups

FiveM relationship groups editor

Set who likes and who hates whom across 43 of GTA 5’s own relationship groups, add factions of your own beside them, and copy out the AddRelationshipGroup and SetRelationshipBetweenGroups script. Every cell is one direction, because a relationship in this game is one direction — the Ballas can hate you while you are nothing to them, and that asymmetry is the thing almost every guide leaves out.

The six levels and their numbers come from Cfx.re natives — SET_RELATIONSHIP_BETWEEN_GROUPS. 26 of the group names are taken from the game’s own ped data in DurtyFree/gta-v-data-dumps — peds.json, where every ped model states the relationship group it is born into; the ped counts and example models on each row are counted from that file. The remaining 17 — PLAYER, the GANG_ slots, the MISSION scratch groups, HATES_PLAYER, DEALER, NO_RELATIONSHIP, SPECIAL and AGGRESSIVE_INVESTIGATE — are not any model’s default and so appear in no dump; those are listed from Cfx.re forum — the circulated relationship group table and tagged as such. The hashes are computed here with the same joaat implementation the hash calculator uses.

5 in the matrix · 43 of 43 listed

  • group table only
  • in the ped data
  • in the ped data
  • in the ped data
  • in the ped data
  • in the ped data
  • in the ped data
  • in the ped data
  • in the ped data
  • in the ped data
  • in the ped data
  • in the ped data
  • in the ped data
  • in the ped data
  • in the ped data
  • in the ped data
  • in the ped data
  • in the ped data
  • in the ped data
  • group table only
  • group table only
  • group table only
  • group table only
  • group table only
  • group table only
  • group table only
  • group table only
  • group table only
  • group table only
  • group table only
  • group table only
  • group table only
  • group table only
  • group table only
  • group table only
  • in the ped data
  • in the ped data
  • in the ped data
  • in the ped data
  • in the ped data
  • in the ped data
  • in the ped data
  • in the ped data

Pick a level, then click a cell. The row is who is doing the feeling and the column is who it is aimed at.

feelsaboutPLAYERCOPCIVMALEAMBIENT_GANG_BALLASAMBIENT_GANG_FAMILY
PLAYER
COP
CIVMALE
AMBIENT_GANG_BALLAS
AMBIENT_GANG_FAMILY

One-way relationships0

Every pairing in the matrix reads the same in both directions. That is a choice, not a default — the natives would happily let you set one side and leave the other, and a cell marked ≠ is where that has happened.

Client script — 0 groups added, 0 relationship calls

Client-side, once per resource start. The stop handler matters: without it a /restart leaves every relationship you set still in place on top of the ones you are about to set again.

local OWN_GROUPS = {

}

local LINKS = {

}

local function applyRelationships()
    for i = 1, #OWN_GROUPS do
        AddRelationshipGroup(OWN_GROUPS[i])
    end

    for i = 1, #LINKS do
        local level, from, to = LINKS[i][1], LINKS[i][2], LINKS[i][3]
        SetRelationshipBetweenGroups(level, GetHashKey(from), GetHashKey(to))
    end
end

local function undoRelationships()
    for i = 1, #LINKS do
        local level, from, to = LINKS[i][1], LINKS[i][2], LINKS[i][3]
        ClearRelationshipBetweenGroups(level, GetHashKey(from), GetHashKey(to))
    end

    for i = 1, #OWN_GROUPS do
        RemoveRelationshipGroup(GetHashKey(OWN_GROUPS[i]))
    end
end

AddEventHandler('onClientResourceStart', function(resource)
    if resource ~= GetCurrentResourceName() then return end
    applyRelationships()
end)

AddEventHandler('onClientResourceStop', function(resource)
    if resource ~= GetCurrentResourceName() then return end
    undoRelationships()
end)
Putting a ped you spawned into one of these groups

Client-side. Without the two SetPedRelationshipGroup calls this ped stays in its model's own group and ignores everything above.

local GROUP = GetHashKey('COP')

local function spawnInGroup(model, coords, heading)
    local hash = GetHashKey(model)
    RequestModel(hash)
    while not HasModelLoaded(hash) do Wait(0) end

    local ped = CreatePed(4, hash, coords.x, coords.y, coords.z, heading, false, true)
    SetModelAsNoLongerNeeded(hash)

    SetPedRelationshipGroupHash(ped, GROUP)
    SetPedRelationshipGroupDefaultHash(ped, GROUP)

    return ped
end

local guard = spawnInGroup('g_m_m_armboss_01', vector3(1395.9, 1141.7, 114.3), 180.0)
print(('group now: %s'):format(GetPedRelationshipGroupHash(guard)))

THE SCALE

Six levels, and 0 is the friendly end

The numbers run the opposite way to how people expect. Zero is the warmest setting and five is the most violent, so a bigger number is worse. The two in the middle are the ones worth thinking about: neutral is a real setting you can go back to, and dislike is almost always what somebody wanted when they typed 5.

  • 0Companion

    The strongest friendly setting. Companions behave as one side: they do not target each other, they come along into a fight, and a ped will take cover near a companion rather than near a stranger. This is the setting for a bodyguard and the person it is guarding.

  • 1Respect

    Friendly, one notch below companion. Peds who respect each other will not pick a fight and will weigh in when one of them is attacked, but they do not move as a unit. The usual setting between two departments on the same side without being the same crew.

  • 2Like

    Friendly and passive. They are glad to see each other and will not attack, but liking somebody is not defending them, so do not lean on this level to make a group come to the rescue.

  • 3Neutral

    No feeling either way. Neither side starts anything and neither side helps. This is the level to go back to when you want to undo a hostility, and it is where most pairings sit before you touch anything.

  • 4Dislike

    Hostile but not violent on sight. Peds who dislike each other posture, insult, shove and escalate if provoked. On a roleplay server this is the level that buys you atmosphere without a body count, and it is almost always the one people wanted when they reached for hate.

  • 5Hate

    Attack on sight, as far as the ped can perceive. Two groups that hate each other open fire the moment they see one another, across a street, with no player anywhere near. This is the setting behind every "my server turned into a war zone" thread.

  • 255Pedestrians

    The native reference lists 255 as "Pedestrians" next to the six numbered levels. It is not a seventh degree of friendliness on the same scale, and passing it where you meant 5 gives you no hostility and no error. Keep 0 to 5 in your scripts and only recognise 255 when you are reading a value back.

HOW TO USE IT

Two calls for a feud, one call for a grudge

A gang war is two calls. Pick the two groups in the matrix above, set both cells to hate, and you get this — the second line is not a copy-paste mistake, it is the other half of the relationship.

A real feud: both directions

Client-side, once. Both groups are the game's own, so there is nothing to add first.

local GROUPS = { 'AMBIENT_GANG_BALLAS', 'AMBIENT_GANG_FAMILY' }

CreateThread(function()
    SetRelationshipBetweenGroups(5, GetHashKey(GROUPS[1]), GetHashKey(GROUPS[2]))
    SetRelationshipBetweenGroups(5, GetHashKey(GROUPS[2]), GetHashKey(GROUPS[1]))
end)

And here is the same thing with one line removed, which is what most copied snippets actually do. The Ballas will shoot you on sight; your own ped has no opinion about them at all, so your character will not auto-aim at them, your bodyguards will not treat them as a threat, and nothing you own will return fire until it is shot at.

A one-way grudge: one direction only

Client-side. Legitimate when you mean it — this is how you make an ambush that the player's own entourage does not pre-empt.

CreateThread(function()
    SetRelationshipBetweenGroups(5, GetHashKey('AMBIENT_GANG_BALLAS'), GetHashKey('PLAYER'))
end)

THE USUAL BUG

Your ped is still in CIVMALE

This is the one that eats an evening. You add a group, you set it to hate PLAYER, you spawn a ped, and the ped stands there. Nothing is broken: the relationship you set applies to two groups, and your ped is in neither of them. Every ped model in the game declares a default relationship group in its own model data — 1,109 of the 1,109 models in the dump do, and 691 of those say CIVMALE. CreatePed honours that default, not your intention.

So the fix is one line after the spawn, and a second line that stops it being undone: SetPedRelationshipGroupHash puts the ped in your group now, and SetPedRelationshipGroupDefaultHash changes the group it falls back to. The ped snippet in the tool above writes both, filled in with whichever group you added. When a ped still misbehaves, print GetPedRelationshipGroupHash and compare it against the hash column on its row — the mismatch is usually the answer.

NOT THE SAME THING

Relationships, SetPedAsEnemy and SetCanAttackFriendly

Three different mechanisms get mixed up in forum answers, and picking the wrong one is why a fix works on the ped in front of you and on nothing else.

The relationship system is a rule about two groups. It is directional, it persists, and it applies to every ped in those groups including the ones that have not spawned yet. If you want a faction, this is the only one of the three that gives you one.

SetPedAsEnemy is a flag on one ped handle. It marks that single ped hostile and does not touch its relationship group at all — which you can see for yourself by reading the group back afterwards. It is the right tool for one ped in one scene, and the wrong tool for a gang, because the next ped you spawn knows nothing about it.

SetPedAsEnemy does not move the ped between groups

Client-side. Print the group after the flag and you will see it unchanged — which is the point.

local hash = GetHashKey('g_m_y_ballasout_01')
RequestModel(hash)
while not HasModelLoaded(hash) do Wait(0) end

local ped = CreatePed(4, hash, GetEntityCoords(PlayerPedId()) + vector3(4.0, 0.0, 0.0), 0.0, false, true)
SetModelAsNoLongerNeeded(hash)

SetPedAsEnemy(ped, true)

print(('still in group %s'):format(GetPedRelationshipGroupHash(ped)))

SetCanAttackFriendly changes neither the group nor the feeling. The game normally refuses to let a ped aim at somebody it is friendly with, and this native lifts that refusal for one ped. That is why it is the fix for a bodyguard that will not fire on a teammate, and why it does nothing whatsoever for a ped that already hates its target. Watch its third argument: the published note says passing it true alongside the toggle can leave the ped unable to aim even after you set the toggle back.

Native descriptions from SET_PED_AS_ENEMY and SET_CAN_ATTACK_FRIENDLY.

THE NATIVES

Seven calls, and what each one is for

Group names are case-insensitive, because GetHashKey lowercases the string before it hashes it. The game’s own ped data is inconsistent about it — it writes civmale in lower case and CIVFEMALE in upper — which matters not at all to the hash. This page prints them in upper case so the matrix reads; copy them in any case you like.

  • AddRelationshipGroup(name)

    Registers a group name so the game will accept relationships for it. The native writes the new group’s hash into an output parameter, and that hash is the joaat hash of the name you passed — which is why scripts simply call GetHashKey(name) afterwards and get the same number. Calling it again for a name that already exists is harmless.

  • SetRelationshipBetweenGroups(level, groupA, groupB)

    Sets how groupA feels about groupB. One direction only. The native reference says in as many words that it should be called twice, once for each group, and calling it once is the single most common relationship bug in FiveM.

  • ClearRelationshipBetweenGroups(level, groupA, groupB)

    Removes a relationship you set, and it takes the level as well as the two groups — you are clearing one specific setting, not the pairing. Also one direction at a time. Put it in your resource’s onResourceStop so a restart does not leave the world angry.

  • SetPedRelationshipGroupHash(ped, groupHash)

    Moves one ped into a group. Nothing you set with SetRelationshipBetweenGroups applies to a ped until the ped is in one of the two groups, and a freshly spawned ped is in whatever group its model defaults to — not in yours.

  • GetPedRelationshipGroupHash(ped)

    Reads the group a ped is in right now. Print it and compare it against the hash column on this page when a relationship is not behaving: nine times out of ten the ped is still in CIVMALE.

  • SetPedRelationshipGroupDefaultHash(ped, groupHash)

    Sets the group the ped falls back to, rather than the group it is in now. Worth knowing because some tasks and script events put a ped back to its default, and if you only set the current group the ped quietly changes sides.

  • RemoveRelationshipGroup(groupHash)

    Deletes a group you added. Only use it on your own groups, and only once nothing is left in one — what happens to a live ped whose group is removed is not described in the reference, so we are not going to tell you.

Signatures and the quoted behaviour from the Cfx.re native reference: ADD_RELATIONSHIP_GROUP, SET_RELATIONSHIP_BETWEEN_GROUPS, CLEAR_RELATIONSHIP_BETWEEN_GROUPS and SET_PED_RELATIONSHIP_GROUP_HASH.

QUESTIONS

About FiveM relationship groups

What are the FiveM relationship group levels and their numbers?
Six of them, and the numbers are what SetRelationshipBetweenGroups takes: 0 companion, 1 respect, 2 like, 3 neutral, 4 dislike, 5 hate. The native reference also lists 255 as "Pedestrians", which is not a seventh step on the same scale — pass 255 where you meant 5 and you get no hostility and no error message. The one that catches people out is the direction of the scale: 0 is the friendliest value and 5 is the most hostile, so a higher number is worse, not better.
Why does my spawned ped ignore SetRelationshipBetweenGroups?
Because the ped is not in your group yet. A ped created with CreatePed starts in the relationship group its model declares in the game's own ped data — 1,109 of the 1,109 models in the dump carry one, and 691 of them are plain CIVMALE. Setting a relationship between MY_GANG and PLAYER changes nothing about a ped that is still in CIVMALE. Call SetPedRelationshipGroupHash(ped, GetHashKey('MY_GANG')) after you spawn it, and SetPedRelationshipGroupDefaultHash as well so nothing puts it back.
Do I have to call SetRelationshipBetweenGroups twice?
Yes, if you want the feeling to run both ways — and the native reference says so in as many words. A relationship is directional: one call sets how group A feels about group B and says nothing at all about how B feels about A. That is the whole reason this page draws a matrix rather than a list of pairs. If you only want a one-way hostility, one call is correct and this tool will write exactly one.
What is the difference between SetRelationshipBetweenGroups and SetPedAsEnemy?
Scope and persistence. SetRelationshipBetweenGroups is a rule about two groups that applies to every ped in them, now and for every ped that joins them later. SetPedAsEnemy is a flag on one ped handle — it marks that single ped as an enemy and leaves its relationship group untouched, so it does nothing for the next ped you spawn and nothing for anybody else in the same gang. Use the relationship system for factions and SetPedAsEnemy for a one-off.
What does SetCanAttackFriendly actually do?
It removes a veto rather than changing a feeling. The game stops a ped from aiming at and shooting peds it is friendly with, and SetCanAttackFriendly lifts that block for one ped — the relationship stays exactly as it was, the ped is simply now allowed to shoot somebody it likes. That is why it is the native people reach for when a bodyguard refuses to fire on a teammate. Its second argument is the part to be careful with: the published note says setting it true alongside the toggle can leave the ped unable to aim even after you set it back.
How many relationship groups does GTA 5 have?
This page lists 43 and tells you where each one came from. 26 of them are in the game's own ped data, which is the strongest kind of evidence: a ped model names the group it is born into. The other 17 — PLAYER, the numbered GANG_ slots, the MISSION scratch groups, HATES_PLAYER and friends — appear in the group table that circulates on the Cfx.re forum but are never a ped model's default, so no dump will show them. We have labelled both rather than merging them into one confident list.
Why did my whole server turn into a war zone?
Almost always because a hostility landed on CIVMALE or CIVFEMALE. Those two groups hold 966 of the 1,109 ped models in the game, so making anything hate "civilians" makes it hate nearly every pedestrian that spawns. The second cause is reaching for 5 when 4 was what you wanted: dislike gives you shoving and shouting, hate gives you gunfire on sight at perception range, with no player involved.

ALSO FREE

Tools that go with this one

Picked because they touch the same files, natives or part of the game.

FROM THE SHOP

What we build when it is not free

The free tools and the paid work come out of the same place. These are the lines closest to what this page is about.

Grand opening: 25% off every product with FAM-261023-261025-UL4B9, until 25 October. It is applied at checkout.

A pistol model from the weapon library, rendered with custom artwork on the slide
Weapon skins

Weapon skins for FiveM

Put your own artwork on any model in the library and export it as its own resource, inventory icons cut to match. The first one costs nothing.

Free538 weapon modelsOpen the weapon library
Orange EMBER FiveM-compatible minimap for GTA 5 — google style — showing Los Santos street detail
Minimaps

Minimaps for FiveM

Twelve colour palettes across three base map styles, each one a drop-in resource. Add your logo and your district labels in the editor.

From $8.0036 finished mapsBrowse the minimaps
The Onyx weapon wheel design in polished black glass, drawn over the game HUD
Weapon wheels

Weapon wheels for FiveM

A native hud.gfx replacement rather than an NUI overlay, so it costs no frame time. Colours, shape and motion are yours before you pay.

From $15.0050 wheel designsBrowse the wheels