Merge branch 'master' into fix-cache-openfile-fail
This commit is contained in:
commit
9d8e77ab1d
@ -11,15 +11,7 @@ command.call_player(somePlayerIndex, "spawn", {joaat("adder")})
|
||||
|
||||
For a complete list of available command functions, please refer to the command table documentation.
|
||||
|
||||
## Command Count: 213
|
||||
|
||||
### bailkick
|
||||
BAIL_KICK_DESC
|
||||
Arg Count: 1
|
||||
|
||||
### bailkickall
|
||||
BAIL_KICK_DESC
|
||||
Arg Count: 0
|
||||
## Command Count: 212
|
||||
|
||||
### breakup
|
||||
BREAKUP_KICK_DESC
|
||||
@ -61,6 +53,10 @@ Arg Count: 1
|
||||
SCRIPT_HOST_KICK_DESC
|
||||
Arg Count: 1
|
||||
|
||||
### multikick
|
||||
MULTI_KICK_DESC
|
||||
Arg Count: 1
|
||||
|
||||
### clearwanted
|
||||
CLEAR_WANTED_LEVEL_DESC
|
||||
Arg Count: 1
|
||||
|
299
docs/lua/tables/stats.md
Normal file
299
docs/lua/tables/stats.md
Normal file
@ -0,0 +1,299 @@
|
||||
# Table: stats
|
||||
|
||||
Table for manipulating GTA stats.
|
||||
|
||||
## Functions (21)
|
||||
|
||||
### `get_character_index()`
|
||||
|
||||
- **Returns:**
|
||||
- `integer`: The current multiplayer character index (0 or 1).
|
||||
|
||||
**Example Usage:**
|
||||
```lua
|
||||
integer = stats.get_character_index()
|
||||
```
|
||||
|
||||
### `get_bool(stat_hash)`
|
||||
|
||||
- **Parameters:**
|
||||
- `stat_hash` (integer): the stat hash.
|
||||
|
||||
- **Returns:**
|
||||
- `boolean`: The value of the given stat.
|
||||
|
||||
**Example Usage:**
|
||||
```lua
|
||||
boolean = stats.get_bool(stat_hash)
|
||||
```
|
||||
|
||||
### `get_bool(stat_name)`
|
||||
|
||||
- **Parameters:**
|
||||
- `stat_name` (string): the stat name.
|
||||
|
||||
- **Returns:**
|
||||
- `boolean`: The value of the given stat.
|
||||
|
||||
**Example Usage:**
|
||||
```lua
|
||||
boolean = stats.get_bool(stat_name)
|
||||
```
|
||||
|
||||
### `get_bool_masked(stat_hash, bit_index)`
|
||||
|
||||
- **Parameters:**
|
||||
- `stat_hash` (integer): the stat hash.
|
||||
- `bit_index` (integer): bit index.
|
||||
|
||||
- **Returns:**
|
||||
- `boolean`: The value of the given stat.
|
||||
|
||||
**Example Usage:**
|
||||
```lua
|
||||
boolean = stats.get_bool_masked(stat_hash, bit_index)
|
||||
```
|
||||
|
||||
### `get_bool_masked(stat_name, bit_index)`
|
||||
|
||||
- **Parameters:**
|
||||
- `stat_name` (string): the stat name.
|
||||
- `bit_index` (integer): bit index.
|
||||
|
||||
- **Returns:**
|
||||
- `boolean`: The value of the given stat.
|
||||
|
||||
**Example Usage:**
|
||||
```lua
|
||||
boolean = stats.get_bool_masked(stat_name, bit_index)
|
||||
```
|
||||
|
||||
### `get_float(stat_hash)`
|
||||
|
||||
- **Parameters:**
|
||||
- `stat_hash` (integer): the stat hash.
|
||||
|
||||
- **Returns:**
|
||||
- `float`: The value of the given stat.
|
||||
|
||||
**Example Usage:**
|
||||
```lua
|
||||
float = stats.get_float(stat_hash)
|
||||
```
|
||||
|
||||
### `get_float(stat_name)`
|
||||
|
||||
- **Parameters:**
|
||||
- `stat_name` (string): the stat name.
|
||||
|
||||
- **Returns:**
|
||||
- `float`: The value of the given stat.
|
||||
|
||||
**Example Usage:**
|
||||
```lua
|
||||
float = stats.get_float(stat_name)
|
||||
```
|
||||
|
||||
### `get_int(stat_hash)`
|
||||
|
||||
- **Parameters:**
|
||||
- `stat_hash` (integer): the stat hash.
|
||||
|
||||
- **Returns:**
|
||||
- `integer`: The value of the given stat.
|
||||
|
||||
**Example Usage:**
|
||||
```lua
|
||||
integer = stats.get_int(stat_hash)
|
||||
```
|
||||
|
||||
### `get_int(stat_name)`
|
||||
|
||||
- **Parameters:**
|
||||
- `stat_name` (string): the stat name.
|
||||
|
||||
- **Returns:**
|
||||
- `integer`: The value of the given stat.
|
||||
|
||||
**Example Usage:**
|
||||
```lua
|
||||
integer = stats.get_int(stat_name)
|
||||
```
|
||||
|
||||
### `get_masked_int(stat_hash, bit_start, bit_size)`
|
||||
|
||||
- **Parameters:**
|
||||
- `stat_hash` (integer): the stat hash.
|
||||
- `bit_start` (integer): bit start.
|
||||
- `bit_size` (integer): bit size.
|
||||
|
||||
- **Returns:**
|
||||
- `integer`: The value of the given stat.
|
||||
|
||||
**Example Usage:**
|
||||
```lua
|
||||
integer = stats.get_masked_int(stat_hash, bit_start, bit_size)
|
||||
```
|
||||
|
||||
### `get_masked_int(stat_name, bit_index, bit_size)`
|
||||
|
||||
- **Parameters:**
|
||||
- `stat_name` (string): the stat name.
|
||||
- `bit_index` (integer): bit index.
|
||||
- `bit_size` (integer): bit size.
|
||||
|
||||
- **Returns:**
|
||||
- `integer`: The value of the given stat.
|
||||
|
||||
**Example Usage:**
|
||||
```lua
|
||||
integer = stats.get_masked_int(stat_name, bit_index, bit_size)
|
||||
```
|
||||
|
||||
### `set_bool(stat_hash, new_value)`
|
||||
|
||||
- **Parameters:**
|
||||
- `stat_hash` (integer): the stat hash.
|
||||
- `new_value` (boolean): the new value for the stat.
|
||||
|
||||
- **Returns:**
|
||||
- `boolean`: True if succeeded.
|
||||
|
||||
**Example Usage:**
|
||||
```lua
|
||||
boolean = stats.set_bool(stat_hash, new_value)
|
||||
```
|
||||
|
||||
### `set_bool(stat_name, new_value)`
|
||||
|
||||
- **Parameters:**
|
||||
- `stat_name` (string): the stat name.
|
||||
- `new_value` (boolean): the new value for the stat.
|
||||
|
||||
- **Returns:**
|
||||
- `boolean`: True if succeeded.
|
||||
|
||||
**Example Usage:**
|
||||
```lua
|
||||
boolean = stats.set_bool(stat_name, new_value)
|
||||
```
|
||||
|
||||
### `set_bool_masked(stat_hash, new_value, bit_index)`
|
||||
|
||||
- **Parameters:**
|
||||
- `stat_hash` (integer): the stat hash.
|
||||
- `new_value` (boolean): the new value for the stat.
|
||||
- `bit_index` (integer): bit_index.
|
||||
|
||||
- **Returns:**
|
||||
- `boolean`: True if succeeded.
|
||||
|
||||
**Example Usage:**
|
||||
```lua
|
||||
boolean = stats.set_bool_masked(stat_hash, new_value, bit_index)
|
||||
```
|
||||
|
||||
### `set_bool_masked(stat_name, new_value, bit_index)`
|
||||
|
||||
- **Parameters:**
|
||||
- `stat_name` (string): the stat name.
|
||||
- `new_value` (boolean): the new value for the stat.
|
||||
- `bit_index` (integer): bit_index.
|
||||
|
||||
- **Returns:**
|
||||
- `boolean`: True if succeeded.
|
||||
|
||||
**Example Usage:**
|
||||
```lua
|
||||
boolean = stats.set_bool_masked(stat_name, new_value, bit_index)
|
||||
```
|
||||
|
||||
### `set_float(stat_hash, new_value)`
|
||||
|
||||
- **Parameters:**
|
||||
- `stat_hash` (integer): the stat hash.
|
||||
- `new_value` (float): the new value for the stat.
|
||||
|
||||
- **Returns:**
|
||||
- `boolean`: True if succeeded.
|
||||
|
||||
**Example Usage:**
|
||||
```lua
|
||||
boolean = stats.set_float(stat_hash, new_value)
|
||||
```
|
||||
|
||||
### `set_float(stat_name, new_value)`
|
||||
|
||||
- **Parameters:**
|
||||
- `stat_name` (string): the stat name.
|
||||
- `new_value` (float): the new value for the stat.
|
||||
|
||||
- **Returns:**
|
||||
- `boolean`: True if succeeded.
|
||||
|
||||
**Example Usage:**
|
||||
```lua
|
||||
boolean = stats.set_float(stat_name, new_value)
|
||||
```
|
||||
|
||||
### `set_int(stat_hash, new_value)`
|
||||
|
||||
- **Parameters:**
|
||||
- `stat_hash` (integer): the stat hash.
|
||||
- `new_value` (integer): the new value for the stat.
|
||||
|
||||
- **Returns:**
|
||||
- `boolean`: True if succeeded.
|
||||
|
||||
**Example Usage:**
|
||||
```lua
|
||||
boolean = stats.set_int(stat_hash, new_value)
|
||||
```
|
||||
|
||||
### `set_int(stat_name, new_value)`
|
||||
|
||||
- **Parameters:**
|
||||
- `stat_name` (string): the stat name.
|
||||
- `new_value` (integer): the new value for the stat.
|
||||
|
||||
- **Returns:**
|
||||
- `boolean`: True if succeeded.
|
||||
|
||||
**Example Usage:**
|
||||
```lua
|
||||
boolean = stats.set_int(stat_name, new_value)
|
||||
```
|
||||
|
||||
### `set_masked_int(stat_hash, new_value, bit_start, bit_size)`
|
||||
|
||||
- **Parameters:**
|
||||
- `stat_hash` (integer): the stat hash.
|
||||
- `new_value` (integer): the new value for the stat.
|
||||
- `bit_start` (integer): bit_start.
|
||||
- `bit_size` (integer): bit_size.
|
||||
|
||||
- **Returns:**
|
||||
- `boolean`: True if succeeded.
|
||||
|
||||
**Example Usage:**
|
||||
```lua
|
||||
boolean = stats.set_masked_int(stat_hash, new_value, bit_start, bit_size)
|
||||
```
|
||||
|
||||
### `set_masked_int(stat_name, new_value, bit_start, bit_size)`
|
||||
|
||||
- **Parameters:**
|
||||
- `stat_name` (string): the stat name.
|
||||
- `new_value` (integer): the new value for the stat.
|
||||
- `bit_start` (integer): bit_start.
|
||||
- `bit_size` (integer): bit_size.
|
||||
|
||||
- **Returns:**
|
||||
- `boolean`: True if succeeded.
|
||||
|
||||
**Example Usage:**
|
||||
```lua
|
||||
boolean = stats.set_masked_int(stat_name, new_value, bit_start, bit_size)
|
||||
```
|
||||
|
||||
|
@ -3,7 +3,7 @@ include(FetchContent)
|
||||
FetchContent_Declare(
|
||||
gtav_classes
|
||||
GIT_REPOSITORY https://github.com/Yimura/GTAV-Classes.git
|
||||
GIT_TAG 468161a36d95a355d9783eef5b245f3f1542e2bb
|
||||
GIT_TAG 0f88abb93d1499c04f440b77095ae4e02e5144ae
|
||||
GIT_PROGRESS TRUE
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "services/context_menu/context_menu_service.hpp"
|
||||
#include "services/custom_teleport/custom_teleport_service.hpp"
|
||||
#include "services/orbital_drone/orbital_drone.hpp"
|
||||
#include "services/ped_animations/ped_animations_service.hpp"
|
||||
#include "services/script_connection/script_connection_service.hpp"
|
||||
#include "services/squad_spawner/squad_spawner.hpp"
|
||||
#include "services/tunables/tunables_service.hpp"
|
||||
@ -19,7 +20,7 @@ namespace big
|
||||
{
|
||||
void backend::loop()
|
||||
{
|
||||
for (auto& command : g_looped_commands)
|
||||
for (auto& command : g_bool_commands)
|
||||
command->refresh();
|
||||
|
||||
register_script_patches();
|
||||
@ -27,6 +28,7 @@ namespace big
|
||||
g_squad_spawner_service.fetch_squads();
|
||||
g_xml_vehicles_service->fetch_xml_files();
|
||||
g_custom_teleport_service.fetch_saved_locations();
|
||||
g_ped_animation_service.fetch_saved_animations();
|
||||
|
||||
while (g_running)
|
||||
{
|
||||
@ -59,6 +61,16 @@ namespace big
|
||||
}
|
||||
}
|
||||
|
||||
void backend::ambient_animations_loop()
|
||||
{
|
||||
while (g_running)
|
||||
{
|
||||
g_ped_animation_service.ambient_animations_prompt_tick();
|
||||
|
||||
script::get_current()->yield();
|
||||
}
|
||||
}
|
||||
|
||||
void backend::weapons_loop()
|
||||
{
|
||||
LOG(INFO) << "Starting script: Weapons";
|
||||
|
@ -8,6 +8,7 @@ namespace big
|
||||
public:
|
||||
static void loop();
|
||||
static void self_loop();
|
||||
static void ambient_animations_loop();
|
||||
static void weapons_loop();
|
||||
static void vehicles_loop();
|
||||
static void misc_loop();
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include "bool_command.hpp"
|
||||
#include "fiber_pool.hpp"
|
||||
#include "services/translation_service/translation_service.hpp"
|
||||
|
||||
namespace big
|
||||
@ -8,9 +9,10 @@ namespace big
|
||||
m_toggle(toggle),
|
||||
m_show_notify(show_notify)
|
||||
{
|
||||
g_bool_commands.push_back(this);
|
||||
}
|
||||
|
||||
void bool_command::execute(const std::vector<uint64_t>& args, const std::shared_ptr<command_context> ctx)
|
||||
void bool_command::execute(const command_arguments& args, const std::shared_ptr<command_context> ctx)
|
||||
{
|
||||
if (args.size() == 0)
|
||||
{
|
||||
@ -31,15 +33,15 @@ namespace big
|
||||
}
|
||||
else
|
||||
{
|
||||
m_toggle = args[0];
|
||||
m_toggle = args.get<bool>(0);
|
||||
}
|
||||
|
||||
this->refresh();
|
||||
}
|
||||
|
||||
std::optional<std::vector<uint64_t>> bool_command::parse_args(const std::vector<std::string>& args, const std::shared_ptr<command_context> ctx)
|
||||
std::optional<command_arguments> bool_command::parse_args(const std::vector<std::string>& args, const std::shared_ptr<command_context> ctx)
|
||||
{
|
||||
std::vector<uint64_t> result;
|
||||
command_arguments result(1);
|
||||
|
||||
if (args.size() == 0)
|
||||
return result;
|
||||
@ -52,17 +54,59 @@ namespace big
|
||||
|
||||
if (args[0] == "yes" || args[0] == "on" || args[0] == "enable" || args[0] == "true")
|
||||
{
|
||||
result.push_back(1);
|
||||
result.push(true);
|
||||
return result;
|
||||
}
|
||||
|
||||
if (args[0] == "no" || args[0] == "off" || args[0] == "disable" || args[0] == "false")
|
||||
{
|
||||
result.push_back(0);
|
||||
result.push(false);
|
||||
return result;
|
||||
}
|
||||
|
||||
ctx->report_error(std::format("Cannot convert\"{}\" into a boolean in command {}", args[0], m_name));
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
void bool_command::enable()
|
||||
{
|
||||
if (!m_toggle)
|
||||
{
|
||||
m_toggle = true;
|
||||
m_last_enabled = true;
|
||||
g_fiber_pool->queue_job([this] {
|
||||
on_enable();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void bool_command::disable()
|
||||
{
|
||||
if (m_toggle)
|
||||
{
|
||||
m_toggle = false;
|
||||
m_last_enabled = false;
|
||||
g_fiber_pool->queue_job([this] {
|
||||
on_disable();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void bool_command::refresh()
|
||||
{
|
||||
if (m_toggle && !m_last_enabled)
|
||||
{
|
||||
m_last_enabled = true;
|
||||
g_fiber_pool->queue_job([this] {
|
||||
on_enable();
|
||||
});
|
||||
}
|
||||
else if (!m_toggle && m_last_enabled)
|
||||
{
|
||||
m_last_enabled = false;
|
||||
g_fiber_pool->queue_job([this] {
|
||||
on_disable();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -5,11 +5,13 @@ namespace big
|
||||
{
|
||||
class bool_command : public command
|
||||
{
|
||||
bool m_last_enabled = false;
|
||||
|
||||
protected:
|
||||
bool& m_toggle;
|
||||
bool m_show_notify;
|
||||
virtual void execute(const std::vector<uint64_t>& args, const std::shared_ptr<command_context> ctx = std::make_shared<default_command_context>()) override;
|
||||
virtual std::optional<std::vector<uint64_t>> parse_args(const std::vector<std::string>& args, const std::shared_ptr<command_context> ctx = std::make_shared<default_command_context>()) override;
|
||||
virtual void execute(const command_arguments& args, const std::shared_ptr<command_context> ctx = std::make_shared<default_command_context>()) override;
|
||||
virtual std::optional<command_arguments> parse_args(const std::vector<std::string>& args, const std::shared_ptr<command_context> ctx = std::make_shared<default_command_context>()) override;
|
||||
|
||||
public:
|
||||
bool_command(const std::string& name, const std::string& label, const std::string& description, bool& toggle, bool show_notify = true);
|
||||
@ -18,14 +20,13 @@ namespace big
|
||||
return m_toggle;
|
||||
}
|
||||
|
||||
virtual void refresh(){};
|
||||
virtual void enable()
|
||||
{
|
||||
m_toggle = true;
|
||||
};
|
||||
virtual void disable()
|
||||
{
|
||||
m_toggle = false;
|
||||
};
|
||||
virtual void on_enable(){};
|
||||
virtual void on_disable(){};
|
||||
virtual void refresh();
|
||||
|
||||
virtual void enable();
|
||||
virtual void disable();
|
||||
};
|
||||
|
||||
inline std::vector<bool_command*> g_bool_commands;
|
||||
}
|
@ -51,7 +51,7 @@ namespace big
|
||||
}
|
||||
}
|
||||
|
||||
void command::call(const std::vector<uint64_t>& args, const std::shared_ptr<command_context> ctx)
|
||||
void command::call(command_arguments& args, const std::shared_ptr<command_context> ctx)
|
||||
{
|
||||
if (m_num_args.has_value() && args.size() != m_num_args.value())
|
||||
{
|
||||
@ -68,6 +68,7 @@ namespace big
|
||||
return;
|
||||
}
|
||||
|
||||
args.reset_idx();
|
||||
if (m_fiber_pool)
|
||||
g_fiber_pool->queue_job([this, args, ctx] {
|
||||
execute(args, ctx);
|
||||
@ -103,7 +104,7 @@ namespace big
|
||||
return g_commands[command];
|
||||
}
|
||||
|
||||
void command::call(rage::joaat_t command, const std::vector<uint64_t>& args, const std::shared_ptr<command_context> ctx)
|
||||
void command::call(rage::joaat_t command, command_arguments& args, const std::shared_ptr<command_context> ctx)
|
||||
{
|
||||
g_commands[command]->call(args, ctx);
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
#pragma once
|
||||
#include "command_arguments.hpp"
|
||||
#include "context/command_context.hpp"
|
||||
#include "context/default_command_context.hpp"
|
||||
#include "core/enums.hpp"
|
||||
@ -17,10 +18,10 @@ namespace big
|
||||
std::optional<uint8_t> m_num_args;
|
||||
bool m_fiber_pool;
|
||||
|
||||
virtual void execute(const std::vector<uint64_t>& args, const std::shared_ptr<command_context> ctx = std::make_shared<default_command_context>()) = 0;
|
||||
virtual std::optional<std::vector<uint64_t>> parse_args(const std::vector<std::string>& args, const std::shared_ptr<command_context> ctx = std::make_shared<default_command_context>())
|
||||
virtual void execute(const command_arguments& args, const std::shared_ptr<command_context> ctx = std::make_shared<default_command_context>()) = 0;
|
||||
virtual std::optional<command_arguments> parse_args(const std::vector<std::string>& args, const std::shared_ptr<command_context> ctx = std::make_shared<default_command_context>())
|
||||
{
|
||||
return std::vector<uint64_t>();
|
||||
return {0};
|
||||
};
|
||||
virtual CommandAccessLevel get_access_level()
|
||||
{
|
||||
@ -54,13 +55,13 @@ namespace big
|
||||
return m_num_args;
|
||||
}
|
||||
|
||||
void call(const std::vector<uint64_t>& args, const std::shared_ptr<command_context> ctx = std::make_shared<default_command_context>());
|
||||
void call(command_arguments& args, const std::shared_ptr<command_context> ctx = std::make_shared<default_command_context>());
|
||||
void call(const std::vector<std::string>& args, const std::shared_ptr<command_context> ctx = std::make_shared<default_command_context>());
|
||||
static std::vector<command*> get_suggestions(std::string, int limit = 7);
|
||||
|
||||
static command* get(rage::joaat_t command);
|
||||
|
||||
static void call(rage::joaat_t command, const std::vector<uint64_t>& args, const std::shared_ptr<command_context> ctx = std::make_shared<default_command_context>());
|
||||
static void call(rage::joaat_t command, command_arguments& args, const std::shared_ptr<command_context> ctx = std::make_shared<default_command_context>());
|
||||
static void call(rage::joaat_t command, const std::vector<std::string>& args, const std::shared_ptr<command_context> ctx = std::make_shared<default_command_context>());
|
||||
|
||||
static bool process(const std::string& text, const std::shared_ptr<command_context> ctx = std::make_shared<default_command_context>(), bool use_best_suggestion = false);
|
||||
|
114
src/backend/command_arguments.hpp
Normal file
114
src/backend/command_arguments.hpp
Normal file
@ -0,0 +1,114 @@
|
||||
#pragma once
|
||||
#include <concepts>
|
||||
#include <stdexcept>
|
||||
#include <type_traits>
|
||||
|
||||
namespace big
|
||||
{
|
||||
template<typename T>
|
||||
concept ArgumentLimit = sizeof(T) <= sizeof(uint64_t);
|
||||
|
||||
class command_arguments
|
||||
{
|
||||
private:
|
||||
const std::size_t m_argument_count;
|
||||
std::vector<uint64_t> m_argument_data;
|
||||
mutable std::size_t m_idx;
|
||||
|
||||
public:
|
||||
command_arguments(std::size_t argument_count = 0) :
|
||||
m_argument_count(argument_count),
|
||||
m_argument_data(),
|
||||
m_idx(0)
|
||||
{
|
||||
m_argument_data.reserve(argument_count);
|
||||
}
|
||||
|
||||
command_arguments(std::size_t argument_count, const command_arguments& other) :
|
||||
command_arguments(argument_count)
|
||||
{
|
||||
std::copy_n(other.m_argument_data.begin(), std::min(argument_count, other.m_argument_data.size()), m_argument_data.begin());
|
||||
}
|
||||
|
||||
command_arguments(const std::vector<uint64_t>& vec) :
|
||||
command_arguments(vec.size())
|
||||
{
|
||||
m_argument_data = vec;
|
||||
}
|
||||
|
||||
template<typename T = uint64_t>
|
||||
requires ArgumentLimit<T>
|
||||
T get(std::size_t idx) const
|
||||
{
|
||||
return reinterpret_cast<const T&>(m_argument_data[idx]);
|
||||
}
|
||||
|
||||
template<typename T = uint64_t>
|
||||
requires ArgumentLimit<T>
|
||||
std::enable_if_t<std::is_pointer_v<T>, T> get(std::size_t idx) const
|
||||
{
|
||||
return static_cast<T>(m_argument_data[idx]);
|
||||
}
|
||||
|
||||
template<typename T = uint64_t>
|
||||
requires ArgumentLimit<T>
|
||||
T shift() const
|
||||
{
|
||||
if (m_idx >= m_argument_count)
|
||||
{
|
||||
throw std::runtime_error("Attempted to shift argument beyond allocated argument size.");
|
||||
}
|
||||
|
||||
return reinterpret_cast<const T&>(m_argument_data[m_idx++]);
|
||||
}
|
||||
|
||||
template<typename T = uint64_t>
|
||||
requires ArgumentLimit<T>
|
||||
std::enable_if_t<std::is_pointer_v<T>, T> shift() const
|
||||
{
|
||||
if (m_idx >= m_argument_count)
|
||||
{
|
||||
throw std::runtime_error("Attempted to shift argument beyond allocated argument size.");
|
||||
}
|
||||
|
||||
return static_cast<const T>(m_argument_data[m_idx++]);
|
||||
}
|
||||
|
||||
template<typename T = uint64_t>
|
||||
requires ArgumentLimit<T>
|
||||
void push(T arg)
|
||||
{
|
||||
if (m_idx++ >= m_argument_count)
|
||||
{
|
||||
throw std::runtime_error("Attempted to push argument beyond allocated argument size.");
|
||||
}
|
||||
|
||||
m_argument_data.push_back(reinterpret_cast<uint64_t&>(arg));
|
||||
}
|
||||
|
||||
template<typename T = uint64_t>
|
||||
requires ArgumentLimit<T>
|
||||
void set(std::size_t idx, T arg)
|
||||
{
|
||||
if (idx >= m_argument_count)
|
||||
{
|
||||
throw std::runtime_error("Attempted to set argument beyond allocated argument size.");
|
||||
}
|
||||
|
||||
m_argument_data[idx] = reinterpret_cast<uint64_t&>(arg);
|
||||
}
|
||||
|
||||
command_arguments& reset_idx()
|
||||
{
|
||||
m_idx = 0;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
std::size_t size() const
|
||||
{
|
||||
return m_argument_data.size();
|
||||
}
|
||||
|
||||
};
|
||||
}
|
@ -12,7 +12,7 @@ namespace big
|
||||
return CommandAccessLevel::NONE;
|
||||
}
|
||||
|
||||
virtual void execute(const std::vector<uint64_t>&, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(const command_arguments&, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
ctx->report_error("Money and recovery options are not supported in YimMenu to keep Rockstar/Take Two happy. You can try Kiddion's Modest Menu (free) instead, but make sure to only get it from UnknownCheats.me, the rest are scams and may contain malware");
|
||||
}
|
||||
|
@ -11,13 +11,16 @@ namespace big
|
||||
{
|
||||
using player_command::player_command;
|
||||
|
||||
virtual CommandAccessLevel get_access_level()
|
||||
virtual CommandAccessLevel get_access_level() override
|
||||
{
|
||||
return CommandAccessLevel::TOXIC;
|
||||
}
|
||||
|
||||
virtual void execute(player_ptr player, const std::vector<uint64_t>& _args, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
if (!player)
|
||||
return;
|
||||
|
||||
const size_t arg_count = 3;
|
||||
int64_t args[arg_count] = {(int64_t)eRemoteEvent::NetworkBail,
|
||||
(int64_t)self::id,
|
||||
|
@ -13,14 +13,14 @@ namespace big
|
||||
{
|
||||
using player_command::player_command;
|
||||
|
||||
virtual CommandAccessLevel get_access_level()
|
||||
virtual CommandAccessLevel get_access_level() override
|
||||
{
|
||||
return CommandAccessLevel::TOXIC;
|
||||
}
|
||||
|
||||
virtual void execute(player_ptr player, const std::vector<uint64_t>& _args, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
if (!g_player_service->get_self()->is_host() || !player->get_net_data())
|
||||
if (!player || !g_player_service->get_self()->is_host() || !player->get_net_data())
|
||||
return;
|
||||
|
||||
rage::snMsgRemoveGamersFromSessionCmd cmd{};
|
||||
|
@ -12,13 +12,15 @@ namespace big
|
||||
{
|
||||
using player_command::player_command;
|
||||
|
||||
virtual CommandAccessLevel get_access_level()
|
||||
virtual CommandAccessLevel get_access_level() override
|
||||
{
|
||||
return CommandAccessLevel::TOXIC;
|
||||
}
|
||||
|
||||
virtual void execute(player_ptr player, const std::vector<uint64_t>& _args, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
if (!player)
|
||||
return;
|
||||
if (gta_util::get_network()->m_game_session_ptr->is_host())
|
||||
{
|
||||
gta_util::get_network()->m_game_complaint_mgr.raise_complaint(player->get_net_data()->m_host_token);
|
||||
|
@ -10,13 +10,15 @@ namespace big
|
||||
{
|
||||
using player_command::player_command;
|
||||
|
||||
virtual CommandAccessLevel get_access_level()
|
||||
virtual CommandAccessLevel get_access_level() override
|
||||
{
|
||||
return CommandAccessLevel::TOXIC;
|
||||
}
|
||||
|
||||
virtual void execute(player_ptr player, const std::vector<uint64_t>& _args, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
if (!player)
|
||||
return;
|
||||
if (!scripts::force_host(RAGE_JOAAT("freemode")))
|
||||
{
|
||||
g_notification_service->push_error("Kick", "Force script host failed!");
|
||||
@ -25,6 +27,8 @@ namespace big
|
||||
|
||||
g_player_service->m_player_to_use_end_session_kick = player;
|
||||
*scr_globals::gsbd.as<int*>() = (int)(__rdtsc() % 50000) + 6; // making the game trigger the broadcast is a bit difficult and requires a little bit of tampering with the value and some luck
|
||||
script::get_current()->yield(5s);
|
||||
*scr_globals::gsbd.as<int*>() = 4;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -7,13 +7,15 @@ namespace big
|
||||
{
|
||||
using player_command::player_command;
|
||||
|
||||
virtual CommandAccessLevel get_access_level()
|
||||
virtual CommandAccessLevel get_access_level() override
|
||||
{
|
||||
return CommandAccessLevel::TOXIC;
|
||||
}
|
||||
|
||||
virtual void execute(player_ptr player, const std::vector<uint64_t>& _args, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
if (!player)
|
||||
return;
|
||||
if (!g_player_service->get_self()->is_host())
|
||||
{
|
||||
g_notification_service->push_error("Host kick", "Host kick failed");
|
||||
@ -24,5 +26,5 @@ namespace big
|
||||
}
|
||||
};
|
||||
|
||||
host_kick g_host_kick("hostkick", "Host Kick", "Host kick that only works when host", 0, false);
|
||||
host_kick g_host_kick("hostkick", "HOST_KICK", "HOST_KICK_DESC", 0, false);
|
||||
}
|
38
src/backend/commands/player/kick/multi_kick.cpp
Normal file
38
src/backend/commands/player/kick/multi_kick.cpp
Normal file
@ -0,0 +1,38 @@
|
||||
#include "backend/player_command.hpp"
|
||||
#include "core/scr_globals.hpp"
|
||||
#include "natives.hpp"
|
||||
#include "pointers.hpp"
|
||||
#include "script.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
class multi_kick : player_command
|
||||
{
|
||||
using player_command::player_command;
|
||||
|
||||
virtual CommandAccessLevel get_access_level() override
|
||||
{
|
||||
return CommandAccessLevel::TOXIC;
|
||||
}
|
||||
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
dynamic_cast<player_command*>(command::get(RAGE_JOAAT("nfkick")))->call(player, {});
|
||||
dynamic_cast<player_command*>(command::get(RAGE_JOAAT("oomkick")))->call(player, {});
|
||||
dynamic_cast<player_command*>(command::get(RAGE_JOAAT("endkick")))->call(player, {});
|
||||
script::get_current()->yield(700ms);
|
||||
|
||||
if (g_player_service->get_self()->is_host())
|
||||
dynamic_cast<player_command*>(command::get(RAGE_JOAAT("hostkick")))->call(player, {});
|
||||
|
||||
if (player && !g_player_service->get_self()->is_host() && player->is_valid() && !player->is_host())
|
||||
dynamic_cast<player_command*>(command::get(RAGE_JOAAT("desync")))->call(player, {});
|
||||
|
||||
if (g_player_service->get_self()->is_host())
|
||||
dynamic_cast<player_command*>(command::get(RAGE_JOAAT("breakup")))->call(player, {}),
|
||||
NETWORK::NETWORK_SESSION_KICK_PLAYER(player->id());
|
||||
}
|
||||
};
|
||||
|
||||
multi_kick g_multi_kick("multikick", "MULTI_KICK", "MULTI_KICK_DESC", 0, false);
|
||||
}
|
@ -9,13 +9,15 @@ namespace big
|
||||
{
|
||||
using player_command::player_command;
|
||||
|
||||
virtual CommandAccessLevel get_access_level()
|
||||
virtual CommandAccessLevel get_access_level() override
|
||||
{
|
||||
return CommandAccessLevel::TOXIC;
|
||||
}
|
||||
|
||||
virtual void execute(player_ptr player, const std::vector<uint64_t>& _args, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
if (!player)
|
||||
return;
|
||||
const size_t arg_count = 15;
|
||||
int64_t args[arg_count] = {(int64_t)eRemoteEvent::InteriorControl, (int64_t)self::id, (int64_t)(int)-1};
|
||||
|
||||
|
@ -13,13 +13,15 @@ namespace big
|
||||
{
|
||||
using player_command::player_command;
|
||||
|
||||
virtual CommandAccessLevel get_access_level()
|
||||
{
|
||||
virtual CommandAccessLevel get_access_level() override
|
||||
{
|
||||
return CommandAccessLevel::TOXIC;
|
||||
}
|
||||
|
||||
virtual void execute(player_ptr player, const std::vector<uint64_t>& _args, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
if (!player)
|
||||
return;
|
||||
packet msg{};
|
||||
|
||||
msg.write_message(rage::eNetMessage::MsgRadioStationSyncRequest);
|
||||
|
@ -10,13 +10,15 @@ namespace big
|
||||
{
|
||||
using player_command::player_command;
|
||||
|
||||
virtual CommandAccessLevel get_access_level()
|
||||
virtual CommandAccessLevel get_access_level() override
|
||||
{
|
||||
return CommandAccessLevel::TOXIC;
|
||||
}
|
||||
|
||||
virtual void execute(player_ptr player, const std::vector<uint64_t>& _args, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
if (!player)
|
||||
return;
|
||||
if (!scripts::force_host(RAGE_JOAAT("freemode")))
|
||||
{
|
||||
g_notification_service->push_error("Kick", "Force script host failed!");
|
||||
|
@ -9,12 +9,12 @@ namespace big
|
||||
{
|
||||
using player_command::player_command;
|
||||
|
||||
virtual CommandAccessLevel get_access_level()
|
||||
virtual CommandAccessLevel get_access_level() override
|
||||
{
|
||||
return CommandAccessLevel::FRIENDLY;
|
||||
}
|
||||
|
||||
virtual void execute(player_ptr player, const std::vector<uint64_t>& _args, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
globals::clear_wanted_player(player->id());
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ namespace big
|
||||
{
|
||||
using player_command::player_command;
|
||||
|
||||
virtual void execute(player_ptr player, const std::vector<uint64_t>& _args, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
int id = player->id();
|
||||
if (scr_globals::gpbd_fm_1.as<GPBD_FM*>()->Entries[id].PropertyData.Index != -1)
|
||||
@ -33,11 +33,11 @@ namespace big
|
||||
}
|
||||
else if (scr_globals::globalplayer_bd.as<GlobalPlayerBD*>()->Entries[id].SimpleInteriorData.Index != eSimpleInteriorIndex::SIMPLE_INTERIOR_INVALID)
|
||||
{
|
||||
*script_global(1950844).at(3347).as<Player*>() =
|
||||
*scr_globals::interiors.at(3347).as<Player*>() =
|
||||
scr_globals::globalplayer_bd.as<GlobalPlayerBD*>()->Entries[id].SimpleInteriorData.Owner;
|
||||
*script_global(1950844).at(3684).as<eSimpleInteriorIndex*>() =
|
||||
*scr_globals::interiors.at(3684).as<eSimpleInteriorIndex*>() =
|
||||
scr_globals::globalplayer_bd.as<GlobalPlayerBD*>()->Entries[id].SimpleInteriorData.Index;
|
||||
*script_global(1950844).at(3683).as<bool*>() = true;
|
||||
*scr_globals::interiors.at(3683).as<bool*>() = true;
|
||||
scr_globals::globalplayer_bd.as<GlobalPlayerBD*>()->Entries[self::id].SimpleInteriorData.InteriorSubtype =
|
||||
scr_globals::globalplayer_bd.as<GlobalPlayerBD*>()->Entries[id].SimpleInteriorData.InteriorSubtype;
|
||||
}
|
||||
|
@ -10,12 +10,12 @@ namespace big
|
||||
{
|
||||
using player_command::player_command;
|
||||
|
||||
virtual CommandAccessLevel get_access_level()
|
||||
virtual CommandAccessLevel get_access_level() override
|
||||
{
|
||||
return CommandAccessLevel::FRIENDLY;
|
||||
}
|
||||
|
||||
virtual void execute(player_ptr player, const std::vector<uint64_t>& _args, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
g_pickup_service->give_player_health(player->id());
|
||||
}
|
||||
|
@ -10,12 +10,12 @@ namespace big
|
||||
{
|
||||
using player_command::player_command;
|
||||
|
||||
virtual CommandAccessLevel get_access_level()
|
||||
virtual CommandAccessLevel get_access_level() override
|
||||
{
|
||||
return CommandAccessLevel::FRIENDLY;
|
||||
}
|
||||
|
||||
virtual void execute(player_ptr player, const std::vector<uint64_t>& _args, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
g_pickup_service->give_armour(player->id());
|
||||
}
|
||||
|
@ -10,12 +10,12 @@ namespace big
|
||||
{
|
||||
using player_command::player_command;
|
||||
|
||||
virtual CommandAccessLevel get_access_level()
|
||||
virtual CommandAccessLevel get_access_level() override
|
||||
{
|
||||
return CommandAccessLevel::FRIENDLY;
|
||||
}
|
||||
|
||||
virtual void execute(player_ptr player, const std::vector<uint64_t>& _args, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
g_pickup_service->give_player_health(player->id());
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ namespace big
|
||||
{
|
||||
using player_command::player_command;
|
||||
|
||||
virtual void execute(player_ptr player, const std::vector<uint64_t>& _args, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
scr_functions::join_ceo({player->id(), 0, false, false});
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ namespace big
|
||||
{
|
||||
using player_command::player_command;
|
||||
|
||||
virtual void execute(player_ptr player, const std::vector<uint64_t>& _args, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
ped::steal_identity(PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player->id()));
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ namespace big
|
||||
{
|
||||
using player_command::player_command;
|
||||
|
||||
virtual void execute(player_ptr player, const std::vector<uint64_t>& _args, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
ped::steal_outfit(PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player->id()));
|
||||
}
|
||||
|
@ -11,12 +11,12 @@ namespace big
|
||||
{
|
||||
using player_command::player_command;
|
||||
|
||||
virtual CommandAccessLevel get_access_level()
|
||||
virtual CommandAccessLevel get_access_level() override
|
||||
{
|
||||
return CommandAccessLevel::AGGRESSIVE;
|
||||
}
|
||||
|
||||
virtual void execute(player_ptr player, const std::vector<uint64_t>& _args, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
auto leader = scr_globals::gpbd_fm_3.as<GPBD_FM_3*>()->Entries[player->id()].BossGoon.Boss;
|
||||
|
||||
|
@ -9,13 +9,13 @@ namespace big
|
||||
{
|
||||
using player_command::player_command;
|
||||
|
||||
virtual CommandAccessLevel get_access_level()
|
||||
virtual CommandAccessLevel get_access_level() override
|
||||
{
|
||||
return CommandAccessLevel::AGGRESSIVE;
|
||||
}
|
||||
|
||||
virtual void execute(player_ptr player, const std::vector<uint64_t>& _args, const std::shared_ptr<command_context> ctx)
|
||||
{
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
toxic::blame_explode_player(player, player, EXP_TAG_SUBMARINE_BIG, 9999.0f, true, false, 9999.0f);
|
||||
}
|
||||
};
|
||||
|
@ -9,12 +9,12 @@ namespace big
|
||||
{
|
||||
using player_command::player_command;
|
||||
|
||||
virtual CommandAccessLevel get_access_level()
|
||||
virtual CommandAccessLevel get_access_level() override
|
||||
{
|
||||
return CommandAccessLevel::AGGRESSIVE;
|
||||
}
|
||||
|
||||
virtual void execute(player_ptr player, const std::vector<uint64_t>& _args, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
const size_t arg_count = 3;
|
||||
int64_t args[arg_count] = {(int64_t)eRemoteEvent::ForceMission, (int64_t)self::id, 0};
|
||||
|
@ -10,12 +10,12 @@ namespace big
|
||||
{
|
||||
using player_command::player_command;
|
||||
|
||||
virtual CommandAccessLevel get_access_level()
|
||||
virtual CommandAccessLevel get_access_level() override
|
||||
{
|
||||
return CommandAccessLevel::FRIENDLY;
|
||||
}
|
||||
|
||||
virtual void execute(player_ptr player, const std::vector<uint64_t>& _args, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
for (auto& weapon : g_gta_data_service->weapons())
|
||||
WEAPON::GIVE_WEAPON_TO_PED(PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player->id()), weapon.second.m_hash, 9999, FALSE, FALSE);
|
||||
@ -26,12 +26,12 @@ namespace big
|
||||
{
|
||||
using command::command;
|
||||
|
||||
virtual CommandAccessLevel get_access_level()
|
||||
virtual CommandAccessLevel get_access_level() override
|
||||
{
|
||||
return CommandAccessLevel::FRIENDLY;
|
||||
}
|
||||
|
||||
virtual void execute(const std::vector<uint64_t>& _args, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
g_player_service->iterate([](auto& plyr) {
|
||||
for (auto& weapon : g_gta_data_service->weapons())
|
||||
|
@ -18,12 +18,12 @@ namespace big
|
||||
{
|
||||
using player_command::player_command;
|
||||
|
||||
virtual CommandAccessLevel get_access_level()
|
||||
virtual CommandAccessLevel get_access_level() override
|
||||
{
|
||||
return CommandAccessLevel::AGGRESSIVE;
|
||||
}
|
||||
|
||||
virtual void execute(player_ptr player, const std::vector<uint64_t>& _args, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
if (scr_globals::gpbd_fm_1.as<GPBD_FM*>()->Entries[player->id()].PropertyData.Index != -1)
|
||||
{
|
||||
|
@ -9,12 +9,12 @@ namespace big
|
||||
{
|
||||
using player_command::player_command;
|
||||
|
||||
virtual CommandAccessLevel get_access_level()
|
||||
virtual CommandAccessLevel get_access_level() override
|
||||
{
|
||||
return CommandAccessLevel::AGGRESSIVE;
|
||||
}
|
||||
|
||||
virtual void execute(player_ptr player, const std::vector<uint64_t>& _args, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
auto vehicle = player->get_current_vehicle();
|
||||
|
||||
|
@ -8,12 +8,12 @@ namespace big
|
||||
{
|
||||
using player_command::player_command;
|
||||
|
||||
virtual CommandAccessLevel get_access_level()
|
||||
virtual CommandAccessLevel get_access_level() override
|
||||
{
|
||||
return CommandAccessLevel::AGGRESSIVE;
|
||||
}
|
||||
|
||||
virtual void execute(player_ptr player, const std::vector<uint64_t>& _args, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
if (!player->get_ped())
|
||||
return;
|
||||
|
@ -8,13 +8,13 @@ namespace big
|
||||
{
|
||||
using player_command::player_command;
|
||||
|
||||
virtual CommandAccessLevel get_access_level()
|
||||
virtual CommandAccessLevel get_access_level() override
|
||||
{
|
||||
return CommandAccessLevel::AGGRESSIVE;
|
||||
}
|
||||
|
||||
virtual void execute(player_ptr player, const std::vector<uint64_t>& _args, const std::shared_ptr<command_context> ctx)
|
||||
{
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
if (auto ped = player->get_ped())
|
||||
if (auto net_object = ped->m_net_object)
|
||||
g_pointers->m_gta.m_request_ragdoll(net_object->m_object_id);
|
||||
|
@ -9,12 +9,12 @@ namespace big
|
||||
{
|
||||
using player_command::player_command;
|
||||
|
||||
virtual CommandAccessLevel get_access_level()
|
||||
virtual CommandAccessLevel get_access_level() override
|
||||
{
|
||||
return CommandAccessLevel::AGGRESSIVE;
|
||||
}
|
||||
|
||||
virtual void execute(player_ptr player, const std::vector<uint64_t>& _args, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
for (auto& [_, weapon] : g_gta_data_service->weapons())
|
||||
WEAPON::REMOVE_WEAPON_FROM_PED(PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player->id()), weapon.m_hash);
|
||||
|
@ -11,12 +11,12 @@ namespace big
|
||||
{
|
||||
using player_command::player_command;
|
||||
|
||||
virtual CommandAccessLevel get_access_level()
|
||||
virtual CommandAccessLevel get_access_level() override
|
||||
{
|
||||
return CommandAccessLevel::AGGRESSIVE;
|
||||
}
|
||||
|
||||
virtual void execute(player_ptr player, const std::vector<uint64_t>& _args, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
const size_t arg_count = 8;
|
||||
int64_t args[arg_count] = {(int64_t)eRemoteEvent::SendTextLabelSMS, self::id};
|
||||
|
@ -15,12 +15,12 @@ namespace big
|
||||
{
|
||||
using player_command::player_command;
|
||||
|
||||
virtual CommandAccessLevel get_access_level()
|
||||
virtual CommandAccessLevel get_access_level() override
|
||||
{
|
||||
return CommandAccessLevel::AGGRESSIVE;
|
||||
}
|
||||
|
||||
virtual void execute(player_ptr player, const std::vector<uint64_t>& _args, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
const size_t arg_count = 8;
|
||||
int64_t args[arg_count] = {(int64_t)eRemoteEvent::SendTextLabelSMS, self::id};
|
||||
|
@ -9,20 +9,15 @@ namespace big
|
||||
{
|
||||
using player_command::player_command;
|
||||
|
||||
virtual std::optional<std::vector<uint64_t>> parse_args_p(const std::vector<std::string>& args, const std::shared_ptr<command_context> ctx)
|
||||
{
|
||||
return std::vector<uint64_t>{(uint64_t)std::atoi(args[0].c_str())};
|
||||
}
|
||||
|
||||
virtual CommandAccessLevel get_access_level()
|
||||
virtual CommandAccessLevel get_access_level() override
|
||||
{
|
||||
return CommandAccessLevel::AGGRESSIVE;
|
||||
}
|
||||
|
||||
virtual void execute(player_ptr player, const std::vector<uint64_t>& _args, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
const size_t arg_count = 9;
|
||||
int64_t args[arg_count] = {(int64_t)eRemoteEvent::Teleport, self::id, (int64_t)player->id(), (int64_t)(int)-1, 1, (int64_t)_args[0], 1, 1, 1};
|
||||
int64_t args[arg_count] = {(int64_t)eRemoteEvent::Teleport, self::id, (int64_t)player->id(), (int64_t)(int)-1, 1, (int64_t)_args.get<int64_t>(0), 1, 1, 1};
|
||||
|
||||
g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << player->id());
|
||||
}
|
||||
|
@ -8,24 +8,19 @@ namespace big
|
||||
{
|
||||
using player_command::player_command;
|
||||
|
||||
virtual std::optional<std::vector<uint64_t>> parse_args_p(const std::vector<std::string>& args, const std::shared_ptr<command_context> ctx)
|
||||
{
|
||||
return std::vector<uint64_t>{(uint64_t)std::atoi(args[0].c_str())};
|
||||
}
|
||||
|
||||
virtual CommandAccessLevel get_access_level()
|
||||
virtual CommandAccessLevel get_access_level() override
|
||||
{
|
||||
return CommandAccessLevel::AGGRESSIVE;
|
||||
}
|
||||
|
||||
virtual void execute(player_ptr player, const std::vector<uint64_t>& _args, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
float max = 1e+38f;
|
||||
auto coords = ENTITY::GET_ENTITY_COORDS(PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player->id()), FALSE);
|
||||
const size_t arg_count = 15;
|
||||
int64_t args[arg_count] = {(int64_t)eRemoteEvent::InteriorControl,
|
||||
(int64_t)self::id,
|
||||
(int64_t)(int)_args[0],
|
||||
(int64_t)_args.get<int>(0),
|
||||
(int64_t)self::id,
|
||||
(int64_t) false,
|
||||
(int64_t) true, // true means enter sender interior
|
||||
|
@ -9,20 +9,15 @@ namespace big
|
||||
{
|
||||
using player_command::player_command;
|
||||
|
||||
virtual std::optional<std::vector<uint64_t>> parse_args_p(const std::vector<std::string>& args, const std::shared_ptr<command_context> ctx)
|
||||
{
|
||||
return std::vector<uint64_t>{(uint64_t)std::atoi(args[0].c_str())};
|
||||
}
|
||||
|
||||
virtual CommandAccessLevel get_access_level()
|
||||
virtual CommandAccessLevel get_access_level() override
|
||||
{
|
||||
return CommandAccessLevel::AGGRESSIVE;
|
||||
}
|
||||
|
||||
virtual void execute(player_ptr player, const std::vector<uint64_t>& _args, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
const size_t arg_count = 6;
|
||||
int64_t args[arg_count] = {(int64_t)eRemoteEvent::TeleportToWarehouse, self::id, (int64_t)player->id(), 1, (int64_t)_args[0]};
|
||||
int64_t args[arg_count] = {(int64_t)eRemoteEvent::TeleportToWarehouse, self::id, (int64_t)player->id(), 1, (int64_t)_args.get<int>(0)};
|
||||
|
||||
g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << player->id());
|
||||
}
|
||||
|
@ -13,55 +13,53 @@ namespace big
|
||||
{
|
||||
using player_command::player_command;
|
||||
|
||||
virtual std::optional<std::vector<uint64_t>> parse_args_p(const std::vector<std::string>& args, const std::shared_ptr<command_context> ctx)
|
||||
virtual std::optional<command_arguments> parse_args_p(const std::vector<std::string>& args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
uint64_t level = std::atoi(args[0].c_str());
|
||||
const auto level = std::atoi(args[0].c_str());
|
||||
|
||||
if (level < 0 || level > 5)
|
||||
{
|
||||
ctx->report_error(std::format("Wanted level {} is invalid", level));
|
||||
ctx->report_error(std::format("Wanted level {} is invalid [0 - 5]", level));
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
return std::vector<uint64_t>{level};
|
||||
command_arguments result(1);
|
||||
result.push(level);
|
||||
return result;
|
||||
}
|
||||
|
||||
virtual CommandAccessLevel get_access_level()
|
||||
virtual CommandAccessLevel get_access_level() override
|
||||
{
|
||||
return CommandAccessLevel::AGGRESSIVE;
|
||||
}
|
||||
|
||||
virtual void execute(player_ptr player, const std::vector<uint64_t>& _args, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
const auto wanted_level = _args.get<int>(0);
|
||||
if (player->id() == self::id)
|
||||
{
|
||||
PLAYER::SET_PLAYER_WANTED_LEVEL(self::id, _args[0], FALSE);
|
||||
PLAYER::SET_PLAYER_WANTED_LEVEL(self::id, wanted_level, FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
int id = player->id();
|
||||
|
||||
if (PLAYER::GET_PLAYER_WANTED_LEVEL(id) > _args[0])
|
||||
if (PLAYER::GET_PLAYER_WANTED_LEVEL(id) > wanted_level)
|
||||
{
|
||||
// clear existing wanted
|
||||
globals::clear_wanted_player(id);
|
||||
|
||||
for (int i = 0; PLAYER::GET_PLAYER_WANTED_LEVEL(id) > _args[0] && i < 3600; i++)
|
||||
for (int i = 0; PLAYER::GET_PLAYER_WANTED_LEVEL(id) > wanted_level && i < 3600; i++)
|
||||
script::get_current()->yield(1ms);
|
||||
}
|
||||
|
||||
if (_args[0] > 0)
|
||||
if (wanted_level > 0)
|
||||
{
|
||||
auto& gpbd = scr_globals::globalplayer_bd.as<GlobalPlayerBD*>()->Entries[self::id];
|
||||
|
||||
gpbd.RemoteWantedLevelPlayer = id;
|
||||
gpbd.RemoteWantedLevelAmount = _args[0];
|
||||
|
||||
for (int i = 0; PLAYER::GET_PLAYER_WANTED_LEVEL(id) < _args[0] && i < 3600; i++)
|
||||
script::get_current()->yield(1ms);
|
||||
|
||||
gpbd.RemoteWantedLevelPlayer = -1;
|
||||
gpbd.RemoteWantedLevelAmount = -1;
|
||||
for (int i = 0; PLAYER::GET_PLAYER_WANTED_LEVEL(id) < wanted_level && player->is_valid() && i < 10; i++)
|
||||
{
|
||||
g_pointers->m_gta.m_set_wanted_level(player->get_net_game_player(), wanted_level, 0, -1);
|
||||
script::get_current()->yield(200ms);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,13 +11,13 @@ namespace big
|
||||
{
|
||||
using player_command::player_command;
|
||||
|
||||
virtual CommandAccessLevel get_access_level()
|
||||
virtual CommandAccessLevel get_access_level() override
|
||||
{
|
||||
return CommandAccessLevel::AGGRESSIVE;
|
||||
}
|
||||
|
||||
virtual void execute(player_ptr player, const std::vector<uint64_t>& _args, const std::shared_ptr<command_context> ctx)
|
||||
{
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx)override
|
||||
{
|
||||
const size_t arg_count = 8;
|
||||
int64_t args[arg_count] = {(int64_t)eRemoteEvent::TransactionError,
|
||||
(int64_t)self::id,
|
||||
|
@ -13,12 +13,12 @@ namespace big
|
||||
{
|
||||
using player_command::player_command;
|
||||
|
||||
virtual CommandAccessLevel get_access_level()
|
||||
virtual CommandAccessLevel get_access_level() override
|
||||
{
|
||||
return CommandAccessLevel::AGGRESSIVE;
|
||||
}
|
||||
|
||||
virtual void execute(player_ptr player, const std::vector<uint64_t>& _args, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
const size_t arg_count = 25;
|
||||
int64_t args[arg_count] = {(int64_t)eRemoteEvent::StartScriptBegin, (int64_t)self::id};
|
||||
|
@ -8,12 +8,12 @@ namespace big
|
||||
{
|
||||
using player_command::player_command;
|
||||
|
||||
virtual CommandAccessLevel get_access_level()
|
||||
virtual CommandAccessLevel get_access_level() override
|
||||
{
|
||||
return CommandAccessLevel::AGGRESSIVE;
|
||||
}
|
||||
|
||||
virtual void execute(player_ptr player, const std::vector<uint64_t>& _args, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
const size_t arg_count = 3;
|
||||
int64_t args[arg_count] = {(int64_t)eRemoteEvent::TriggerCEORaid, (int64_t)self::id, 0};
|
||||
|
@ -10,12 +10,12 @@ namespace big
|
||||
{
|
||||
using player_command::player_command;
|
||||
|
||||
virtual CommandAccessLevel get_access_level()
|
||||
virtual CommandAccessLevel get_access_level() override
|
||||
{
|
||||
return CommandAccessLevel::AGGRESSIVE;
|
||||
}
|
||||
|
||||
virtual void execute(player_ptr player, const std::vector<uint64_t>& _args, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
auto id = player->id();
|
||||
|
||||
@ -81,7 +81,7 @@ namespace big
|
||||
return CommandAccessLevel::AGGRESSIVE;
|
||||
}
|
||||
|
||||
virtual void execute(const std::vector<uint64_t>& _args, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(const command_arguments& _args, const std::shared_ptr<command_context> ctx)
|
||||
{
|
||||
scripts::start_launcher_script(47);
|
||||
|
||||
|
@ -10,7 +10,7 @@ namespace big
|
||||
{
|
||||
using player_command::player_command;
|
||||
|
||||
virtual void execute(player_ptr player, const std::vector<uint64_t>& _args, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
teleport::bring_player(player);
|
||||
}
|
||||
@ -20,7 +20,7 @@ namespace big
|
||||
{
|
||||
using command::command;
|
||||
|
||||
virtual void execute(const std::vector<uint64_t>& _args, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
for (auto& player : g_player_service->players())
|
||||
g_fiber_pool->queue_job([player]() {
|
||||
|
@ -10,7 +10,7 @@ namespace big
|
||||
{
|
||||
using player_command::player_command;
|
||||
|
||||
virtual void execute(player_ptr player, const std::vector<uint64_t>& _args, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
troll::set_bounty_on_player(player, 10000, g.session.anonymous_bounty);
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ namespace big
|
||||
{
|
||||
using player_command::player_command;
|
||||
|
||||
virtual void execute(player_ptr player, const std::vector<uint64_t>& _args, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
teleport::to_player(player->id());
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ namespace big
|
||||
{
|
||||
using player_command::player_command;
|
||||
|
||||
virtual void execute(player_ptr player, const std::vector<uint64_t>& _args, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
Vehicle veh =
|
||||
PED::GET_VEHICLE_PED_IS_IN(PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(g_player_service->get_selected()->id()), false);
|
||||
|
@ -9,7 +9,7 @@ namespace big
|
||||
{
|
||||
using player_command::player_command;
|
||||
|
||||
virtual void execute(player_ptr player, const std::vector<uint64_t>& _args, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
Ped ped = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player->id());
|
||||
if (!PED::IS_PED_IN_ANY_VEHICLE(ped, true))
|
||||
|
46
src/backend/commands/player/vehicle/break_doors.cpp
Normal file
46
src/backend/commands/player/vehicle/break_doors.cpp
Normal file
@ -0,0 +1,46 @@
|
||||
#include "backend/player_command.hpp"
|
||||
#include "gta/net_game_event.hpp"
|
||||
#include "natives.hpp"
|
||||
#include "pointers.hpp"
|
||||
#include "util/teleport.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
inline void break_vehicle_door(CVehicle* vehicle, std::uint8_t door_index)
|
||||
{
|
||||
if (!vehicle->m_net_object)
|
||||
return;
|
||||
|
||||
int object_id = vehicle->m_net_object->m_object_id;
|
||||
|
||||
g_pointers->m_gta.m_check_event_queue(*g_pointers->m_gta.m_net_event_manager, true);
|
||||
|
||||
CDoorBreakEvent* event =
|
||||
reinterpret_cast<CDoorBreakEvent*>(g_pointers->m_gta.m_get_new_pool_item(*g_pointers->m_gta.m_net_event_pool));
|
||||
|
||||
if (!event)
|
||||
return;
|
||||
|
||||
g_pointers->m_gta.m_construct_door_break_event(event);
|
||||
|
||||
event->m_vehicle_id = object_id;
|
||||
event->m_door_id = door_index;
|
||||
|
||||
g_pointers->m_gta.m_queue_network_event(*g_pointers->m_gta.m_net_event_manager, event);
|
||||
}
|
||||
|
||||
class break_doors : player_command
|
||||
{
|
||||
using player_command::player_command;
|
||||
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx)
|
||||
{
|
||||
Ped ped = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player->id());
|
||||
Vehicle vehicle = PED::GET_VEHICLE_PED_IS_IN(ped, false);
|
||||
for (int i = 0; i < VEHICLE::GET_NUMBER_OF_VEHICLE_DOORS(vehicle); i++)
|
||||
break_vehicle_door(player->get_current_vehicle(), i);
|
||||
}
|
||||
};
|
||||
|
||||
break_doors g_break_doors("breakdoors", "Break Vehicle Doors", "Breaks all vehicle doors", 0);
|
||||
}
|
@ -9,7 +9,7 @@ namespace big
|
||||
{
|
||||
using player_command::player_command;
|
||||
|
||||
virtual void execute(player_ptr player, const std::vector<uint64_t>& _args, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
Ped ped = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player->id());
|
||||
|
||||
@ -33,5 +33,5 @@ namespace big
|
||||
}
|
||||
};
|
||||
|
||||
burst_tyres g_burst_tyres("burstwheels", "Burst Vehicle Tyres", "Removes their tyres.", 0);
|
||||
burst_tyres g_burst_tyres("burstwheels", "Burst Vehicle Tyres", "Removes their tyres", 0);
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ namespace big
|
||||
{
|
||||
using player_command::player_command;
|
||||
|
||||
virtual void execute(player_ptr player, const std::vector<uint64_t>& _args, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
Ped ped = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player->id());
|
||||
|
||||
|
@ -9,7 +9,7 @@ namespace big
|
||||
{
|
||||
using player_command::player_command;
|
||||
|
||||
virtual void execute(player_ptr player, const std::vector<uint64_t>& _args, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
Ped ped = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player->id());
|
||||
Vehicle vehicle = PED::GET_VEHICLE_PED_IS_IN(ped, false);
|
||||
|
@ -9,7 +9,7 @@ namespace big
|
||||
{
|
||||
using player_command::player_command;
|
||||
|
||||
virtual void execute(player_ptr player, const std::vector<uint64_t>& _args, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
Ped player_ped = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player->id());
|
||||
Vehicle vehicle = PED::GET_VEHICLE_PED_IS_IN(player_ped, false);
|
||||
@ -41,6 +41,6 @@ namespace big
|
||||
};
|
||||
|
||||
flip_180
|
||||
g_flip_180("flip180", "Rotate 180", "Rotates their car around", 0)
|
||||
g_flip_180("flip180", "Rotate 180", "Rotates the player's car around", 0)
|
||||
;
|
||||
}
|
@ -9,7 +9,7 @@ namespace big
|
||||
{
|
||||
using player_command::player_command;
|
||||
|
||||
virtual void execute(player_ptr player, const std::vector<uint64_t>& _args, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
Entity ent = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player->id());
|
||||
|
||||
@ -29,5 +29,5 @@ namespace big
|
||||
}
|
||||
};
|
||||
|
||||
flying_vehicle g_flying_vehicle("flyingveh", "Flying Vehicle", "Catapults their car to the sky.", 0);
|
||||
flying_vehicle g_flying_vehicle("flyingveh", "Flying Vehicle", "Catapults the player's car to the sky", 0);
|
||||
}
|
@ -8,7 +8,7 @@ namespace big
|
||||
{
|
||||
using player_command::player_command;
|
||||
|
||||
virtual void execute(player_ptr player, const std::vector<uint64_t>& _args, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
Ped ped = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player->id());
|
||||
if (!PED::IS_PED_IN_ANY_VEHICLE(ped, true))
|
||||
|
@ -9,7 +9,7 @@ namespace big
|
||||
{
|
||||
using player_command::player_command;
|
||||
|
||||
virtual void execute(player_ptr player, const std::vector<uint64_t>& _args, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
int lockStatus = VEHICLE::GET_VEHICLE_DOOR_LOCK_STATUS(player->id());
|
||||
Ped ped = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player->id());
|
||||
|
@ -9,7 +9,7 @@ namespace big
|
||||
{
|
||||
using player_command::player_command;
|
||||
|
||||
virtual void execute(player_ptr player, const std::vector<uint64_t>& _args, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
Ped ped = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player->id());
|
||||
if (!PED::IS_PED_IN_ANY_VEHICLE(ped, true))
|
||||
@ -22,7 +22,7 @@ namespace big
|
||||
|
||||
if (entity::take_control_of(vehicle))
|
||||
{
|
||||
for (int i = 0; i < VEHICLE::GET_NUMBER_OF_VEHICLE_DOORS(i); i++)
|
||||
for (int i = 0; i < VEHICLE::GET_NUMBER_OF_VEHICLE_DOORS(vehicle); i++)
|
||||
{
|
||||
VEHICLE::SET_VEHICLE_DOOR_OPEN(vehicle, i, true, false);
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ namespace big
|
||||
{
|
||||
using player_command::player_command;
|
||||
|
||||
virtual void execute(player_ptr player, const std::vector<uint64_t>& _args, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
Vehicle veh = PED::GET_VEHICLE_PED_IS_IN(PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player->id()), FALSE);
|
||||
if (veh == 0)
|
||||
|
@ -9,7 +9,7 @@ namespace big
|
||||
{
|
||||
using player_command::player_command;
|
||||
|
||||
virtual void execute(player_ptr player, const std::vector<uint64_t>& _args, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
Ped ped = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player->id());
|
||||
if (PED::IS_PED_IN_ANY_VEHICLE(ped, false))
|
||||
|
31
src/backend/commands/player/vehicle/special_ability.cpp
Normal file
31
src/backend/commands/player/vehicle/special_ability.cpp
Normal file
@ -0,0 +1,31 @@
|
||||
#include "backend/player_command.hpp"
|
||||
#include "natives.hpp"
|
||||
#include "pointers.hpp"
|
||||
#include "util/teleport.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
template<int ability_type>
|
||||
class vehicle_special_ability : player_command
|
||||
{
|
||||
using player_command::player_command;
|
||||
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx)
|
||||
{
|
||||
Ped ped = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player->id());
|
||||
if (!PED::IS_PED_IN_ANY_VEHICLE(ped, true))
|
||||
{
|
||||
g_notification_service->push_warning("TOXIC"_T.data(), "ERROR_PLAYER_IS_NOT_IN_VEHICLE"_T.data());
|
||||
}
|
||||
else
|
||||
{
|
||||
g_pointers->m_gta.m_activate_special_ability(player->get_current_vehicle(), ability_type);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
vehicle_special_ability<0> g_special_jump_vehicle("svehjump", "Special: Jump", "Activates the vehicle jump on the player's vehicle. This may cause undefined behavior if the vehicle cannot jump", 0);
|
||||
vehicle_special_ability<1> g_special_boost_vehicle("svehboost", "Special: Boost", "Activates the boost on the player's vehicle. This may cause undefined behavior if the vehicle cannot boost", 0);
|
||||
vehicle_special_ability<3> g_special_shunt_left("sshuntleft", "Special: Shunt Left", "Shunts the player's vehicle to the left", 0);
|
||||
vehicle_special_ability<2> g_special_shunt_right("sshuntright", "Special: Shunt Right", "Shunts the player's vehicle to the right", 0);
|
||||
}
|
@ -8,7 +8,7 @@ namespace big
|
||||
{
|
||||
using player_command::player_command;
|
||||
|
||||
virtual void execute(player_ptr player, const std::vector<uint64_t>& _args, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
Ped ped = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player->id());
|
||||
if (!PED::IS_PED_IN_ANY_VEHICLE(ped, true))
|
||||
@ -31,5 +31,5 @@ namespace big
|
||||
}
|
||||
};
|
||||
|
||||
stop_vehicle g_stop_vehicle("stopveh", "Stop Vehicle", "Stops players vehicle", 0);
|
||||
stop_vehicle g_stop_vehicle("stopveh", "Stop Vehicle", "Stops the player's vehicle", 0);
|
||||
}
|
@ -8,7 +8,7 @@ namespace big
|
||||
{
|
||||
using player_command::player_command;
|
||||
|
||||
virtual void execute(player_ptr player, const std::vector<uint64_t>& _args, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
if (PED::IS_PED_IN_ANY_VEHICLE(player->id(), false))
|
||||
{
|
||||
@ -18,5 +18,5 @@ namespace big
|
||||
}
|
||||
};
|
||||
|
||||
unlock_vehicle g_unlock_vehicle("unlockveh", "Unlock Vehicle Doors", "Unlocks Vehicle Doors", 0);
|
||||
unlock_vehicle g_unlock_vehicle("unlockveh", "Unlock Vehicle Doors", "Unlocks all vehicle doors", 0);
|
||||
}
|
@ -10,7 +10,7 @@ namespace big
|
||||
{
|
||||
using player_command::player_command;
|
||||
|
||||
virtual void execute(player_ptr player, const std::vector<uint64_t>& _args, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
Ped ped = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player->id());
|
||||
Vehicle vehicle = PED::GET_VEHICLE_PED_IS_IN(ped, false);
|
||||
|
@ -10,7 +10,7 @@ namespace big
|
||||
{
|
||||
using player_command::player_command;
|
||||
|
||||
virtual void execute(player_ptr player, const std::vector<uint64_t>& _args, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
Ped ped = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player->id());
|
||||
|
||||
@ -24,5 +24,5 @@ namespace big
|
||||
}
|
||||
};
|
||||
|
||||
black_tint g_black_tint("blacktint", "Black Window Tint", "Makes their windows black.", 0);
|
||||
black_tint g_black_tint("blacktint", "Black Window Tint", "Makes the player's vehicle windows black", 0);
|
||||
}
|
@ -8,7 +8,7 @@ namespace big
|
||||
{
|
||||
using command::command;
|
||||
|
||||
virtual void execute(const std::vector<uint64_t>&, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(const command_arguments&, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
for (const auto& [_, weapon] : g_gta_data_service->weapons())
|
||||
{
|
||||
@ -18,5 +18,5 @@ namespace big
|
||||
}
|
||||
}
|
||||
};
|
||||
fill_ammo g_fill_ammo("fillammo", "Fill Ammo", "Fills all of your ammo.", 0);
|
||||
fill_ammo g_fill_ammo("fillammo", "FILL_AMMO", "FILL_AMMO_DESC", 0);
|
||||
}
|
@ -2,6 +2,6 @@
|
||||
|
||||
namespace big
|
||||
{
|
||||
bool_command g_beastjump("beastjump", "Beast Jump", "Allows you to jump as if you were the beast like in the Hunt the Beast event",
|
||||
bool_command g_beastjump("beastjump", "BEAST_JUMP", "BEAST_JUMP_DESC",
|
||||
g.self.beast_jump);
|
||||
}
|
||||
|
@ -8,11 +8,11 @@ namespace big
|
||||
{
|
||||
using command::command;
|
||||
|
||||
virtual void execute(const std::vector<uint64_t>&, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(const command_arguments&, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
entity::clean_ped(self::ped);
|
||||
}
|
||||
};
|
||||
|
||||
clean_player g_clean_player("clean", "Clean Player", "Cleans the player of wetness and decals", 0);
|
||||
clean_player g_clean_player("clean", "CLEAN_PLAYER", "CLEAN_PLAYER_DESC", 0);
|
||||
}
|
@ -7,7 +7,7 @@ namespace big
|
||||
{
|
||||
using command::command;
|
||||
|
||||
virtual void execute(const std::vector<uint64_t>&, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(const command_arguments&, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
if(g_local_player && g_local_player !=nullptr && !g.self.force_wanted_level)
|
||||
{
|
||||
@ -18,5 +18,5 @@ namespace big
|
||||
}
|
||||
};
|
||||
|
||||
clear_wanted g_clear_wanted("clearwantedlvl", "Clear Wanted Level", "Clears your wanted level", 0);
|
||||
clear_wanted g_clear_wanted("clearwantedlvl", "CLEAR_WANTED_LEVEL", "CLEAR_WANTED_LEVEL_DESC_SELF", 0);
|
||||
}
|
@ -8,7 +8,7 @@ namespace big
|
||||
{
|
||||
using command::command;
|
||||
|
||||
virtual void execute(const std::vector<uint64_t>&, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(const command_arguments&, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
std::string mpPrefix = local_player::get_mp_prefix();
|
||||
STATS::STAT_SET_INT(rage::joaat(mpPrefix + "NO_BOUGHT_YUM_SNACKS"), 30, true);
|
||||
@ -22,5 +22,5 @@ namespace big
|
||||
}
|
||||
};
|
||||
|
||||
fill_inventory g_fill_inventory("fillsnacks", "Fill Inventory", "Refills snacks and armor", 0);
|
||||
fill_inventory g_fill_inventory("fillsnacks", "FILL_INVENTORY", "FILL_INVENTORY_DESC", 0);
|
||||
}
|
@ -7,7 +7,7 @@ namespace big
|
||||
{
|
||||
using command::command;
|
||||
|
||||
virtual void execute(const std::vector<uint64_t>&, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(const command_arguments&, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
ENTITY::SET_ENTITY_HEALTH(self::ped, PED::GET_PED_MAX_HEALTH(self::ped), 0);
|
||||
PED::SET_PED_ARMOUR(self::ped, PLAYER::GET_PLAYER_MAX_ARMOUR(self::id));
|
||||
|
@ -7,10 +7,10 @@ namespace big
|
||||
class repairpv : command
|
||||
{
|
||||
using command::command;
|
||||
virtual void execute(const std::vector<uint64_t>&, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(const command_arguments&, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
vehicle::repair(self::veh);
|
||||
}
|
||||
};
|
||||
repairpv g_repairpv("repairpv", "Repair PV", "Repairs your currently active personal vehicle", 0);
|
||||
repairpv g_repairpv("repairpv", "REPAIR_PV", "REPAIR_PV_DESC", 0);
|
||||
}
|
@ -8,7 +8,7 @@ namespace big
|
||||
{
|
||||
using command::command;
|
||||
|
||||
virtual void execute(const std::vector<uint64_t>&, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(const command_arguments&, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
mobile::merry_weather::request_boat_pickup();
|
||||
}
|
||||
@ -18,7 +18,7 @@ namespace big
|
||||
{
|
||||
using command::command;
|
||||
|
||||
virtual void execute(const std::vector<uint64_t>&, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(const command_arguments&, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
mobile::ceo_abilities::request_ballistic_armor();
|
||||
}
|
||||
@ -28,7 +28,7 @@ namespace big
|
||||
{
|
||||
using command::command;
|
||||
|
||||
virtual void execute(const std::vector<uint64_t>&, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(const command_arguments&, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
mobile::services::request_avenger();
|
||||
}
|
||||
@ -38,7 +38,7 @@ namespace big
|
||||
{
|
||||
using command::command;
|
||||
|
||||
virtual void execute(const std::vector<uint64_t>&, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(const command_arguments&, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
mobile::services::request_kosatka();
|
||||
}
|
||||
@ -48,7 +48,7 @@ namespace big
|
||||
{
|
||||
using command::command;
|
||||
|
||||
virtual void execute(const std::vector<uint64_t>&, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(const command_arguments&, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
mobile::services::request_mobile_operations_center();
|
||||
}
|
||||
@ -58,7 +58,7 @@ namespace big
|
||||
{
|
||||
using command::command;
|
||||
|
||||
virtual void execute(const std::vector<uint64_t>&, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(const command_arguments&, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
mobile::services::request_terrorbyte();
|
||||
}
|
||||
@ -68,7 +68,7 @@ namespace big
|
||||
{
|
||||
using command::command;
|
||||
|
||||
virtual void execute(const std::vector<uint64_t>&, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(const command_arguments&, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
mobile::services::request_acidlab();
|
||||
}
|
||||
@ -78,7 +78,7 @@ namespace big
|
||||
{
|
||||
using command::command;
|
||||
|
||||
virtual void execute(const std::vector<uint64_t>&, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(const command_arguments&, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
mobile::services::request_acidlab_bike();
|
||||
}
|
||||
@ -88,19 +88,19 @@ namespace big
|
||||
{
|
||||
using command::command;
|
||||
|
||||
virtual void execute(const std::vector<uint64_t>&, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(const command_arguments&, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
mobile::mobile_misc::request_taxi();
|
||||
}
|
||||
};
|
||||
|
||||
boat_pickup g_boat_pickup("boatpickup", "Request Boat Pickup", "Request a boat pickup", 0);
|
||||
ballistic_armor g_ballistic_armor("ballisticarmor", "Request Ballistic Equipment", "Requests ballistic equipment which includes ballistic armor and an minigun", 0);
|
||||
request_avenger g_request_avenger("avenger", "Request Avenger", "Requests the Avenger", 0);
|
||||
request_kosatka g_request_kosatka("kosatka", "Request Kosatka", "Requests the Kosatka", 0);
|
||||
request_moc g_request_moc("moc", "Request M.O.C", "Requests the Mobile Operations Center", 0);
|
||||
request_terrorbyte g_request_terrorbyte("terrorbyte", "Request Terrorbyte", "Requests the terrorbyte", 0);
|
||||
request_acidlab g_request_acidlab("acidlab", "Request Acid Lab", "Requests the Acid Lab", 0);
|
||||
request_acidlab_bike g_request_acidlab_bike("acidbike", "Request Acid Bike", "Requests the Acid Lab Delivery Bike", 0);
|
||||
request_taxi g_request_taxi("taxi", "Request Taxi", "Requests a taxi to give you a ride", 0);
|
||||
boat_pickup g_boat_pickup("boatpickup", "REQUEST_BOAT", "REQUEST_BOAT_DESC", 0);
|
||||
ballistic_armor g_ballistic_armor("ballisticarmor", "REQUEST_BALLISTIC", "REQUEST_BALLISTIC_DESC", 0);
|
||||
request_avenger g_request_avenger("avenger", "REQUEST_AVENGER", "REQUEST_AVENGER_DESC", 0);
|
||||
request_kosatka g_request_kosatka("kosatka", "REQUEST_KOSATKA", "REQUEST_KOSATKA_DESC", 0);
|
||||
request_moc g_request_moc("moc", "REQUEST_MOC", "REQUEST_MOC_DESC", 0);
|
||||
request_terrorbyte g_request_terrorbyte("terrorbyte", "REQUEST_TERRORBYTE", "REQUEST_TERRORBYTE_DESC", 0);
|
||||
request_acidlab g_request_acidlab("acidlab", "REQUEST_ACIDLAB", "REQUEST_ACIDLAB_DESC", 0);
|
||||
request_acidlab_bike g_request_acidlab_bike("acidbike", "REQUEST_ACIDBIKE", "REQUEST_ACIDBIKE_DESC", 0);
|
||||
request_taxi g_request_taxi("taxi", "REQUEST_TAXI", "REQUEST_TAXI_DESC", 0);
|
||||
}
|
@ -7,11 +7,11 @@ namespace big
|
||||
{
|
||||
using command::command;
|
||||
|
||||
virtual void execute(const std::vector<uint64_t>&, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(const command_arguments&, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
CUTSCENE::STOP_CUTSCENE_IMMEDIATELY();
|
||||
}
|
||||
};
|
||||
|
||||
skip_cutscene g_skip_cutscene("skipcutscene", "Skip Cutscene", "Skips the currently playing cutscene", 0);
|
||||
skip_cutscene g_skip_cutscene("skipcutscene", "SKIP_CUTSCENE", "SKIP_CUTSCENE_DESC", 0);
|
||||
}
|
@ -7,11 +7,11 @@ namespace big
|
||||
{
|
||||
using command::command;
|
||||
|
||||
virtual void execute(const std::vector<uint64_t>&, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(const command_arguments&, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
ENTITY::SET_ENTITY_HEALTH(self::ped, 0, 0);
|
||||
}
|
||||
};
|
||||
|
||||
suicide g_suicide("suicide", "Suicide", "Kills you", 0);
|
||||
suicide g_suicide("suicide", "SUICIDE", "SUICIDE_DESC", 0);
|
||||
}
|
@ -2,5 +2,5 @@
|
||||
|
||||
namespace big
|
||||
{
|
||||
bool_command g_super_jump("superjump", "Super Jump", "Jump really high", g.self.super_jump);
|
||||
bool_command g_super_jump("superjump", "SUPER_JUMP", "SUPER_JUMP_DESC", g.self.super_jump);
|
||||
}
|
89
src/backend/commands/session/join_session.cpp
Normal file
89
src/backend/commands/session/join_session.cpp
Normal file
@ -0,0 +1,89 @@
|
||||
#include "backend/command.hpp"
|
||||
#include "util/session.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
class switch_session : command
|
||||
{
|
||||
std::unordered_map<eSessionType, const char*> m_session_types = {
|
||||
{eSessionType::JOIN_PUBLIC, "PUB"},
|
||||
{eSessionType::NEW_PUBLIC, "NEWPUB"},
|
||||
{eSessionType::CLOSED_CREW, "CLOSEDCREW"},
|
||||
{eSessionType::CREW, "NEWCREW"},
|
||||
{eSessionType::CLOSED_FRIENDS, "CLOSEDFRIENDS"},
|
||||
{eSessionType::FIND_FRIEND, "FRIENDS"},
|
||||
{eSessionType::SOLO, "SOLO"},
|
||||
{eSessionType::INVITE_ONLY, "INVITE"},
|
||||
{eSessionType::JOIN_CREW, "CREW"},
|
||||
{eSessionType::SC_TV, "SCTV"},
|
||||
{eSessionType::LEAVE_ONLINE, "SINGLEPLAYER"},
|
||||
};
|
||||
|
||||
using command::command;
|
||||
|
||||
std::string valid_args(bool was_session_string = false)
|
||||
{
|
||||
std::string valid_args;
|
||||
if (was_session_string)
|
||||
{
|
||||
for (const auto& session_type_string : m_session_types | std::ranges::views::values)
|
||||
{
|
||||
if (!empty(valid_args))
|
||||
{
|
||||
valid_args += ", ";
|
||||
}
|
||||
valid_args += session_type_string;
|
||||
}
|
||||
|
||||
return valid_args;
|
||||
}
|
||||
|
||||
for (const auto& session_type_id : m_session_types | std::ranges::views::keys)
|
||||
{
|
||||
if (!empty(valid_args))
|
||||
{
|
||||
valid_args += ", ";
|
||||
}
|
||||
valid_args += std::to_string(static_cast<int>(session_type_id));
|
||||
}
|
||||
|
||||
return valid_args;
|
||||
}
|
||||
|
||||
virtual std::optional<command_arguments> parse_args(const std::vector<std::string>& args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
command_arguments result(1);
|
||||
auto sessionType = static_cast<eSessionType>(std::atoi(args[0].c_str()));
|
||||
if (m_session_types.find(sessionType) == m_session_types.end())
|
||||
{
|
||||
ctx->report_error(std::format("Invalid session type ID given \"{}\", valid inputs are [{}].", args[0], valid_args()));
|
||||
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
if (sessionType == eSessionType::JOIN_PUBLIC && args[0] != "0")
|
||||
{
|
||||
const auto it = std::find_if(m_session_types.begin(), m_session_types.end(), [&args](const std::pair<eSessionType, const char*>& t) -> bool {
|
||||
return t.second == args[0];
|
||||
});
|
||||
if (it == m_session_types.end())
|
||||
{
|
||||
ctx->report_error(std::format("Unknown session type \"{}\", valid inputs are [{}].", args[0], valid_args(true)));
|
||||
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
sessionType = it->first;
|
||||
}
|
||||
|
||||
result.push<eSessionType>(sessionType);
|
||||
return result;
|
||||
}
|
||||
|
||||
virtual void execute(const command_arguments& args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
session::join_type(args.shift<eSessionType>());
|
||||
}
|
||||
};
|
||||
switch_session g_switch_session("joinsession", "Join Session", "Join a specific session type.", 1);
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
#include "backend/player_command.hpp"
|
||||
#include "backend/command.hpp"
|
||||
#include "network/CNetworkPlayerMgr.hpp"
|
||||
#include "pointers.hpp"
|
||||
#include "services/players/player_service.hpp"
|
||||
@ -8,7 +8,7 @@ namespace big
|
||||
class empty_session : command
|
||||
{
|
||||
using command::command;
|
||||
virtual void execute(const std::vector<uint64_t>&, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(const command_arguments&, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
g_player_service->iterate([](const player_entry& player) {
|
||||
auto mgr = *g_pointers->m_gta.m_network_player_mgr;
|
||||
|
@ -6,59 +6,63 @@
|
||||
|
||||
namespace big
|
||||
{
|
||||
class spawn_vehicle : command
|
||||
{
|
||||
using command::command;
|
||||
class spawn_vehicle : command
|
||||
{
|
||||
using command::command;
|
||||
|
||||
virtual std::optional<std::vector<uint64_t>> parse_args(const std::vector<std::string>& args, const std::shared_ptr<command_context> ctx)
|
||||
{
|
||||
auto hash = rage::joaat(args[0]);
|
||||
return std::vector<uint64_t>{hash};
|
||||
}
|
||||
virtual std::optional<command_arguments> parse_args(const std::vector<std::string>& args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
command_arguments result(1);
|
||||
result.push(rage::joaat(args[0]));
|
||||
|
||||
virtual CommandAccessLevel get_access_level()
|
||||
{
|
||||
return CommandAccessLevel::FRIENDLY;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
virtual void execute(const std::vector<uint64_t>& args, const std::shared_ptr<command_context> ctx)
|
||||
{
|
||||
if (!STREAMING::IS_MODEL_IN_CDIMAGE(args[0]) || !STREAMING::IS_MODEL_A_VEHICLE(args[0]))
|
||||
{
|
||||
ctx->report_error("Specified model is invalid");
|
||||
return;
|
||||
}
|
||||
virtual CommandAccessLevel get_access_level() override
|
||||
{
|
||||
return CommandAccessLevel::FRIENDLY;
|
||||
}
|
||||
|
||||
const auto spawn_location =
|
||||
vehicle::get_spawn_location(ctx->get_sender()->id() == self::id ? g.spawn_vehicle.spawn_inside : false,
|
||||
args[0],
|
||||
PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(ctx->get_sender()->id()));
|
||||
const auto spawn_heading = ENTITY::GET_ENTITY_HEADING(PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(ctx->get_sender()->id()));
|
||||
virtual void execute(const command_arguments& args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
const auto hash = args.get<rage::joaat_t>(0);
|
||||
if (!STREAMING::IS_MODEL_IN_CDIMAGE(hash) || !STREAMING::IS_MODEL_A_VEHICLE(hash))
|
||||
{
|
||||
ctx->report_error("Specified model is invalid");
|
||||
return;
|
||||
}
|
||||
|
||||
const auto veh = vehicle::spawn(args[0], spawn_location, spawn_heading);
|
||||
const auto spawn_location =
|
||||
vehicle::get_spawn_location(ctx->get_sender()->id() == self::id ? g.spawn_vehicle.spawn_inside : false,
|
||||
hash,
|
||||
PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(ctx->get_sender()->id()));
|
||||
const auto spawn_heading = ENTITY::GET_ENTITY_HEADING(PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(ctx->get_sender()->id()));
|
||||
|
||||
if (veh == 0)
|
||||
{
|
||||
g_notification_service->push_error("Vehicle", "Unable to spawn vehicle");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (g.spawn_vehicle.spawn_maxed)
|
||||
{
|
||||
vehicle::max_vehicle(veh);
|
||||
}
|
||||
auto veh = vehicle::spawn(hash, spawn_location, spawn_heading);
|
||||
|
||||
if (g.spawn_vehicle.spawn_inside && ctx->get_sender()->id() == self::id)
|
||||
{
|
||||
vehicle::teleport_into_vehicle(veh);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
if (veh == 0)
|
||||
{
|
||||
g_notification_service->push_error("Vehicle", "Unable to spawn vehicle");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (g.spawn_vehicle.spawn_maxed)
|
||||
{
|
||||
vehicle::max_vehicle(veh);
|
||||
}
|
||||
|
||||
spawn_vehicle g_spawn_vehicle("spawn", "Spawn Vehicle", "Spawn a vehicle with the specified model", 1);
|
||||
bool_command g_spawn_maxed("spawnmaxed", "Spawn Maxed", "Controls whether the vehicle spawned will have its mods maxed out",
|
||||
g.spawn_vehicle.spawn_maxed);
|
||||
bool_command g_spawn_inside("spawnin", "Spawn Inside", "Controls whether the player should be set inside the vehicle after it spawns",
|
||||
g.spawn_vehicle.spawn_inside);
|
||||
if (g.spawn_vehicle.spawn_inside && ctx->get_sender()->id() == self::id)
|
||||
{
|
||||
vehicle::teleport_into_vehicle(veh);
|
||||
}
|
||||
ENTITY::SET_ENTITY_AS_NO_LONGER_NEEDED(&veh);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
spawn_vehicle g_spawn_vehicle("spawn", "Spawn Vehicle", "Spawn a vehicle with the specified model", 1);
|
||||
bool_command g_spawn_maxed("spawnmaxed", "SPAWN_MAXED", "SPAWN_MAXED_DESC",
|
||||
g.spawn_vehicle.spawn_maxed);
|
||||
bool_command g_spawn_inside("spawnin", "SPAWN_IN", "SPAWN_IN_DESC",
|
||||
g.spawn_vehicle.spawn_inside);
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ namespace big
|
||||
{
|
||||
using command::command;
|
||||
|
||||
virtual void execute(const std::vector<uint64_t>&, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(const command_arguments&, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ namespace big
|
||||
{
|
||||
using command::command;
|
||||
|
||||
virtual void execute(const std::vector<uint64_t>&, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(const command_arguments&, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
Vehicle veh = mobile::mechanic::get_personal_vehicle();
|
||||
vehicle::bring(veh, self::pos);
|
||||
|
@ -8,7 +8,7 @@ namespace big
|
||||
{
|
||||
using command::command;
|
||||
|
||||
virtual void execute(const std::vector<std::uint64_t>&, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(const command_arguments&, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
teleport::to_highlighted_blip();
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ namespace big
|
||||
{
|
||||
using command::command;
|
||||
|
||||
virtual void execute(const std::vector<uint64_t>&, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(const command_arguments&, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
if (g_local_player && g_local_player->m_vehicle)
|
||||
{
|
||||
|
@ -8,7 +8,7 @@ namespace big
|
||||
{
|
||||
using command::command;
|
||||
|
||||
virtual void execute(const std::vector<uint64_t>&, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(const command_arguments&, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
teleport::to_objective();
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ namespace big
|
||||
{
|
||||
using command::command;
|
||||
|
||||
virtual void execute(const std::vector<uint64_t>&, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(const command_arguments&, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
Vehicle veh = mobile::mechanic::get_personal_vehicle();
|
||||
teleport::into_vehicle(veh);
|
||||
|
@ -8,7 +8,7 @@ namespace big
|
||||
{
|
||||
using command::command;
|
||||
|
||||
virtual void execute(const std::vector<uint64_t>&, const std::shared_ptr<command_context> ctx)
|
||||
virtual void execute(const command_arguments&, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
teleport::to_waypoint();
|
||||
}
|
||||
|
32
src/backend/float_command.cpp
Normal file
32
src/backend/float_command.cpp
Normal file
@ -0,0 +1,32 @@
|
||||
#include "float_command.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
float_command::float_command(const std::string& name, const std::string& label, const std::string& description, float& value, float lower_bound, float upper_bound) :
|
||||
command(name, label, description, 1),
|
||||
m_value(value),
|
||||
m_lower_bound(lower_bound),
|
||||
m_upper_bound(upper_bound)
|
||||
{
|
||||
}
|
||||
|
||||
void float_command::execute(const command_arguments& args, const std::shared_ptr<command_context> ctx)
|
||||
{
|
||||
m_value = args.get<float>(0);
|
||||
}
|
||||
|
||||
std::optional<command_arguments> float_command::parse_args(const std::vector<std::string>& args, const std::shared_ptr<command_context> ctx)
|
||||
{
|
||||
command_arguments result(1);
|
||||
float value = std::atof(args[0].c_str());
|
||||
|
||||
if (value < m_lower_bound || value > m_upper_bound)
|
||||
{
|
||||
ctx->report_error(std::format("Value {} is not between {} and {} in command {}", value, m_lower_bound, m_upper_bound, m_name));
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
result.push(value);
|
||||
return result;
|
||||
}
|
||||
}
|
31
src/backend/float_command.hpp
Normal file
31
src/backend/float_command.hpp
Normal file
@ -0,0 +1,31 @@
|
||||
#pragma once
|
||||
#include "command.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
class float_command : public command
|
||||
{
|
||||
protected:
|
||||
float& m_value;
|
||||
const float m_lower_bound;
|
||||
const float m_upper_bound;
|
||||
|
||||
virtual void execute(const command_arguments& args, const std::shared_ptr<command_context> ctx = std::make_shared<default_command_context>()) override;
|
||||
virtual std::optional<command_arguments> parse_args(const std::vector<std::string>& args, const std::shared_ptr<command_context> ctx = std::make_shared<default_command_context>()) override;
|
||||
|
||||
public:
|
||||
float_command(const std::string& name, const std::string& label, const std::string& description, float& value, float lower_bound, float upper_bound);
|
||||
inline float& get_value()
|
||||
{
|
||||
return m_value;
|
||||
}
|
||||
inline float get_lower_bound()
|
||||
{
|
||||
return m_lower_bound;
|
||||
}
|
||||
inline float get_upper_bound()
|
||||
{
|
||||
return m_upper_bound;
|
||||
}
|
||||
};
|
||||
}
|
@ -10,14 +10,14 @@ namespace big
|
||||
{
|
||||
}
|
||||
|
||||
void int_command::execute(const std::vector<uint64_t>& args, const std::shared_ptr<command_context> ctx)
|
||||
void int_command::execute(const command_arguments& args, const std::shared_ptr<command_context> ctx)
|
||||
{
|
||||
m_value = args[0];
|
||||
m_value = args.get<int>(0);
|
||||
}
|
||||
|
||||
std::optional<std::vector<uint64_t>> int_command::parse_args(const std::vector<std::string>& args, const std::shared_ptr<command_context> ctx)
|
||||
std::optional<command_arguments> int_command::parse_args(const std::vector<std::string>& args, const std::shared_ptr<command_context> ctx)
|
||||
{
|
||||
std::vector<uint64_t> result;
|
||||
command_arguments result(1);
|
||||
int value = std::atoi(args[0].c_str());
|
||||
|
||||
if (value < m_lower_bound || value > m_upper_bound)
|
||||
@ -26,7 +26,7 @@ namespace big
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
result.push_back(value);
|
||||
result.push(value);
|
||||
return result;
|
||||
}
|
||||
}
|
@ -10,8 +10,8 @@ namespace big
|
||||
int m_lower_bound;
|
||||
int m_upper_bound;
|
||||
|
||||
virtual void execute(const std::vector<uint64_t>& args, const std::shared_ptr<command_context> ctx = std::make_shared<default_command_context>()) override;
|
||||
virtual std::optional<std::vector<uint64_t>> parse_args(const std::vector<std::string>& args, const std::shared_ptr<command_context> ctx = std::make_shared<default_command_context>()) override;
|
||||
virtual void execute(const command_arguments& args, const std::shared_ptr<command_context> ctx = std::make_shared<default_command_context>()) override;
|
||||
virtual std::optional<command_arguments> parse_args(const std::vector<std::string>& args, const std::shared_ptr<command_context> ctx = std::make_shared<default_command_context>()) override;
|
||||
|
||||
public:
|
||||
int_command(const std::string& name, const std::string& label, const std::string& description, int& value, int lower_bound, int upper_bound);
|
||||
|
@ -1,11 +1,11 @@
|
||||
#include "backend/looped_command.hpp"
|
||||
#include "backend/bool_command.hpp"
|
||||
#include "natives.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
class hudcolor_looped : looped_command
|
||||
class hudcolor : bool_command
|
||||
{
|
||||
using looped_command::looped_command;
|
||||
using bool_command::bool_command;
|
||||
|
||||
virtual void on_enable() override
|
||||
{
|
||||
@ -31,10 +31,6 @@ namespace big
|
||||
}
|
||||
}
|
||||
|
||||
virtual void on_tick() override
|
||||
{
|
||||
}
|
||||
|
||||
virtual void on_disable() override
|
||||
{
|
||||
for (int i = 0; i < hud_colors.size(); i++)
|
||||
@ -45,5 +41,5 @@ namespace big
|
||||
}
|
||||
};
|
||||
|
||||
hudcolor_looped g_hudcolor_looped("hudcolor", "Override HUD Color", "Override HUD colors", g.self.hud.color_override);
|
||||
hudcolor g_hudcolor_looped("hudcolor", "Override HUD Color", "Override HUD colors", g.self.hud.color_override);
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ namespace big
|
||||
// rate limit script events to prevent crashes
|
||||
static int offRadarPlayer = 0;
|
||||
static int neverWantedPlayer = 0;
|
||||
void looped::player_good_options()
|
||||
void looped::player_good_options()
|
||||
{
|
||||
if (!*g_pointers->m_gta.m_is_session_started)
|
||||
return;
|
||||
@ -61,5 +61,17 @@ namespace big
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (g.session.vehicle_fix_all)
|
||||
{
|
||||
g_pointers->m_gta.m_give_pickup_rewards(-1, REWARD_VEHICLE_FIX);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_player_service->iterate([](const player_entry& entry) {
|
||||
if (entry.second->fix_vehicle)
|
||||
g_pointers->m_gta.m_give_pickup_rewards(-1, REWARD_VEHICLE_FIX);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
namespace big
|
||||
{
|
||||
void looped::player_remote_control_vehicle()
|
||||
void looped::player_remote_control_vehicle()
|
||||
{
|
||||
if (g.m_remote_controller_vehicle == -1)
|
||||
return;
|
||||
@ -29,7 +29,7 @@ namespace big
|
||||
{
|
||||
auto controlled = g.m_remote_controlled_vehicle;
|
||||
auto controller = g.m_remote_controller_vehicle;
|
||||
g_fiber_pool->queue_job([controlled, controller] {
|
||||
g_fiber_pool->queue_job([controlled, &controller] {
|
||||
if (entity::take_control_of(controlled))
|
||||
{
|
||||
ENTITY::SET_ENTITY_COLLISION(g.m_remote_controlled_vehicle, TRUE, TRUE);
|
||||
|
@ -7,7 +7,7 @@ namespace big
|
||||
{
|
||||
static bool bReset = true;
|
||||
|
||||
void looped::player_spectate()
|
||||
void looped::player_spectate()
|
||||
{
|
||||
const auto vehicle = self::veh;
|
||||
const auto ped = self::ped;
|
||||
|
@ -60,7 +60,7 @@ namespace big
|
||||
|
||||
if (g.self.dance_mode && g.m_dance_thread->m_handler)
|
||||
{
|
||||
*script_global(1950837).as<bool*>() = true;
|
||||
*scr_globals::dance_state.as<PINT>() = TRUE; //Never once do the scripts read this as a boolean. It seems to be some kind of state the player is in. Runs from 4 to 35.
|
||||
scr_functions::dance_loop.call(g.m_dance_thread, g.m_dance_program, {});
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,11 @@ namespace big
|
||||
Vector3 position;
|
||||
Vector3 rotation;
|
||||
|
||||
inline bool can_update_location()
|
||||
{
|
||||
return !(g.cmd_executor.enabled || g.self.noclip);
|
||||
}
|
||||
|
||||
virtual void on_enable() override
|
||||
{
|
||||
camera = CAM::CREATE_CAM("DEFAULT_SCRIPTED_CAMERA", 0);
|
||||
@ -44,24 +49,27 @@ namespace big
|
||||
|
||||
Vector3 vecChange = {0.f, 0.f, 0.f};
|
||||
|
||||
// Left Shift
|
||||
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_SPRINT))
|
||||
vecChange.z += speed / 2;
|
||||
// Left Control
|
||||
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_DUCK))
|
||||
vecChange.z -= speed / 2;
|
||||
// Forward
|
||||
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_MOVE_UP_ONLY))
|
||||
vecChange.y += speed;
|
||||
// Backward
|
||||
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_MOVE_DOWN_ONLY))
|
||||
vecChange.y -= speed;
|
||||
// Left
|
||||
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_MOVE_LEFT_ONLY))
|
||||
vecChange.x -= speed;
|
||||
// Right
|
||||
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_MOVE_RIGHT_ONLY))
|
||||
vecChange.x += speed;
|
||||
if (can_update_location())
|
||||
{
|
||||
// Left Shift
|
||||
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_SPRINT))
|
||||
vecChange.z += speed / 2;
|
||||
// Left Control
|
||||
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_DUCK))
|
||||
vecChange.z -= speed / 2;
|
||||
// Forward
|
||||
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_MOVE_UP_ONLY))
|
||||
vecChange.y += speed;
|
||||
// Backward
|
||||
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_MOVE_DOWN_ONLY))
|
||||
vecChange.y -= speed;
|
||||
// Left
|
||||
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_MOVE_LEFT_ONLY))
|
||||
vecChange.x -= speed;
|
||||
// Right
|
||||
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_MOVE_RIGHT_ONLY))
|
||||
vecChange.x += speed;
|
||||
}
|
||||
|
||||
if (vecChange.x == 0.f && vecChange.y == 0.f && vecChange.z == 0.f)
|
||||
mult = 0.f;
|
||||
@ -91,9 +99,9 @@ namespace big
|
||||
CAM::DESTROY_CAM(camera, false);
|
||||
STREAMING::CLEAR_FOCUS();
|
||||
|
||||
ENTITY::FREEZE_ENTITY_POSITION(camera, false);
|
||||
ENTITY::FREEZE_ENTITY_POSITION(self::veh, false);
|
||||
}
|
||||
};
|
||||
|
||||
free_cam g_free_cam("freecam", "FREECAM", "FREECAM_DESC", g.self.free_cam);
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,11 @@ namespace big
|
||||
Entity m_entity;
|
||||
float m_speed_multiplier;
|
||||
|
||||
inline bool can_update_location()
|
||||
{
|
||||
return !(g.cmd_executor.enabled || g.self.free_cam);
|
||||
}
|
||||
|
||||
virtual void on_tick() override
|
||||
{
|
||||
if (g_orbital_drone_service.initialized())
|
||||
@ -41,24 +46,27 @@ namespace big
|
||||
|
||||
Vector3 vel{};
|
||||
|
||||
// Left Shift
|
||||
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_SPRINT))
|
||||
vel.z += speed / 2;
|
||||
// Left Control
|
||||
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_DUCK))
|
||||
vel.z -= speed / 2;
|
||||
// Forward
|
||||
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_MOVE_UP_ONLY))
|
||||
vel.y += speed;
|
||||
// Backward
|
||||
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_MOVE_DOWN_ONLY))
|
||||
vel.y -= speed;
|
||||
// Left
|
||||
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_MOVE_LEFT_ONLY))
|
||||
vel.x -= speed;
|
||||
// Right
|
||||
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_MOVE_RIGHT_ONLY))
|
||||
vel.x += speed;
|
||||
if (can_update_location())
|
||||
{
|
||||
// Left Shift
|
||||
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_SPRINT))
|
||||
vel.z += speed / 2;
|
||||
// Left Control
|
||||
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_DUCK))
|
||||
vel.z -= speed / 2;
|
||||
// Forward
|
||||
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_MOVE_UP_ONLY))
|
||||
vel.y += speed;
|
||||
// Backward
|
||||
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_MOVE_DOWN_ONLY))
|
||||
vel.y -= speed;
|
||||
// Left
|
||||
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_MOVE_LEFT_ONLY))
|
||||
vel.x -= speed;
|
||||
// Right
|
||||
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_MOVE_RIGHT_ONLY))
|
||||
vel.x += speed;
|
||||
}
|
||||
|
||||
auto rot = CAM::GET_GAMEPLAY_CAM_ROT(2);
|
||||
ENTITY::SET_ENTITY_ROTATION(ent, 0.f, rot.y, rot.z, 2, 0);
|
||||
@ -77,7 +85,7 @@ namespace big
|
||||
ENTITY::FREEZE_ENTITY_POSITION(ent, false);
|
||||
|
||||
const auto is_aiming = PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_AIM);
|
||||
if (is_aiming)
|
||||
if (is_aiming || CAM::GET_FOLLOW_PED_CAM_VIEW_MODE() == CameraMode::FIRST_PERSON)
|
||||
{
|
||||
vel = vel * g.self.noclip_aim_speed_multiplier;
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user