@@ -251,6 +251,9 @@ void CClientPed::Init(CClientManager* pManager, unsigned long ulModelID, bool bI
251251 // Init the local player
252252 _CreateLocalModel ();
253253
254+ // Init default analog control states
255+ CClientPad::InitAnalogControlStates ();
256+
254257 // Give full health, no armor, no weapons and put him at a safe location
255258 SetHealth (GetMaxHealth ());
256259 SetArmor (0 );
@@ -2705,6 +2708,10 @@ void CClientPed::StreamedInPulse(bool bDoStandardPulses)
27052708 return ;
27062709 }
27072710
2711+ // Re-create ped
2712+ if (m_shouldRecreate)
2713+ ReCreateGameEntity ();
2714+
27082715 // Grab some vars here, saves getting them twice
27092716 CClientVehicle* pVehicle = GetOccupiedVehicle ();
27102717
@@ -3974,11 +3981,7 @@ void CClientPed::_ChangeModel()
39743981 {
39753982 // ChrML: Changing the skin in certain cases causes player sliding. So we recreate instead.
39763983
3977- // Kill the old player
3978- _DestroyModel ();
3979-
3980- // Create the new with the new skin
3981- _CreateModel ();
3984+ m_shouldRecreate = true ;
39823985 }
39833986
39843987 // ReAttach satchels
@@ -4012,11 +4015,7 @@ void CClientPed::ReCreateModel()
40124015 m_pLoadedModelInfo->ModelAddRef (BLOCKING, " CClientPed::ReCreateModel" );
40134016 }
40144017
4015- // Destroy the old model
4016- _DestroyModel ();
4017-
4018- // Create the new model
4019- _CreateModel ();
4018+ m_shouldRecreate = true ;
40204019
40214020 // Remove the reference we temporarily added again
40224021 if (bSameModel)
@@ -4026,6 +4025,20 @@ void CClientPed::ReCreateModel()
40264025 }
40274026}
40284027
4028+ void CClientPed::ReCreateGameEntity ()
4029+ {
4030+ if (!m_shouldRecreate || !m_pPlayerPed)
4031+ return ;
4032+
4033+ // Destroy current game entity
4034+ _DestroyModel ();
4035+
4036+ // Create the new game entity
4037+ _CreateModel ();
4038+
4039+ m_shouldRecreate = false ;
4040+ }
4041+
40294042void CClientPed::ModelRequestCallback (CModelInfo* pModelInfo)
40304043{
40314044 // If we have a player loaded
0 commit comments