How to enable friendly fire in a way certain people can kill you and others cant?

Is it possible to have friendly fire for instance
If you are on Team A you can kill Team B but not members of Team A, and Team B cannot kill members of Team B but able to kill Team A

Like a team deathmatch type of friendly fire?

I know you can use

NetworkSetFriendlyFireOption(true)
SetCanAttackFriendly(playerPed, true, true)

But how would it be able to be non-exploitable? yet still work in a team deathmatch way

Possibly using these natives?
https://runtime.fivem.net/doc/reference.html#_0x66B57B72E0836A76
https://runtime.fivem.net/doc/reference.html#_0xBF1CA77833E58F2C

Or using these?
https://runtime.fivem.net/doc/reference.html#_0x0299FA38396A4940
https://runtime.fivem.net/doc/reference.html#_0x37039302F4E0A008

1 Like

Someone said these should work

SET_ENTITY_CAN_BE_DAMAGED_BY_RELATIONSHIP_GROUP #
// 0xE22D8FDE858B8119 0x34165B5D
// SetEntityCanBeDamagedByRelationshipGroup
void SET_ENTITY_CAN_BE_DAMAGED_BY_RELATIONSHIP_GROUP(Entity entity, BOOL bCanBeDamaged, int relGroup);
SET_ENTITY_ONLY_DAMAGED_BY_RELATIONSHIP_GROUP #
// 0x7022BD828FA0B082 0x202237E2
// SetEntityOnlyDamagedByRelationshipGroup
void SET_ENTITY_ONLY_DAMAGED_BY_RELATIONSHIP_GROUP(Entity entity, BOOL p1, Any p2);
PED
ADD_RELATIONSHIP_GROUP #
// 0xF372BC22FCB88606 0x8B635546
// AddRelationshipGroup
Any ADD_RELATIONSHIP_GROUP(char* name, Hash* groupHash);
Can’t select void. This function returns nothing. The hash of the created relationship group is output in the second parameter.
CLEAR_RELATIONSHIP_BETWEEN_GROUPS #
// 0x5E29243FB56FC6D4 0x994B8C2D
// ClearRelationshipBetweenGroups
void CLEAR_RELATIONSHIP_BETWEEN_GROUPS(int relationship, Hash group1, Hash group2);

But aren’t they for NPCs?

Apparently not:

1 Like