Skip to content

Crash on entity wipe #2344

@ScrachStack

Description

@ScrachStack

What happened?

RegisterCommand("entitywipe", function()
    local playerPed = cache.ped
    local playerCoords = GetEntityCoords(playerPed)

    local radius = 20.0 

    local entityPool = GetGamePool('CPed')
    for i = 1, #entityPool do
        local distance = #(GetEntityCoords(entityPool[i]) - playerCoords)

        if distance < radius then
                DeleteEntity(entityPool[i])
            
        end
    end

    RedTrainer.Notify("Entity Wipe", "20.0 Radius Wiped.", 'info')
end, true)
``` this code causes a crash

### Expected result

entity should have wiped

### Reproduction steps

run command above

### Importancy

Crash

### Area(s)

RedM

### Specific version(s)

REDM GAME BUILD 1491 LATEST artifacts AS OF 1/16/2024

### Additional information

![image](https://github.com/citizenfx/fivem/assets/122732007/ebeacfa9-881f-4c3b-ae12-9832e043dee7)
[CfxCrashDump_2024_01_16_18_06_23.zip](https://github.com/citizenfx/fivem/files/13954192/CfxCrashDump_2024_01_16_18_06_23.zip)

Metadata

Metadata

Assignees

Labels

RedMIssues/PRs related to RedMbugcrash

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions