Fix player stuck when chaning skin

This commit is contained in:
Grinch_ 2021-10-17 23:47:01 +06:00
parent 53c75ab407
commit 196d154c79
3 changed files with 9 additions and 5 deletions

8
.vscode/launch.json vendored
View File

@ -8,10 +8,10 @@
"name": "Launch SA",
"type": "cppvsdbg",
"request": "launch",
"program": "C:/Work/GTASanAndreas/gta_sa.exe",
"program": "F:/GTASanAndreas/gta_sa.exe",
"args": [],
"stopAtEntry": false,
"cwd": "C:/Work/GTASanAndreas/",
"cwd": "F:/GTASanAndreas/",
"environment": [],
"console": "internalConsole"
},
@ -19,10 +19,10 @@
"name": "Launch VC",
"type": "cppvsdbg",
"request": "launch",
"program": "F:/GTA Vice City/gta-vc.exe",
"program": "E:/GTA Vice City/gta-vc.exe",
"args": [],
"stopAtEntry": false,
"cwd": "C:/Work/GTASanAndreas/",
"cwd": "F:/GTASanAndreas/",
"environment": [],
"console": "internalConsole"
},

View File

@ -300,7 +300,7 @@ void Player::ChangePlayerModel(std::string& model)
CStreaming::LoadAllRequestedModels(true);
player->SetModelIndex(291);
CStreaming::SetSpecialCharIsDeletable(291);
}
else
@ -312,6 +312,7 @@ void Player::ChangePlayerModel(std::string& model)
player->SetModelIndex(imodel);
CStreaming::SetModelIsDeletable(imodel);
}
Util::ClearCharTasksVehCheck(player);
}
}
#elif GTAVC

View File

@ -72,11 +72,13 @@ void Util::ClearCharTasksVehCheck(CPed* ped)
uint hped = CPools::GetPedRef(ped);
uint hveh = NULL;
bool veh_engine = true;
float speed;
if (ped->m_nPedFlags.bInVehicle)
{
hveh = CPools::GetVehicleRef(ped->m_pVehicle);
veh_engine = ped->m_pVehicle->m_nVehicleFlags.bEngineOn;
speed = ped->m_pVehicle->m_vecMoveSpeed.Magnitude() * 50.0f;
}
Command<Commands::CLEAR_CHAR_TASKS_IMMEDIATELY>(hped);
@ -85,6 +87,7 @@ void Util::ClearCharTasksVehCheck(CPed* ped)
{
Command<Commands::TASK_WARP_CHAR_INTO_CAR_AS_DRIVER>(hped, hveh);
ped->m_pVehicle->m_nVehicleFlags.bEngineOn = veh_engine;
Command<Commands::SET_CAR_FORWARD_SPEED>(hveh, speed);
}
}