[HELP][PVP] TeamKill

Hi, I am the owner of an Italian PVP server that averages 200/300 players per day, my match system included the possibility of NOT teamkilling, several players reported this BUG to me (see attached clip). I found the problem and it was the use of this native = SetPedRelationshipGroupHash, below an explanation of the use I made of it. My question is how can it be that a native will change my hitboxes ?, second question is there another native that I can use as a replacement? to avoid teamkill. Thank you.

–At the beginning of the script

   _, group1Hash = AddRelationshipGroup("A")
   _, group2Hash = AddRelationshipGroup("B")

   SetRelationshipBetweenGroups(5, group1Hash, group2Hash)
   SetRelationshipBetweenGroups(5, group2Hash, group1Hash)

–A

t the start of each match, based on your team, you set the group you belong to

    if TeamName == "A" then
        SetPedRelationshipGroupHash(PlayerPedId(), group1Hash)
    elseif TeamName == "B" then
        SetPedRelationshipGroupHash(PlayerPedId(), group2Hash)
    end
1 Like

Try this…

if TeamName == "A" then
    local ped = PlayerPedId()
    SetPedRelationshipGroupHash(ped, group1Hash)
    SetEntityCanBeDamagedByRelationshipGroup(ped, false, group1Hash)
elseif TeamName == "B" then
    local ped = PlayerPedId()
    SetPedRelationshipGroupHash(ped, group2Hash)
    SetEntityCanBeDamagedByRelationshipGroup(ped, false, group2Hash)
end

SetEntityCanBeDamagedByRelationshipGroup - Natives @ Cfx.re Docs