generated from YimMenu/YimMenuV2
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ped Spawner, Drunkness, NPC Ignore, Ragdoll, and Fix Metric Blocking (#…
…81) * main * fix all issues
- Loading branch information
Showing
8 changed files
with
170 additions
and
6 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,30 @@ | ||
#include "core/commands/LoopedCommand.hpp" | ||
#include "core/frontend/Notifications.hpp" | ||
#include "game/features/Features.hpp" | ||
#include "game/rdr/Natives.hpp" | ||
|
||
|
||
namespace YimMenu::Features | ||
{ | ||
class Drunk : public LoopedCommand | ||
{ | ||
using LoopedCommand::LoopedCommand; | ||
|
||
virtual void OnTick() override | ||
{ | ||
AUDIO::SET_PED_IS_DRUNK(Self::PlayerPed, true); | ||
PED::_SET_PED_DRUNKNESS(Self::PlayerPed, true, 1.0f); | ||
} | ||
|
||
virtual void OnDisable() override | ||
{ | ||
if (PED::_GET_PED_DRUNKNESS(Self::PlayerPed)) | ||
{ | ||
AUDIO::SET_PED_IS_DRUNK(Self::PlayerPed, false); | ||
PED::_SET_PED_DRUNKNESS(Self::PlayerPed, false, 0.0f); | ||
} | ||
} | ||
}; | ||
|
||
static Drunk _Drunk{"drunk", "Drunk", "Sets the player to be drunk"}; | ||
} |
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,25 @@ | ||
#include "core/commands/LoopedCommand.hpp" | ||
#include "core/frontend/Notifications.hpp" | ||
#include "game/features/Features.hpp" | ||
#include "game/rdr/Natives.hpp" | ||
|
||
|
||
namespace YimMenu::Features | ||
{ | ||
class NPCIgnore : public LoopedCommand | ||
{ | ||
using LoopedCommand::LoopedCommand; | ||
|
||
virtual void OnTick() override | ||
{ | ||
PLAYER::SET_EVERYONE_IGNORE_PLAYER(Self::Id, true); | ||
} | ||
|
||
virtual void OnDisable() override | ||
{ | ||
PLAYER::SET_EVERYONE_IGNORE_PLAYER(Self::Id, false); | ||
} | ||
}; | ||
|
||
static NPCIgnore _NPCIgnore{"npcignore", "NPC Ignore", "NPCs completely ignore this player!"}; | ||
} |
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
Large diffs are not rendered by default.
Oops, something went wrong.
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,48 @@ | ||
#include "core/frontend/Notifications.hpp" | ||
#include "game/backend/FiberPool.hpp" | ||
#include "game/backend/ScriptMgr.hpp" | ||
#include "game/rdr/Natives.hpp" | ||
|
||
|
||
namespace YimMenu | ||
{ | ||
bool SpawnPed(std::string model_name, Player player, int playerPed) | ||
{ | ||
FiberPool::Push([=] { | ||
Hash model = MISC::GET_HASH_KEY(model_name.c_str()); | ||
if (STREAMING::IS_MODEL_IN_CDIMAGE(model) && STREAMING::IS_MODEL_VALID(model)) | ||
{ | ||
if (!STREAMING::HAS_MODEL_LOADED(model)) | ||
{ | ||
STREAMING::REQUEST_MODEL(model, false); | ||
ScriptMgr::Yield(); | ||
} | ||
|
||
Vector3 coords = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(playerPed, 0.0, 3.0, -0.3); | ||
float playerRotation = ENTITY::GET_ENTITY_ROTATION(playerPed, 2).x; | ||
auto ped = PED::CREATE_PED(model, coords.x, coords.y, coords.z, playerRotation, 0, 0, 0, 0); | ||
|
||
ScriptMgr::Yield(); | ||
PED::_SET_RANDOM_OUTFIT_VARIATION(ped, true); | ||
ENTITY::SET_ENTITY_ALPHA(ped, 255, 0); | ||
ENTITY::SET_ENTITY_VISIBLE(ped, true); | ||
STREAMING::SET_MODEL_AS_NO_LONGER_NEEDED(model); | ||
NETWORK::NETWORK_REGISTER_ENTITY_AS_NETWORKED(ped); | ||
|
||
int id = NETWORK::PED_TO_NET(ped); | ||
if (NETWORK::NETWORK_DOES_NETWORK_ID_EXIST(id)) | ||
{ | ||
ENTITY::SET_ENTITY_SHOULD_FREEZE_WAITING_ON_COLLISION(ped, true); | ||
if (NETWORK::NETWORK_GET_ENTITY_IS_NETWORKED(ped)) | ||
{ | ||
NETWORK::SET_NETWORK_ID_EXISTS_ON_ALL_MACHINES(id, true); | ||
NETWORK::IS_NETWORK_ID_OWNED_BY_PARTICIPANT(id); | ||
} | ||
} | ||
return true; | ||
} | ||
return false; | ||
}); | ||
return false; | ||
} | ||
} |