2022-03-08 12:52:00 -05:00
|
|
|
#pragma once
|
|
|
|
#include "natives.hpp"
|
2022-07-25 04:56:37 +08:00
|
|
|
#include "script.hpp"
|
2022-07-31 01:47:48 +08:00
|
|
|
#include "pointers.hpp"
|
2022-03-08 12:52:00 -05:00
|
|
|
|
|
|
|
namespace big::ped
|
|
|
|
{
|
2022-08-10 08:42:34 +08:00
|
|
|
inline bool change_player_model(const Hash hash)
|
|
|
|
{
|
|
|
|
for (uint8_t i = 0; !STREAMING::HAS_MODEL_LOADED(hash) && i < 100; i++)
|
|
|
|
{
|
|
|
|
STREAMING::REQUEST_MODEL(hash);
|
|
|
|
script::get_current()->yield();
|
|
|
|
}
|
|
|
|
if (!STREAMING::HAS_MODEL_LOADED(hash))
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
PLAYER::SET_PLAYER_MODEL(self::id, hash);
|
2023-01-22 21:57:32 +00:00
|
|
|
self::ped = PLAYER::PLAYER_PED_ID();
|
2022-08-10 08:42:34 +08:00
|
|
|
script::get_current()->yield();
|
|
|
|
STREAMING::SET_MODEL_AS_NO_LONGER_NEEDED(hash);
|
2023-01-22 16:59:17 -05:00
|
|
|
for (int i = 0; i < 12; i++) {
|
|
|
|
PED::SET_PED_COMPONENT_VARIATION
|
|
|
|
(
|
|
|
|
self::ped,
|
|
|
|
i,
|
|
|
|
PED::GET_PED_DRAWABLE_VARIATION(self::ped, i),
|
|
|
|
PED::GET_PED_TEXTURE_VARIATION(self::ped, i),
|
|
|
|
PED::GET_PED_PALETTE_VARIATION(self::ped, i)
|
|
|
|
);
|
|
|
|
}
|
2022-08-10 08:42:34 +08:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool steal_outfit(const Ped target)
|
2022-03-08 12:52:00 -05:00
|
|
|
{
|
2022-05-23 06:38:45 +08:00
|
|
|
Ped ped = self::ped;
|
|
|
|
|
|
|
|
if (ENTITY::GET_ENTITY_MODEL(ped) != ENTITY::GET_ENTITY_MODEL(target)) {
|
2022-08-10 08:42:34 +08:00
|
|
|
return false;
|
2022-03-08 12:52:00 -05:00
|
|
|
}
|
|
|
|
for (int i = 0; i < 12; i++) {
|
|
|
|
PED::SET_PED_COMPONENT_VARIATION
|
|
|
|
(
|
2022-05-23 06:38:45 +08:00
|
|
|
ped,
|
2022-03-08 12:52:00 -05:00
|
|
|
i,
|
|
|
|
PED::GET_PED_DRAWABLE_VARIATION(target, i),
|
|
|
|
PED::GET_PED_TEXTURE_VARIATION(target, i),
|
|
|
|
PED::GET_PED_PALETTE_VARIATION(target, i)
|
|
|
|
);
|
|
|
|
}
|
2022-08-10 08:42:34 +08:00
|
|
|
|
|
|
|
return true;
|
2022-03-08 12:52:00 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
inline void steal_identity(const Ped target)
|
|
|
|
{
|
2022-07-25 04:56:37 +08:00
|
|
|
const int max_health = ENTITY::GET_ENTITY_MAX_HEALTH(self::ped);
|
|
|
|
const int current_health = ENTITY::GET_ENTITY_HEALTH(self::ped);
|
|
|
|
const int current_armor = PED::GET_PED_ARMOUR(self::ped);
|
2022-05-23 06:38:45 +08:00
|
|
|
|
2022-12-22 21:23:32 +00:00
|
|
|
PLAYER::SET_PLAYER_MODEL(self::id, ENTITY::GET_ENTITY_MODEL(target));
|
2022-07-25 04:56:37 +08:00
|
|
|
script::get_current()->yield();
|
|
|
|
PED::CLONE_PED_TO_TARGET(target, self::ped);
|
|
|
|
ENTITY::SET_ENTITY_MAX_HEALTH(self::ped, max_health);
|
|
|
|
ENTITY::SET_ENTITY_HEALTH(self::ped, current_health, 0);
|
|
|
|
PED::SET_PED_ARMOUR(self::ped, current_armor);
|
2022-03-08 12:52:00 -05:00
|
|
|
}
|
2022-07-31 01:47:48 +08:00
|
|
|
|
2022-08-10 08:42:34 +08:00
|
|
|
inline Ped spawn(ePedType pedType, Hash hash, Hash clone, Vector3 location, float heading, bool is_networked = true)
|
2022-07-31 01:47:48 +08:00
|
|
|
{
|
|
|
|
for (uint8_t i = 0; !STREAMING::HAS_MODEL_LOADED(hash) && i < 100; i++)
|
|
|
|
{
|
|
|
|
STREAMING::REQUEST_MODEL(hash);
|
|
|
|
script::get_current()->yield();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!STREAMING::HAS_MODEL_LOADED(hash))
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
auto ped = PED::CREATE_PED(pedType, hash, location.x, location.y, location.z, heading, is_networked, false);
|
|
|
|
|
|
|
|
script::get_current()->yield();
|
|
|
|
|
2022-08-10 08:42:34 +08:00
|
|
|
if (clone)
|
|
|
|
{
|
|
|
|
PED::CLONE_PED_TO_TARGET(clone, ped);
|
|
|
|
}
|
|
|
|
|
2022-07-31 01:47:48 +08:00
|
|
|
STREAMING::SET_MODEL_AS_NO_LONGER_NEEDED(hash);
|
|
|
|
|
|
|
|
return ped;
|
|
|
|
}
|
2023-01-22 16:59:17 -05:00
|
|
|
}
|