[bot] Implement/match n_SetMyPos(...)

* Implement/match `CNetGame::SetMyPos(...)`
This commit is contained in:
RD42 2024-07-07 22:37:45 +08:00
parent 831b304f20
commit 8a4b1ed7a0
3 changed files with 26 additions and 2 deletions

View File

@ -237,6 +237,24 @@ BOOL CNetGame::IsVehicleAdded(VEHICLEID VehicleID)
return bVehicleSlotState[VehicleID] != FALSE;
}
//----------------------------------------------------
//----------------------------------------------------
void CNetGame::SetMyPos(PVECTOR Vector)
{
if(byteState == PLAYER_STATE_ONFOOT)
{
ofSync.vecPos.X = Vector->X;
ofSync.vecPos.Y = Vector->Y;
ofSync.vecPos.Z = Vector->Z;
}
else if (byteState == PLAYER_STATE_DRIVER)
{
icSync.vecPos.X = Vector->X;
icSync.vecPos.Y = Vector->Y;
icSync.vecPos.Z = Vector->Z;
}
}
//----------------------------------------------------
float CNetGame::GetMyZAngle()
{

View File

@ -115,6 +115,7 @@ public:
BYTE GetPlayerArmour(PLAYERID playerId);
BOOL GetPlayerKeys(PLAYERID playerId, WORD *udAnalog, WORD *lrAnalog, WORD *wKeys);
BOOL IsVehicleAdded(VEHICLEID VehicleID);
void SetMyPos(PVECTOR Vector);
float GetMyZAngle();
void StopRecordingPlayback();

View File

@ -259,8 +259,13 @@ static cell AMX_NATIVE_CALL n_GetMyPos(AMX *amx, cell *params)
// native SetMyPos(Float:x, Float:y, Float:z)
static cell AMX_NATIVE_CALL n_SetMyPos(AMX *amx, cell *params)
{
// TODO: n_SetMyPos
return 0;
if(!pNetGame->GetPlayerPool()) return 0;
VECTOR vecPos;
vecPos.X = amx_ctof(params[1]);
vecPos.Y = amx_ctof(params[2]);
vecPos.Z = amx_ctof(params[3]);
pNetGame->SetMyPos(&vecPos);
return 1;
}
// native GetMyFacingAngle(&Float:ang)