refactor(Features): Moved looped features in a separate sub directory

This commit is contained in:
Yimura 2020-12-31 11:06:36 +01:00
parent 9ab3b97947
commit 095c6c60b9
No known key found for this signature in database
GPG Key ID: 3D8FF4397E768682
15 changed files with 338 additions and 338 deletions

View File

@ -1,21 +1,21 @@
#include "features.hpp"
namespace big
{
static bool bLastGodMode = false;
void features::god_mode()
{
bool bGodMode = g_settings.options["god_mode"].get<bool>();
if (bGodMode || (!bGodMode && bGodMode != bLastGodMode))
{
QUEUE_JOB_BEGIN_CLAUSE(= )
{
ENTITY::SET_ENTITY_INVINCIBLE(PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(PLAYER::PLAYER_ID()), bGodMode);
}QUEUE_JOB_END_CLAUSE
bLastGodMode = bGodMode;
}
}
#include "features.hpp"
namespace big
{
static bool bLastGodMode = false;
void features::god_mode()
{
bool bGodMode = g_settings.options["god_mode"].get<bool>();
if (bGodMode || (!bGodMode && bGodMode != bLastGodMode))
{
QUEUE_JOB_BEGIN_CLAUSE(= )
{
ENTITY::SET_ENTITY_INVINCIBLE(PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(PLAYER::PLAYER_ID()), bGodMode);
}QUEUE_JOB_END_CLAUSE
bLastGodMode = bGodMode;
}
}
}

View File

@ -1,22 +1,22 @@
#include "features.hpp"
#include "pointers.hpp"
namespace big
{
void features::join_message(Player player)
{
if (player == g_playerId) return;
bool bJoinMessage = g_settings.options["join_message"].get<bool>();
if (bJoinMessage)
{
char joinMsg[64];
strcpy(joinMsg, "<C>");
strcat(joinMsg, g_pointers->m_get_player_name(player));
strcat(joinMsg, "</C> is joining.");
features::notify::above_map(joinMsg);
}
}
#include "features.hpp"
#include "pointers.hpp"
namespace big
{
void features::join_message(Player player)
{
if (player == g_playerId) return;
bool bJoinMessage = g_settings.options["join_message"].get<bool>();
if (bJoinMessage)
{
char joinMsg[64];
strcpy(joinMsg, "<C>");
strcat(joinMsg, g_pointers->m_get_player_name(player));
strcat(joinMsg, "</C> is joining.");
features::notify::above_map(joinMsg);
}
}
}

View File

@ -1,26 +1,26 @@
#include "features.hpp"
namespace big
{
static bool bLastNeverWanted = false;
void features::never_wanted()
{
QUEUE_JOB_BEGIN_CLAUSE()
{
bool bNeverWanted = g_settings.options["never_wanted"].get<bool>();
if (bNeverWanted && PLAYER::GET_PLAYER_WANTED_LEVEL(g_playerId) > 0)
{
PLAYER::SET_PLAYER_WANTED_LEVEL(g_playerId, 0, true);
PLAYER::SET_MAX_WANTED_LEVEL(0);
}
else if (!bNeverWanted && bNeverWanted != bLastNeverWanted)
{
PLAYER::SET_MAX_WANTED_LEVEL(5);
}
bLastNeverWanted = bNeverWanted;
}QUEUE_JOB_END_CLAUSE
}
#include "features.hpp"
namespace big
{
static bool bLastNeverWanted = false;
void features::never_wanted()
{
QUEUE_JOB_BEGIN_CLAUSE()
{
bool bNeverWanted = g_settings.options["never_wanted"].get<bool>();
if (bNeverWanted && PLAYER::GET_PLAYER_WANTED_LEVEL(g_playerId) > 0)
{
PLAYER::SET_PLAYER_WANTED_LEVEL(g_playerId, 0, true);
PLAYER::SET_MAX_WANTED_LEVEL(0);
}
else if (!bNeverWanted && bNeverWanted != bLastNeverWanted)
{
PLAYER::SET_MAX_WANTED_LEVEL(5);
}
bLastNeverWanted = bNeverWanted;
}QUEUE_JOB_END_CLAUSE
}
}

View File

@ -1,14 +1,14 @@
#include "features.hpp"
namespace big
{
void features::no_bike_fall()
{
bool bNoBikeFall = g_settings.options["no_bike_fall"].get<bool>();
QUEUE_JOB_BEGIN_CLAUSE(=)
{
PED::SET_PED_CAN_BE_KNOCKED_OFF_VEHICLE(PLAYER::PLAYER_PED_ID(), bNoBikeFall);
}QUEUE_JOB_END_CLAUSE
}
#include "features.hpp"
namespace big
{
void features::no_bike_fall()
{
bool bNoBikeFall = g_settings.options["no_bike_fall"].get<bool>();
QUEUE_JOB_BEGIN_CLAUSE(=)
{
PED::SET_PED_CAN_BE_KNOCKED_OFF_VEHICLE(PLAYER::PLAYER_PED_ID(), bNoBikeFall);
}QUEUE_JOB_END_CLAUSE
}
}

View File

@ -1,16 +1,16 @@
#include "features.hpp"
#include "script_global.hpp"
namespace big
{
void features::no_idle_kick()
{
bool bNoIdleKick = g_settings.options["no_idle_kick"].get<bool>();
if (bNoIdleKick)
{
*script_global(1377236).at(1165).as<int*>() = -1;
*script_global(1377236).at(1149).as<int*>() = -1;
}
}
#include "features.hpp"
#include "script_global.hpp"
namespace big
{
void features::no_idle_kick()
{
bool bNoIdleKick = g_settings.options["no_idle_kick"].get<bool>();
if (bNoIdleKick)
{
*script_global(1377236).at(1165).as<int*>() = 0;
*script_global(1377236).at(1149).as<int*>() = 0;
}
}
}

View File

@ -1,24 +1,24 @@
#include "features.hpp"
namespace big
{
static bool bLastNoRagdoll = false;
void features::no_ragdoll()
{
bool bNoRagdoll = g_settings.options["ragdoll"].get<bool>();
if (bNoRagdoll || (!bNoRagdoll && bNoRagdoll != bLastNoRagdoll))
{
QUEUE_JOB_BEGIN_CLAUSE(= )
{
Ped player = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(g_playerId);
PED::SET_PED_CAN_RAGDOLL(player, !bNoRagdoll);
PED::SET_PED_CAN_RAGDOLL_FROM_PLAYER_IMPACT(player, !bNoRagdoll);
}QUEUE_JOB_END_CLAUSE
bLastNoRagdoll = bNoRagdoll;
}
}
#include "features.hpp"
namespace big
{
static bool bLastNoRagdoll = false;
void features::no_ragdoll()
{
bool bNoRagdoll = g_settings.options["ragdoll"].get<bool>();
if (bNoRagdoll || (!bNoRagdoll && bNoRagdoll != bLastNoRagdoll))
{
QUEUE_JOB_BEGIN_CLAUSE(= )
{
Ped player = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(g_playerId);
PED::SET_PED_CAN_RAGDOLL(player, !bNoRagdoll);
PED::SET_PED_CAN_RAGDOLL_FROM_PLAYER_IMPACT(player, !bNoRagdoll);
}QUEUE_JOB_END_CLAUSE
bLastNoRagdoll = bNoRagdoll;
}
}
}

View File

@ -1,20 +1,20 @@
#include "features.hpp"
#include "script_global.hpp"
namespace big
{
void features::off_radar()
{
if (g_settings.options["off_radar"].get<bool>())
{
QUEUE_JOB_BEGIN_CLAUSE()
{
if (PLAYER::IS_PLAYER_ONLINE())
{
*script_global(2425869).at(1 + (g_playerId * 443)).at(204).as<int*>() = 1;
*script_global(2440049).at(70).as<int*>() = NETWORK::GET_NETWORK_TIME() + 999;
}
}QUEUE_JOB_END_CLAUSE
}
}
#include "features.hpp"
#include "script_global.hpp"
namespace big
{
void features::off_radar()
{
if (g_settings.options["off_radar"].get<bool>())
{
QUEUE_JOB_BEGIN_CLAUSE()
{
if (PLAYER::IS_PLAYER_ONLINE())
{
*script_global(2425869).at(1 + (g_playerId * 443)).at(204).as<int*>() = 1;
*script_global(2440049).at(70).as<int*>() = NETWORK::GET_NETWORK_TIME() + 999;
}
}QUEUE_JOB_END_CLAUSE
}
}
}

View File

@ -1,18 +1,18 @@
#include "features.hpp"
namespace big
{
void features::population_modifiers()
{
if (g_settings.options["population_modifiers"].get<bool>())
{
QUEUE_JOB_BEGIN_CLAUSE()
{
PED::SET_PED_DENSITY_MULTIPLIER_THIS_FRAME((float)g_settings.options["pedestrian_population"].get<double>());
VEHICLE::SET_PARKED_VEHICLE_DENSITY_MULTIPLIER_THIS_FRAME((float)g_settings.options["parked_vehicle_density"].get<double>());
VEHICLE::SET_VEHICLE_DENSITY_MULTIPLIER_THIS_FRAME((float)g_settings.options["vehicle_density"].get<double>());
}QUEUE_JOB_END_CLAUSE
}
}
#include "features.hpp"
namespace big
{
void features::population_modifiers()
{
if (g_settings.options["population_modifiers"].get<bool>())
{
QUEUE_JOB_BEGIN_CLAUSE()
{
PED::SET_PED_DENSITY_MULTIPLIER_THIS_FRAME((float)g_settings.options["pedestrian_population"].get<double>());
VEHICLE::SET_PARKED_VEHICLE_DENSITY_MULTIPLIER_THIS_FRAME((float)g_settings.options["parked_vehicle_density"].get<double>());
VEHICLE::SET_VEHICLE_DENSITY_MULTIPLIER_THIS_FRAME((float)g_settings.options["vehicle_density"].get<double>());
}QUEUE_JOB_END_CLAUSE
}
}
}

View File

@ -1,14 +1,14 @@
#include "features.hpp"
#include "script_global.hpp"
namespace big
{
void features::reveal_players()
{
if (g_settings.options["reveal_players"].get<bool>())
{
*script_global(2425869).at(1 + (g_playerId * 443)).at(207).as<int*>() = 1;
*script_global(2440049).at(71).as<int*>() = NETWORK::GET_NETWORK_TIME() + 999;
}
}
#include "features.hpp"
#include "script_global.hpp"
namespace big
{
void features::reveal_players()
{
if (g_settings.options["reveal_players"].get<bool>())
{
*script_global(2425869).at(1 + (g_playerId * 443)).at(207).as<int*>() = 1;
*script_global(2440049).at(71).as<int*>() = NETWORK::GET_NETWORK_TIME() + 999;
}
}
}

View File

@ -1,48 +1,48 @@
#include "features.hpp"
namespace big
{
void features::speedo_meter()
{
static const float x = .9f;
static const float y = .72f;
int64_t speedo_type = g_settings.options["speedo_type"].get<int64_t>();
if (speedo_type == 0 || HUD::IS_PAUSE_MENU_ACTIVE()) return;
Vehicle veh = PED::GET_VEHICLE_PED_IS_IN(PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(g_playerId), false);
if (veh == 0) return;
char speed_type[16], speed[32];
float veh_speed = ENTITY::GET_ENTITY_SPEED(veh);
switch (speedo_type)
{
case 1:
veh_speed *= 3.6;
strcpy(speed_type, "kph");
break;
case 2:
veh_speed *= 2.2369;
strcpy(speed_type, "mph");
break;
}
sprintf(speed, "%d", (int)veh_speed);
HUD::SET_TEXT_FONT(2);
HUD::SET_TEXT_SCALE(.9f, .9f);
HUD::SET_TEXT_OUTLINE();
HUD::BEGIN_TEXT_COMMAND_DISPLAY_TEXT("STRING");
HUD::ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME(speed);
HUD::END_TEXT_COMMAND_DISPLAY_TEXT(x, y + .04f, 1);
HUD::SET_TEXT_FONT(2);
HUD::SET_TEXT_SCALE(.91f, .91f);
HUD::SET_TEXT_OUTLINE();
HUD::BEGIN_TEXT_COMMAND_DISPLAY_TEXT("STRING");
HUD::ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME(speed_type);
HUD::END_TEXT_COMMAND_DISPLAY_TEXT(x, y, 1);
}
#include "features.hpp"
namespace big
{
void features::speedo_meter()
{
static const float x = .9f;
static const float y = .72f;
int64_t speedo_type = g_settings.options["speedo_type"].get<int64_t>();
if (speedo_type == 0 || HUD::IS_PAUSE_MENU_ACTIVE()) return;
Vehicle veh = PED::GET_VEHICLE_PED_IS_IN(PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(g_playerId), false);
if (veh == 0) return;
char speed_type[16], speed[32];
float veh_speed = ENTITY::GET_ENTITY_SPEED(veh);
switch (speedo_type)
{
case 1:
veh_speed *= 3.6;
strcpy(speed_type, "kph");
break;
case 2:
veh_speed *= 2.2369;
strcpy(speed_type, "mph");
break;
}
sprintf(speed, "%d", (int)veh_speed);
HUD::SET_TEXT_FONT(2);
HUD::SET_TEXT_SCALE(.9f, .9f);
HUD::SET_TEXT_OUTLINE();
HUD::BEGIN_TEXT_COMMAND_DISPLAY_TEXT("STRING");
HUD::ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME(speed);
HUD::END_TEXT_COMMAND_DISPLAY_TEXT(x, y + .04f, 1);
HUD::SET_TEXT_FONT(2);
HUD::SET_TEXT_SCALE(.91f, .91f);
HUD::SET_TEXT_OUTLINE();
HUD::BEGIN_TEXT_COMMAND_DISPLAY_TEXT("STRING");
HUD::ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME(speed_type);
HUD::END_TEXT_COMMAND_DISPLAY_TEXT(x, y, 1);
}
}

View File

@ -1,18 +1,18 @@
#include "features.hpp"
#include "script_global.hpp"
namespace big
{
void features::spoof_rank()
{
bool bSpoofRank = g_settings.options["spoof_rank"].get<bool>();
if (bSpoofRank)
{
QUEUE_JOB_BEGIN_CLAUSE()
{
features::functions::spoof_rank(g_settings.options["rank"].get<int>());
}QUEUE_JOB_END_CLAUSE
}
}
#include "features.hpp"
#include "script_global.hpp"
namespace big
{
void features::spoof_rank()
{
bool bSpoofRank = g_settings.options["spoof_rank"].get<bool>();
if (bSpoofRank)
{
QUEUE_JOB_BEGIN_CLAUSE()
{
features::functions::spoof_rank(g_settings.options["rank"].get<int>());
}QUEUE_JOB_END_CLAUSE
}
}
}

View File

@ -1,28 +1,28 @@
#include "features.hpp"
namespace big
{
void features::sticky_tyres()
{
if (g_settings.options["sticky_tyres"].get<bool>())
{
QUEUE_JOB_BEGIN_CLAUSE()
{
Vehicle veh = PED::GET_VEHICLE_PED_IS_IN(PLAYER::PLAYER_PED_ID(), false);
if (veh)
{
while (!NETWORK::NETWORK_HAS_CONTROL_OF_ENTITY(veh))
{
NETWORK::NETWORK_REQUEST_CONTROL_OF_ENTITY(veh);
script::get_current()->yield();
}
VEHICLE::SET_VEHICLE_ON_GROUND_PROPERLY(veh, 5.f);
}
}QUEUE_JOB_END_CLAUSE
}
}
#include "features.hpp"
namespace big
{
void features::sticky_tyres()
{
if (g_settings.options["sticky_tyres"].get<bool>())
{
QUEUE_JOB_BEGIN_CLAUSE()
{
Vehicle veh = PED::GET_VEHICLE_PED_IS_IN(PLAYER::PLAYER_PED_ID(), false);
if (veh)
{
while (!NETWORK::NETWORK_HAS_CONTROL_OF_ENTITY(veh))
{
NETWORK::NETWORK_REQUEST_CONTROL_OF_ENTITY(veh);
script::get_current()->yield();
}
VEHICLE::SET_VEHICLE_ON_GROUND_PROPERLY(veh, 5.f);
}
}QUEUE_JOB_END_CLAUSE
}
}
}

View File

@ -1,37 +1,37 @@
#include "features.hpp"
namespace big
{
static bool bLastSuperSprint = false;
void features::super_sprint()
{
bool bSuperSprint = g_settings.options["super_sprint"].get<bool>();
if (bSuperSprint)
{
QUEUE_JOB_BEGIN_CLAUSE(= )
{
if (PAD::IS_CONTROL_PRESSED(0, 32))
{
Ped player = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(g_playerId);
Vector3 offset = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(player, 0, 0.6, 0);
ENTITY::APPLY_FORCE_TO_ENTITY(player, 1, 0.0f, 1.3, 0, 0.0f, 0.0f, 0.0f, 0, 1, 1, 1, 0, 1);
PLAYER::SET_PLAYER_SPRINT(g_playerId, 1);
PLAYER::SET_RUN_SPRINT_MULTIPLIER_FOR_PLAYER(g_playerId, 1.49);
}
}QUEUE_JOB_END_CLAUSE
}
else if (!bSuperSprint && bSuperSprint != bLastSuperSprint)
{
QUEUE_JOB_BEGIN_CLAUSE(= )
{
PLAYER::SET_RUN_SPRINT_MULTIPLIER_FOR_PLAYER(g_playerId, 1.0);
}QUEUE_JOB_END_CLAUSE
}
bLastSuperSprint = bSuperSprint;
}
#include "features.hpp"
namespace big
{
static bool bLastSuperSprint = false;
void features::super_sprint()
{
bool bSuperSprint = g_settings.options["super_sprint"].get<bool>();
if (bSuperSprint)
{
QUEUE_JOB_BEGIN_CLAUSE(= )
{
if (PAD::IS_CONTROL_PRESSED(0, 32))
{
Ped player = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(g_playerId);
Vector3 offset = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(player, 0, 0.6, 0);
ENTITY::APPLY_FORCE_TO_ENTITY(player, 1, 0.0f, 1.3, 0, 0.0f, 0.0f, 0.0f, 0, 1, 1, 1, 0, 1);
PLAYER::SET_PLAYER_SPRINT(g_playerId, 1);
PLAYER::SET_RUN_SPRINT_MULTIPLIER_FOR_PLAYER(g_playerId, 1.49);
}
}QUEUE_JOB_END_CLAUSE
}
else if (!bSuperSprint && bSuperSprint != bLastSuperSprint)
{
QUEUE_JOB_BEGIN_CLAUSE(= )
{
PLAYER::SET_RUN_SPRINT_MULTIPLIER_FOR_PLAYER(g_playerId, 1.0);
}QUEUE_JOB_END_CLAUSE
}
bLastSuperSprint = bSuperSprint;
}
}

View File

@ -1,35 +1,35 @@
#include "features.hpp"
namespace big
{
void features::update_player_structs()
{
QUEUE_JOB_BEGIN_CLAUSE(= )
{
for (UINT16 i = 0; i < 32; i++)
{
if (NETWORK::NETWORK_IS_PLAYER_CONNECTED(i))
{
if (!g_players[i].is_online) features::join_message((Player)i);
g_players[i].is_online = true;
int iNetworkHandle[26];
NETWORK::NETWORK_HANDLE_FROM_PLAYER(i, &iNetworkHandle[0], 13);
NETWORK::NETWORK_IS_HANDLE_VALID(&iNetworkHandle[0], 13) && NETWORK::NETWORK_IS_FRIEND(&iNetworkHandle[0]);
g_players[i].is_friend = NETWORK::NETWORK_IS_HANDLE_VALID(iNetworkHandle, 13) && NETWORK::NETWORK_IS_FRIEND(iNetworkHandle);
strcpy(g_players[i].name, PLAYER::GET_PLAYER_NAME(i));
}
else
{
g_players[i].is_online = false;
g_players[i].is_friend = false;
}
script::get_current()->yield();
}
}QUEUE_JOB_END_CLAUSE
}
#include "features.hpp"
namespace big
{
void features::update_player_structs()
{
QUEUE_JOB_BEGIN_CLAUSE(= )
{
for (UINT16 i = 0; i < 32; i++)
{
if (NETWORK::NETWORK_IS_PLAYER_CONNECTED(i))
{
if (!g_players[i].is_online) features::join_message((Player)i);
g_players[i].is_online = true;
int iNetworkHandle[26];
NETWORK::NETWORK_HANDLE_FROM_PLAYER(i, &iNetworkHandle[0], 13);
NETWORK::NETWORK_IS_HANDLE_VALID(&iNetworkHandle[0], 13) && NETWORK::NETWORK_IS_FRIEND(&iNetworkHandle[0]);
g_players[i].is_friend = NETWORK::NETWORK_IS_HANDLE_VALID(iNetworkHandle, 13) && NETWORK::NETWORK_IS_FRIEND(iNetworkHandle);
strcpy(g_players[i].name, PLAYER::GET_PLAYER_NAME(i));
}
else
{
g_players[i].is_online = false;
g_players[i].is_friend = false;
}
script::get_current()->yield();
}
}QUEUE_JOB_END_CLAUSE
}
}

View File

@ -1,12 +1,12 @@
#include "features.hpp"
namespace big
{
void features::update_screen_sizes()
{
QUEUE_JOB_BEGIN_CLAUSE()
{
GRAPHICS::_GET_ACTIVE_SCREEN_RESOLUTION(&x, &y);
}QUEUE_JOB_END_CLAUSE
}
#include "features.hpp"
namespace big
{
void features::update_screen_sizes()
{
QUEUE_JOB_BEGIN_CLAUSE()
{
GRAPHICS::_GET_ACTIVE_SCREEN_RESOLUTION(&x, &y);
}QUEUE_JOB_END_CLAUSE
}
}