diff --git a/saco/game/hooks.cpp b/saco/game/hooks.cpp index 6d0183f..2314dc7 100644 --- a/saco/game/hooks.cpp +++ b/saco/game/hooks.cpp @@ -24,6 +24,9 @@ DWORD dwFarClipReturnAddr=0; // used generically PED_TYPE *_pPlayer; +BOOL bIgnoreNextEntry=FALSE; +BOOL bIgnoreNextExit=FALSE; + BYTE byteSavedCameraMode; DWORD dwCurPlayerActor=0; BYTE *pbyteCameraMode = (BYTE *)0xB6F1A8; diff --git a/saco/game/playerped.cpp b/saco/game/playerped.cpp index 9916b1f..e68b3c2 100644 --- a/saco/game/playerped.cpp +++ b/saco/game/playerped.cpp @@ -11,6 +11,9 @@ #include "task.h" extern CGame *pGame; +extern CNetGame *pNetGame; +extern BOOL bIgnoreNextEntry; +extern BOOL bIgnoreNextExit; extern BYTE *pbyteCurrentPlayer; @@ -836,6 +839,30 @@ void CPlayerPed::PutDirectlyInVehicle(int iVehicleID, int iSeat) //----------------------------------------------------------- +void CPlayerPed::EnterVehicle(int iVehicleID, BOOL bPassenger) +{ + if(!m_pPed) return; + VEHICLE_TYPE *ThisVehicleType; + if((ThisVehicleType = GamePool_Vehicle_GetAt(iVehicleID)) == NULL) return; + if(!GamePool_Ped_GetAt(m_dwGTAId)) return; + + bIgnoreNextEntry = TRUE; + + if(GetCurrentWeapon() == WEAPON_PARACHUTE) { + SetArmedWeapon(0); + } + + if(bPassenger) { + if(ThisVehicleType->entity.nModelIndex == TRAIN_PASSENGER && (m_pPed == GamePool_FindPlayerPed())) { + ScriptCommand(&put_actor_in_car2,m_dwGTAId,iVehicleID,-1); + } else { + ScriptCommand(&send_actor_to_car_passenger,m_dwGTAId,iVehicleID,3000,-1); + } + } else { + ScriptCommand(&send_actor_to_car_driverseat,m_dwGTAId,iVehicleID,3000); + } +} + //----------------------------------------------------------- // Forceful removal diff --git a/saco/game/playerped.h b/saco/game/playerped.h index aa41dd0..332a81d 100644 --- a/saco/game/playerped.h +++ b/saco/game/playerped.h @@ -67,6 +67,7 @@ public: void SetImmunities(BOOL bBullet, BOOL bFire, BOOL bExplosion, BOOL bDamage, BOOL bUnknown); void PutDirectlyInVehicle(int iVehicleID, int iSeat); + void EnterVehicle(int iVehicleID, BOOL bPassenger); void RemoveFromVehicleAndPutAt(float fX, float fY, float fZ); BOOL IsAPassenger(); diff --git a/saco/game/scripting.h b/saco/game/scripting.h index 4932e69..9c270c4 100644 --- a/saco/game/scripting.h +++ b/saco/game/scripting.h @@ -77,6 +77,9 @@ const SCRIPT_COMMAND set_actor_can_be_decapitated = { 0x0446, "ii" }; 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 enable_train_traffic = { 0x06d7, "i" }; const SCRIPT_COMMAND lock_car = { 0x0519, "ii" };