mirror of
https://github.com/ytsodacan/Faucet.git
synced 2026-04-26 17:08:51 +00:00
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:
parent
fe76832d96
commit
94999b1812
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -1,3 +1,6 @@
|
|||
# Visual Studio directory
|
||||
.vs/
|
||||
|
||||
# Visual Studio databases
|
||||
*.VC.db
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
// ============================================================================
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue