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

* Implement/match `CNetGame::GetPlayerKeys(...)`
This commit is contained in:
RD42 2024-07-06 22:45:04 +08:00
parent 71204c1c49
commit 148efc2fa6
3 changed files with 48 additions and 1 deletions

View File

@ -188,6 +188,38 @@ BYTE CNetGame::GetPlayerArmour(PLAYERID playerId)
}
}
BOOL CNetGame::GetPlayerKeys(PLAYERID playerId, WORD *udAnalog, WORD *lrAnalog, WORD *wKeys)
{
if(playerId >= MAX_PLAYERS) return FALSE;
if(bPlayerSlotState[playerId] == FALSE) return FALSE;
if(bytePlayerState[playerId] == PLAYER_STATE_ONFOOT)
{
*udAnalog = unnamed_3[playerId].udAnalog;
*lrAnalog = unnamed_3[playerId].lrAnalog;
*wKeys = unnamed_3[playerId].wKeys;
return TRUE;
}
else if(bytePlayerState[playerId] == PLAYER_STATE_DRIVER)
{
*udAnalog = unnamed_4[playerId].udAnalog;
*lrAnalog = unnamed_4[playerId].lrAnalog;
*wKeys = unnamed_4[playerId].wKeys;
return TRUE;
}
else if(bytePlayerState[playerId] == PLAYER_STATE_PASSENGER)
{
*udAnalog = unnamed_5[playerId].udAnalog;
*lrAnalog = unnamed_5[playerId].lrAnalog;
*wKeys = unnamed_5[playerId].wKeys;
return TRUE;
}
else
{
return FALSE;
}
}
//----------------------------------------------------
// MATCH
BOOL CNetGame::IsPlayerAdded(PLAYERID playerId)

View File

@ -113,6 +113,7 @@ public:
BYTE GetPlayerArmedWeapon(PLAYERID playerId);
BYTE GetPlayerHealth(PLAYERID playerId);
BYTE GetPlayerArmour(PLAYERID playerId);
BOOL GetPlayerKeys(PLAYERID playerId, WORD *udAnalog, WORD *lrAnalog, WORD *wKeys);
BOOL IsVehicleAdded(VEHICLEID VehicleID);
void StopRecordingPlayback();

View File

@ -231,7 +231,21 @@ static cell AMX_NATIVE_CALL n_IsVehicleStreamedIn(AMX *amx, cell *params)
// native GetPlayerKeys(playerid, &keys, &updown, &leftright)
static cell AMX_NATIVE_CALL n_GetPlayerKeys(AMX *amx, cell *params)
{
// TODO: n_GetPlayerKeys
CPlayerPool *pPlayerPool = pNetGame->GetPlayerPool();
WORD wKeys=0, udAnalog=0, lrAnalog=0;
if(pPlayerPool->GetSlotState((PLAYERID)params[1]) &&
pNetGame->GetPlayerKeys((PLAYERID)params[1], &udAnalog, &lrAnalog, &wKeys))
{
cell* cptr;
amx_GetAddr(amx, params[2], &cptr);
*cptr = (cell)wKeys;
amx_GetAddr(amx, params[3], &cptr);
*cptr = (short)udAnalog;
amx_GetAddr(amx, params[4], &cptr);
*cptr = (short)lrAnalog;
return 1;
}
return 0;
}