[saco] Implement/match CPlayerPed::TogglePlayerControllable(...)

This commit is contained in:
RD42 2024-10-15 17:56:30 +08:00
parent 3227dd0905
commit 76dde69cdf
3 changed files with 26 additions and 0 deletions

View File

@ -779,6 +779,27 @@ void CPlayerPed::RemoveFromVehicleAndPutAt(float fX, float fY, float fZ)
//-----------------------------------------------------------
void CPlayerPed::TogglePlayerControllable(int iControllable)
{
MATRIX4X4 mat;
if(!GamePool_Ped_GetAt(m_dwGTAId)) return;
if(!iControllable) {
ScriptCommand(&toggle_player_controllable,m_bytePlayerNumber,0);
ScriptCommand(&lock_actor,m_dwGTAId,1);
} else {
ScriptCommand(&toggle_player_controllable,m_bytePlayerNumber,1);
ScriptCommand(&lock_actor,m_dwGTAId,0);
if(!IsInVehicle()) {
GetMatrix(&mat);
TeleportTo(mat.pos.X,mat.pos.Y,mat.pos.Z);
}
}
}
//-----------------------------------------------------------
WORD CPlayerPed::GetAmmo()
{
if(m_pPed) {

View File

@ -74,6 +74,8 @@ public:
ENTITY_TYPE * GetGtaContactEntity();
int GetVehicleSeatID();
void TogglePlayerControllable(int iControllable);
float GetDistanceFromVehicle(CVehicle *pVehicle);
void StartJetpack();

View File

@ -59,6 +59,8 @@ const SCRIPT_COMMAND get_ground_z = { 0x02ce, "fffv" }; // x, y, z, var_gro
const SCRIPT_COMMAND destroy_racing_checkpoint = { 0x06d6, "i" };
const SCRIPT_COMMAND toggle_player_controllable = { 0x01B4, "ii" };
const SCRIPT_COMMAND set_actor_armed_weapon = { 0x01b9, "ii" };
const SCRIPT_COMMAND get_actor_armed_weapon = { 0x0470, "iv" };
@ -77,6 +79,7 @@ const SCRIPT_COMMAND put_train_at = { 0x07c7, "ifff" };
const SCRIPT_COMMAND get_active_interior = { 0x077e, "v" };
const SCRIPT_COMMAND set_actor_z_angle = { 0x0173, "if" };
const SCRIPT_COMMAND lock_actor = { 0x04d7, "ii" };
const SCRIPT_COMMAND refresh_streaming_at = { 0x04E4, "ff" };
const SCRIPT_COMMAND set_actor_animation_set = { 0x0245, "is" };