[saco] Implement/match CPlayerPed::ExitCurrentVehicle()

This commit is contained in:
RD42 2024-10-31 17:27:54 +08:00
parent 0a7fc0799b
commit 63d04d6639
3 changed files with 23 additions and 0 deletions

View File

@ -863,6 +863,27 @@ void CPlayerPed::EnterVehicle(int iVehicleID, BOOL bPassenger)
}
}
//-----------------------------------------------------------
// Graceful vehicle exit.
void CPlayerPed::ExitCurrentVehicle()
{
if(!m_pPed) return;
if(!GamePool_Ped_GetAt(m_dwGTAId)) return;
if(IN_VEHICLE(m_pPed)) {
if(GetCurrentVehicleID()) {
int iVehicleID;
VEHICLE_TYPE *pVehicle = GamePool_Vehicle_GetAt(GetCurrentVehicleID());
if(pVehicle) {
if( pVehicle->entity.nModelIndex != TRAIN_PASSENGER &&
pVehicle->entity.nModelIndex != TRAIN_PASSENGER_LOCO ) {
ScriptCommand(&make_actor_leave_car,m_dwGTAId,GetCurrentVehicleID());
}
}
}
}
}
//-----------------------------------------------------------
// Forceful removal

View File

@ -68,6 +68,7 @@ public:
void PutDirectlyInVehicle(int iVehicleID, int iSeat);
void EnterVehicle(int iVehicleID, BOOL bPassenger);
void ExitCurrentVehicle();
void RemoveFromVehicleAndPutAt(float fX, float fY, float fZ);
BOOL IsAPassenger();

View File

@ -79,6 +79,7 @@ const SCRIPT_COMMAND play_sound = { 0x018c, "fffi" };
const SCRIPT_COMMAND remove_actor_from_car_and_put_at = { 0x0362, "ifff" };
const SCRIPT_COMMAND send_actor_to_car_driverseat = { 0x05CB, "iii" };
const SCRIPT_COMMAND send_actor_to_car_passenger = { 0x05CA, "iiii" };
const SCRIPT_COMMAND make_actor_leave_car = { 0x05CD, "ii" };
const SCRIPT_COMMAND enable_train_traffic = { 0x06d7, "i" };