mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-02-22 12:47:13 +01:00
Add a method to the vehicle entity class to check if a certain slot has an occupant.
This commit is contained in:
parent
0bf9afc553
commit
52a06cc83b
@ -287,6 +287,19 @@ Int32 CVehicle::GetOccupantID(Int32 slot) const
|
|||||||
return _Func->GetVehicleOccupant(m_ID, slot);
|
return _Func->GetVehicleOccupant(m_ID, slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
bool CVehicle::HasOccupant(Int32 slot) const
|
||||||
|
{
|
||||||
|
// Validate the managed identifier
|
||||||
|
Validate();
|
||||||
|
// Return the requested information
|
||||||
|
const Int32 id = _Func->GetVehicleOccupant(m_ID, slot);
|
||||||
|
// Use the server errors to see if there was an occupant
|
||||||
|
const vcmpError err = _Func->GetLastError();
|
||||||
|
// Return whether there was no error and the returned ID is valid
|
||||||
|
return (err == vcmpErrorNone) && INVALID_ENTITYEX(id, SQMOD_PLAYER_POOL);
|
||||||
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void CVehicle::Respawn() const
|
void CVehicle::Respawn() const
|
||||||
{
|
{
|
||||||
@ -1976,6 +1989,7 @@ void Register_CVehicle(HSQUIRRELVM vm)
|
|||||||
.Func(_SC("SetOptionEx"), &CVehicle::SetOptionEx)
|
.Func(_SC("SetOptionEx"), &CVehicle::SetOptionEx)
|
||||||
.Func(_SC("Occupant"), &CVehicle::GetOccupant)
|
.Func(_SC("Occupant"), &CVehicle::GetOccupant)
|
||||||
.Func(_SC("OccupantID"), &CVehicle::GetOccupantID)
|
.Func(_SC("OccupantID"), &CVehicle::GetOccupantID)
|
||||||
|
.Func(_SC("HasOccupant"), &CVehicle::HasOccupant)
|
||||||
.Func(_SC("Respawn"), &CVehicle::Respawn)
|
.Func(_SC("Respawn"), &CVehicle::Respawn)
|
||||||
.Func(_SC("Explode"), &CVehicle::Explode)
|
.Func(_SC("Explode"), &CVehicle::Explode)
|
||||||
.Func(_SC("SetRot"), &CVehicle::SetRotationEx)
|
.Func(_SC("SetRot"), &CVehicle::SetRotationEx)
|
||||||
|
@ -242,6 +242,11 @@ public:
|
|||||||
*/
|
*/
|
||||||
Int32 GetOccupantID(Int32 slot) const;
|
Int32 GetOccupantID(Int32 slot) const;
|
||||||
|
|
||||||
|
/* --------------------------------------------------------------------------------------------
|
||||||
|
* See whether the managed vehicle entity has an occupant in a certain slot.
|
||||||
|
*/
|
||||||
|
bool HasOccupant(Int32 slot) const;
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Respawn the managed vehicle entity.
|
* Respawn the managed vehicle entity.
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user