altmp / altv-issues

Issues and roadmap for alt:V project
92 stars 17 forks source link

LocalPed do not set his properties again after StreamOut/StreamIn and do not triggered EntityCreated to set it manually #2250

Closed M1raclee closed 4 months ago

M1raclee commented 4 months ago

Description of the problem

It is not possible to set native properties (invincible, ragdoll, freeze position, etc) for Ped permanently. It resets after stream out/stream in again this ped. Also, local ped do not call OnGameEntityCreate event to set properties manually. It doesn't allow you to set "Dumb" (static) mode for ped.

Reproduction steps

  1. Create any streaming ped, for example: var ped = Alt.CreateLocalPed((uint)PedModel.FreemodeMale01, 0, new Position(10, 10, 76), new Rotation(0, 0, 0), true, 100);
  2. Wait, until ScriptId will be > 0 (await)
  3. Change any property for ped, for example: ped.Frozen = true and/or Alt.Natives.SetEntityInvincible(ped.ScriptId, true)
  4. Get closer to ped to sync it
  5. Aim at ped to trigger running anim to ensure, that ped is frozen (it's really so at this step)
  6. Move out of the streaming area / change dimension to 1.
  7. Return back to ped
  8. Now ped is not frozen - aim again and Ped will run away

Expected behaviour

Cache and return back all params, that was set for ped after player see (stream in) Ped second time or, at least, trigger OnGameEntityCreate event for ped

Additional context

Tested on C# module (client and server)

Operating system

Windows 10

Version

16.0.0-dev.267

Crashdump ID

No response

Confirmation of issue's presence

FabianTerhorst commented 4 months ago

That's the expected bahavior and not a bug. We only persist the values setted from a altv api.

M1raclee commented 4 months ago
  1. ped.Frozen is not alt:v api, just wrapper for native call?
  2. how to set it manually, if OnGameEntityCreate doesn't triggered for ped? Is it any legal ways?
  3. where to find values, that you persist?
FabianTerhorst commented 4 months ago

LocalPed has no methods atm, so you should set own properties and set the natives again on stream in.