Spawned Human Peds Going Aggressive Crash Client with OneSync - lemon-salami-california

Very reproducible client crash with OneSync after spawned human ped goes aggressive from another player trigger

Client

Using canary? Canary and Release
Windows version: Win 10
System specifications: (Been replicated across various PCs and clients)

Server

Operating system: Win 10
Artifact version: 5049 (ongoing for a while, doesn’t seem to matter)
IP address:
Resources: minimal - base RedM setup
System specifications: N/A

Incident

Summary: Spawned human peds, capable of aggression, will crash the player that spawned them when another player aggro’s the ped. Interesting thing is that the ped aims at the player that spawned it, but not the player that aggro’s it.
Expected behavior: No client crash
Actual behavior: Client crash with OneSync
Steps to reproduce: OneSync enabled. Easy to replicate with two players, cl2 or otherwise. Player 1 spawns a human ped networked that can be aggressive (if they don’t have a weapon by default, give them a weapon). Player 2 then aggro’s (shoots, punches, knifes, etc.) the ped spawned by Player 1. Player 1 crashes immediately with lemon-salami-california.
Server/Client? Client crash
Files for repro (if any):
Error screenshot (if any):
.dmp files/report IDs: lemon-salami-california
CfxCrashDump_2021_12_15_02_13_46.zip (2.1 MB)

Any additional info:

RegisterCommand("spawnnpc", function(source, args, rawCommand)
  Citizen.CreateThread(function()
    local playerCoords = GetEntityCoords(PlayerPedId())
    local npc = {
        model = 'MP_U_M_M_LEGENDARYBOUNTY_09',
        coords = playerCoords + 1
    }
    spawnNpc(npc)
  end)
end)

local spawnedPeds = {}
function spawnNpc(npc)
    local model = GetHashKey(npc.model)
    RequestModel(model)
    while not HasModelLoaded(model) do
        Wait(50)
    end
    local createdped = 0
    while createdped == 0 do
        local heading = 0
        createdped = CreatePed(model,  npc.coords.x, npc.coords.y , npc.coords.z, heading, true, true, false, false)
        Wait(500)
    end
    Citizen.InvokeNative(0x283978A15512B2FE, createdped, true) -- SetRandomOutfitVariation
    table.insert(spawnedPeds,{ped = createdped})
    SetModelAsNoLongerNeeded(model)
end
2 Likes

Still occurring with 5104 and Release or Canary. New crash dump
CfxCrashDump_2021_12_17_05_09_56.zip (2.0 MB)

2 Likes

ive had the same problem on some scripts but other scripts dont have the problem at all, it is extremely weird. i dont think a solution has been found to this problem yet. i really hope it gets looked into.

Is there any new information on this bug?

This remains an issue

1 Like

Localized the problem, working on a fix.

UPD1: fix was implemented, testing across various game scenarios to ensure stability.
UPD2: fix was tested in multiple scenarios including very extreme. Pending PR review & merge.

3 Likes

I LOVE you @Disquse

Interesting thing is that the ped aims at the player that spawned it, but not the player that aggro’s it.

This was is a different issue, it also works in the same broken way with population peds when they target players in combat (not in melee, however). However I found and fixed it as well, going to be tested a bit more before PR’ing since this change may affect other game systems.

UPD: PR’ed the fix, hope it won’t break anything, was testing it for a while.

4 Likes
2 Likes

I can confirm that this appears to be working completely as expected now. NPC Ped now only targets the aggressive Player and there are no longer any crashes that I can create.

Thanks as always for all the work you put in to maintain RedM and continuing to upgrade it with features like OneSync!

1 Like