altv-issues icon indicating copy to clipboard operation
altv-issues copied to clipboard

Peds and set player into air vehicle crash

Open xxshady opened this issue 3 years ago • 9 comments

Description of the problem

Game crashes if you spawn more than 110 peds and put your player into any air vehicle, like hydra or maverick

Reproduction steps

  1. run the following code:
  2. spawn air vehicle, like hydra
  3. set your player into spawned vehicle with player.setIntoVehicle or native.setPedIntoVehicle
const { pos, model } = alt.Player.local

for (let i = 0; i < 110; ++i) {
  const coords = {
    x: pos.x + (Math.random() * 5.0),
    y: pos.y + (Math.random() * 5.0),
    z: pos.z,
  }

  const ped = native.createPed(
    0,
    model,
    coords.x,
    coords.y,
    coords.z,
    0,
    false, false,
  )
  native.freezeEntityPosition(ped, true) // without this line my game may crash 

  alt.log("created ped:", i)
  await alt.Utils.wait(0)
}

Expected behaviour

/

Additional context

No response

Operating system

Windows 11

Version

release/10.5

xxshady avatar May 23 '22 20:05 xxshady

Too many physics calculations cause the game to crash, same thing happens with objects etc. too

LeonMrBonnie avatar May 23 '22 20:05 LeonMrBonnie

the cause of this crash is player.setIntoVehicle

xxshady avatar May 23 '22 20:05 xxshady

upd: native.setPedIntoVehicle crashes too

xxshady avatar May 23 '22 20:05 xxshady

Can confirm it sometimes crashing on 110, but always between 110 - 120 Maybe dependend on the location where the peds are spawned (e.g. like having more or less physic calculations in that area as leon said?)

deluvas1911 avatar May 26 '22 09:05 deluvas1911

@deluvas1911 if this depends on physic calculations why doesn't putting a player in a car cause a crash? this crash is somehow related to air vehicle

xxshady avatar May 26 '22 10:05 xxshady

Shouldn't always type 2 be used for createPed?

FabianTerhorst avatar Jun 24 '22 15:06 FabianTerhorst

Shouldn't always type 2 be used for createPed?

no, xd https://discord.com/channels/371265202378899476/557307592129511444/978377544296435742

IMG_20220624_191202.jpg

xxshady avatar Jun 24 '22 16:06 xxshady

Have you tried delaying ped spawns? Like only one ped every second.

FabianTerhorst avatar Jun 24 '22 16:06 FabianTerhorst

i spawn them one ped per frame, there is await alt.Utils.wait(0) in repro code

xxshady avatar Jun 24 '22 17:06 xxshady

Fixed since some gta or alt:V update

xxshady avatar Jan 15 '24 17:01 xxshady