edited sdk to add new function: GetPlayerX, GetPlayerY, GetPlayerZ and GetPlayerPos

Call GetPlayerPos like this and get output

PlayerPos pos = SDK::GetPlayerPos();
SDK::Log(L"X: " + std::to_wstring(pos.x));
SDK::Log(L"Y: " + std::to_wstring(pos.y));
SDK::Log(L"Z: " + std::to_wstring(pos.z));

Call GetPlayerX or Y or Z like this and get output

double x = SDK::GetPlayerX();
double y = SDK::GetPlayerY();
double z = SDK::GetPlayerZ();
This commit is contained in:
Soda Can 2026-03-10 15:04:38 +11:00
parent fe76832d96
commit 94999b1812
3 changed files with 40 additions and 0 deletions

3
.gitignore vendored
View file

@ -1,3 +1,6 @@
# Visual Studio directory
.vs/
# Visual Studio databases
*.VC.db

View file

@ -85,6 +85,33 @@ MultiplayerLocalPlayer* SDK::GetLocalPlayer() {
return mc->localplayers[currentIdx].get();
}
// ============================================================================
// Player Pos
// ============================================================================
double SDK::GetPlayerX(int index) {
MultiplayerLocalPlayer* p = GetLocalPlayer(index);
return p ? p->x : 0.0;
}
double SDK::GetPlayerY(int index) {
MultiplayerLocalPlayer* p = GetLocalPlayer(index);
return p ? p->y : 0.0;
}
double SDK::GetPlayerZ(int index) {
MultiplayerLocalPlayer* p = GetLocalPlayer(index);
return p ? p->z : 0.0;
}
PlayerPos SDK::GetPlayerPos(int index) {
MultiplayerLocalPlayer* p = GetLocalPlayer(index);
if (!p) return { 0.0, 0.0, 0.0 };
return { p->x, p->y, p->z };
}
// ============================================================================
// Messaging
// ============================================================================

View file

@ -12,6 +12,10 @@ class PlayerList;
class ServerPlayer;
class MultiplayerLocalPlayer;
struct PlayerPos {
double x, y, z;
};
namespace SDK {
// Logging
MODAPI void Log(const std::wstring& message);
@ -32,6 +36,12 @@ namespace SDK {
MODAPI MultiplayerLocalPlayer* GetLocalPlayer(int index);
MODAPI MultiplayerLocalPlayer* GetLocalPlayer();
// Player Pos
MODAPI double GetPlayerX(int index = 0);
MODAPI double GetPlayerY(int index = 0);
MODAPI double GetPlayerZ(int index = 0);
MODAPI PlayerPos GetPlayerPos(int index = 0);
// Messaging
MODAPI void BroadcastMessage(const std::wstring& message);
MODAPI void SendMessageToPlayer(const std::wstring& playerName, const std::wstring& message);