diff --git a/saco/game/playerped.cpp b/saco/game/playerped.cpp index 1b1214c..80eddd2 100644 --- a/saco/game/playerped.cpp +++ b/saco/game/playerped.cpp @@ -438,6 +438,23 @@ BOOL CPlayerPed::HasAmmoForCurrentWeapon() } return TRUE; } +//----------------------------------------------------------- + +float CPlayerPed::GetDistanceFromVehicle(CVehicle *pVehicle) +{ + MATRIX4X4 matFromPlayer; + MATRIX4X4 matThis; + float fSX,fSY,fSZ; + + GetMatrix(&matThis); + pVehicle->GetMatrix(&matFromPlayer); + + fSX = (matThis.pos.X - matFromPlayer.pos.X) * (matThis.pos.X - matFromPlayer.pos.X); + fSY = (matThis.pos.Y - matFromPlayer.pos.Y) * (matThis.pos.Y - matFromPlayer.pos.Y); + fSZ = (matThis.pos.Z - matFromPlayer.pos.Z) * (matThis.pos.Z - matFromPlayer.pos.Z); + + return (float)sqrt(fSX + fSY + fSZ); +} //----------------------------------------------------------- diff --git a/saco/game/playerped.h b/saco/game/playerped.h index f15c287..f779b03 100644 --- a/saco/game/playerped.h +++ b/saco/game/playerped.h @@ -59,6 +59,8 @@ public: VEHICLE_TYPE * GetGtaVehicle(); + float GetDistanceFromVehicle(CVehicle *pVehicle); + void StartJetpack(); void StopJetpack(); BOOL IsInJetpackMode(); diff --git a/saco/game/vehicle.cpp b/saco/game/vehicle.cpp new file mode 100644 index 0000000..7bc5ae3 --- /dev/null +++ b/saco/game/vehicle.cpp @@ -0,0 +1,15 @@ + +#include "../main.h" + +//----------------------------------------------------------- +// CONSTRUCTOR + +CVehicle::CVehicle(int iType, float fPosX, float fPosY, + float fPosZ, float fRotation, BOOL bKeepModelLoaded, + int a8) +{ + // TODO: CVehicle::CVehicle +} + +//----------------------------------------------------------- + diff --git a/saco/game/vehicle.h b/saco/game/vehicle.h new file mode 100644 index 0000000..d589b5e --- /dev/null +++ b/saco/game/vehicle.h @@ -0,0 +1,17 @@ + +#pragma once + +#include "game.h" +#include "entity.h" + +//----------------------------------------------------------- + +class CVehicle : public CEntity +{ +public: + + CVehicle( int iType, float fPosX, float fPosY, float fPosZ, float fRotation = 0.0f, BOOL bKeepModelLoaded = FALSE, int a8 = 0); + +}; + +//-----------------------------------------------------------