mirror of
https://github.com/dashr9230/SA-MP.git
synced 2025-09-19 12:16:15 +08:00
[bot] Implement/match n_GetPlayerHealth(...)
* Implement/match `CNetGame::GetPlayerHealth(...)`
This commit is contained in:
@ -142,6 +142,29 @@ BYTE CNetGame::GetPlayerArmedWeapon(PLAYERID playerId)
|
||||
}
|
||||
}
|
||||
|
||||
BYTE CNetGame::GetPlayerHealth(PLAYERID playerId)
|
||||
{
|
||||
if(playerId >= MAX_PLAYERS) return 0;
|
||||
if(bPlayerSlotState[playerId] == FALSE) return 0;
|
||||
|
||||
if(bytePlayerState[playerId] == PLAYER_STATE_ONFOOT)
|
||||
{
|
||||
return unnamed_3[playerId].byteHealth;
|
||||
}
|
||||
else if(bytePlayerState[playerId] == PLAYER_STATE_DRIVER)
|
||||
{
|
||||
return unnamed_4[playerId].bytePlayerHealth;
|
||||
}
|
||||
else if(bytePlayerState[playerId] == PLAYER_STATE_PASSENGER)
|
||||
{
|
||||
return unnamed_5[playerId].bytePlayerHealth;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------
|
||||
// MATCH
|
||||
BOOL CNetGame::IsPlayerAdded(PLAYERID playerId)
|
||||
|
@ -111,6 +111,7 @@ public:
|
||||
BOOL GetPlayerPos(PLAYERID playerId, PVECTOR Vector);
|
||||
VEHICLEID GetPlayerVehicleID(PLAYERID playerId);
|
||||
BYTE GetPlayerArmedWeapon(PLAYERID playerId);
|
||||
BYTE GetPlayerHealth(PLAYERID playerId);
|
||||
|
||||
void StopRecordingPlayback();
|
||||
void PauseRecordingPlayback();
|
||||
|
@ -186,7 +186,10 @@ static cell AMX_NATIVE_CALL n_GetPlayerArmedWeapon(AMX *amx, cell *params)
|
||||
// native GetPlayerHealth(playerid)
|
||||
static cell AMX_NATIVE_CALL n_GetPlayerHealth(AMX *amx, cell *params)
|
||||
{
|
||||
// TODO: n_GetPlayerHealth
|
||||
if(pNetGame->GetPlayerPool()->GetSlotState((PLAYERID)params[1]))
|
||||
{
|
||||
return (cell)pNetGame->GetPlayerHealth((PLAYERID)params[1]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user