Skip to content

Commit

Permalink
ALTV-643 - add IsInWater getter (#164)
Browse files Browse the repository at this point in the history
* ALTV-643 - add IsInWater getter

* ALTV-643 - update sdk
  • Loading branch information
Doxoh committed Jan 14, 2025
1 parent a0f865c commit a20f601
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
7 changes: 7 additions & 0 deletions c-api/cache/CachedPlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ namespace cache
_forwardSpeed(base->GetForwardSpeed()),
_strafeSpeed(base->GetStrafeSpeed()),
_parachuting(base->IsParachuting()),
_inWater(base->IsInWater()),
#ifdef ALT_SERVER_API
_superJumpEnabled(base->IsSuperJumpEnabled()),
_crouching(base->IsCrouching()),
Expand Down Expand Up @@ -297,6 +298,12 @@ namespace cache
bool IsParachuting() const override {
return _parachuting;
}

bool _inWater;
bool IsInWater() const override {
return _inWater;
}

#ifdef ALT_SERVER_API
bool _connected;
bool IsConnected() const override {
Expand Down
5 changes: 5 additions & 0 deletions c-api/entities/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,11 @@ uint8_t Player_IsParachuting(alt::IPlayer* player)
return player->IsParachuting();
}

uint8_t Player_IsInWater(alt::IPlayer* player)
{
return player->IsInWater();
}

#ifdef ALT_SERVER_API
alt::MValueConst* Player_GetLocalMetaData(alt::IPlayer* player, const char* key) {
return AllocMValue(player->GetLocalMetaData(key));
Expand Down
1 change: 1 addition & 0 deletions c-api/entities/player.h
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ EXPORT_CLIENT void Player_RemoveFilter(alt::IPlayer* player);
EXPORT_CLIENT alt::IAudioFilter* Player_GetFilter(alt::IPlayer* player);

EXPORT_SHARED uint8_t Player_IsParachuting(alt::IPlayer* player);
EXPORT_SHARED uint8_t Player_IsInWater(alt::IPlayer* player);

EXPORT_CLIENT const char* Player_GetTaskData(alt::IPlayer* player, int32_t& size);

Expand Down
4 changes: 3 additions & 1 deletion c-api/func_table.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "func_table.h"

inline uint64_t capiHash = 992064889353150126UL;
inline uint64_t capiHash = 9157281768489972218UL;
inline uint64_t capiHashes[] = {
0,
#ifdef ALT_CLIENT_API
Expand Down Expand Up @@ -1268,6 +1268,7 @@ inline uint64_t capiHashes[] = {
9656359974229471670UL,
13866510163503569909UL,
3966288765716642074UL,
12569204323936167181UL,
8318404148061760703UL,
7801590821162478013UL,
3159353707403506220UL,
Expand Down Expand Up @@ -3088,6 +3089,7 @@ inline void* capiPointers[] = {
(void*) Player_IsInMelee,
(void*) Player_IsInRagdoll,
(void*) Player_IsInVehicle,
(void*) Player_IsInWater,
(void*) Player_IsJumping,
(void*) Player_IsLeavingVehicle,
(void*) Player_IsOnLadder,
Expand Down

0 comments on commit a20f601

Please sign in to comment.