generated from YimMenu/YimMenuV2
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Script Function Return Value and Enhancements (#191)
Return value support for script function. Move herb giver to different group. Add "Trader Goods" to recovery options. Add "TP to player's camp" to player options Improved Moonshine Shack Teleport
- Loading branch information
Showing
10 changed files
with
176 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#include "game/backend/Players.hpp" | ||
#include "game/backend/Self.hpp" | ||
#include "game/commands/PlayerCommand.hpp" | ||
#include "game/features/Features.hpp" | ||
#include "game/rdr/Natives.hpp" | ||
#include "game/rdr/ScriptGlobal.hpp" | ||
#include "util/teleport.hpp" | ||
|
||
namespace YimMenu::Features | ||
{ | ||
class TpToPlayerCamp: public PlayerCommand | ||
{ | ||
using PlayerCommand::PlayerCommand; | ||
static constexpr auto PlayerList = ScriptGlobal(1141332); | ||
|
||
virtual void OnCall(Player player) override | ||
{ | ||
if (!PlayerList.CanAccess()) | ||
return; | ||
|
||
for (int i = 0; i < 32; i++) | ||
{ | ||
if (*PlayerList.At(i, 27).At(9).As<int*>() == player.GetId()) | ||
{ | ||
auto Camp = ScriptGlobal(1141332).At(i, 27).At(20); | ||
|
||
if (!Camp.CanAccess()) | ||
return; | ||
|
||
Vector3 CampCoords = *Camp.As<Vector3*>(); | ||
if (CampCoords != Vector3(0.f, 0.f, 0.f)) | ||
{ | ||
if(YimMenu::Teleport::TeleportEntity(Self::GetPed().GetHandle(), CampCoords + Vector3(1, 0, 0), true)) | ||
g_Spectating = false; | ||
} | ||
else | ||
{ | ||
Notifications::Show("Camp", "Unable to find player's camp", NotificationType::Error); | ||
} | ||
break; | ||
} | ||
} | ||
} | ||
}; | ||
|
||
static TpToPlayerCamp _TpToPlayerCamp{"tptoplayercamp", "Teleport To Player's Camp", "Teleport to the player's camp"}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.