Merge branch 'master' into WindTheClockReleaseTheSwitchMarchInlineWithTheBitch
This commit is contained in:
commit
c59a0ff948
@ -16,7 +16,7 @@ Returns a memory instance, with the given address.
|
|||||||
myInstance = pointer:new(address)
|
myInstance = pointer:new(address)
|
||||||
```
|
```
|
||||||
|
|
||||||
## Functions (23)
|
## Functions (26)
|
||||||
|
|
||||||
### `add(offset)`
|
### `add(offset)`
|
||||||
|
|
||||||
@ -63,18 +63,6 @@ Rips the current memory address and returns a new pointer object.
|
|||||||
pointer = pointer:rip(offset)
|
pointer = pointer:rip(offset)
|
||||||
```
|
```
|
||||||
|
|
||||||
### `get_int()`
|
|
||||||
|
|
||||||
Retrieves the value stored at the memory address as the specified type.
|
|
||||||
|
|
||||||
- **Returns:**
|
|
||||||
- `number`: the value stored at the memory address as the specified type.
|
|
||||||
|
|
||||||
**Example Usage:**
|
|
||||||
```lua
|
|
||||||
number = pointer:get_int()
|
|
||||||
```
|
|
||||||
|
|
||||||
### `get_byte()`
|
### `get_byte()`
|
||||||
|
|
||||||
Retrieves the value stored at the memory address as the specified type.
|
Retrieves the value stored at the memory address as the specified type.
|
||||||
@ -99,6 +87,18 @@ Retrieves the value stored at the memory address as the specified type.
|
|||||||
number = pointer:get_word()
|
number = pointer:get_word()
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### `get_int()`
|
||||||
|
|
||||||
|
Retrieves the value stored at the memory address as the specified type.
|
||||||
|
|
||||||
|
- **Returns:**
|
||||||
|
- `number`: the value stored at the memory address as the specified type.
|
||||||
|
|
||||||
|
**Example Usage:**
|
||||||
|
```lua
|
||||||
|
number = pointer:get_int()
|
||||||
|
```
|
||||||
|
|
||||||
### `get_dword()`
|
### `get_dword()`
|
||||||
|
|
||||||
Retrieves the value stored at the memory address as the specified type.
|
Retrieves the value stored at the memory address as the specified type.
|
||||||
@ -135,18 +135,6 @@ Retrieves the value stored at the memory address as the specified type.
|
|||||||
number = pointer:get_qword()
|
number = pointer:get_qword()
|
||||||
```
|
```
|
||||||
|
|
||||||
### `set_int(value)`
|
|
||||||
|
|
||||||
Sets the value at the memory address to the specified value of the given type.
|
|
||||||
|
|
||||||
- **Parameters:**
|
|
||||||
- `value` (number): new value.
|
|
||||||
|
|
||||||
**Example Usage:**
|
|
||||||
```lua
|
|
||||||
pointer:set_int(value)
|
|
||||||
```
|
|
||||||
|
|
||||||
### `set_byte(value)`
|
### `set_byte(value)`
|
||||||
|
|
||||||
Sets the value at the memory address to the specified value of the given type.
|
Sets the value at the memory address to the specified value of the given type.
|
||||||
@ -171,6 +159,18 @@ Sets the value at the memory address to the specified value of the given type.
|
|||||||
pointer:set_word(value)
|
pointer:set_word(value)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### `set_int(value)`
|
||||||
|
|
||||||
|
Sets the value at the memory address to the specified value of the given type.
|
||||||
|
|
||||||
|
- **Parameters:**
|
||||||
|
- `value` (number): new value.
|
||||||
|
|
||||||
|
**Example Usage:**
|
||||||
|
```lua
|
||||||
|
pointer:set_int(value)
|
||||||
|
```
|
||||||
|
|
||||||
### `set_dword(value)`
|
### `set_dword(value)`
|
||||||
|
|
||||||
Sets the value at the memory address to the specified value of the given type.
|
Sets the value at the memory address to the specified value of the given type.
|
||||||
@ -343,4 +343,16 @@ Retrieves the memory address stored in the pointer object.
|
|||||||
number = pointer:get_address()
|
number = pointer:get_address()
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### `set_address(address)`
|
||||||
|
|
||||||
|
Sets the memory address stored in the pointer object.
|
||||||
|
|
||||||
|
- **Parameters:**
|
||||||
|
- `address` (integer): new address.
|
||||||
|
|
||||||
|
**Example Usage:**
|
||||||
|
```lua
|
||||||
|
pointer:set_address(address)
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,13 +23,19 @@ Clear the tab of all its custom lua content that you own.
|
|||||||
tab:clear()
|
tab:clear()
|
||||||
```
|
```
|
||||||
|
|
||||||
### `add_tab()`
|
### `add_tab(tab_name)`
|
||||||
|
|
||||||
Add a sub tab to this tab.
|
Add a sub tab to this tab.
|
||||||
|
|
||||||
|
- **Parameters:**
|
||||||
|
- `tab_name` (string): Name of the tab to add.
|
||||||
|
|
||||||
|
- **Returns:**
|
||||||
|
- `tab`: A tab instance which corresponds to the new tab in the GUI.
|
||||||
|
|
||||||
**Example Usage:**
|
**Example Usage:**
|
||||||
```lua
|
```lua
|
||||||
tab:add_tab()
|
tab = tab:add_tab(tab_name)
|
||||||
```
|
```
|
||||||
|
|
||||||
### `add_button(name, callback)`
|
### `add_button(name, callback)`
|
||||||
|
@ -26,7 +26,7 @@ z component of the vector.
|
|||||||
|
|
||||||
### `new(x, y, z)`
|
### `new(x, y, z)`
|
||||||
|
|
||||||
Returns a vector that contains the x, y, and z values.
|
Returns: vec3: a vector that contains the x, y, and z values.
|
||||||
|
|
||||||
- **Parameters:**
|
- **Parameters:**
|
||||||
- `x` (float): x component of the vector.
|
- `x` (float): x component of the vector.
|
||||||
|
@ -331,6 +331,10 @@ You can find all the supported functions and overloads below.
|
|||||||
-- ImGui.Separator()
|
-- ImGui.Separator()
|
||||||
ImGui.Separator
|
ImGui.Separator
|
||||||
|
|
||||||
|
-- ImGui.SeparatorText(...)
|
||||||
|
-- Parameters: text (text)
|
||||||
|
ImGui.SeparatorText("some text")
|
||||||
|
|
||||||
-- ImGui.SameLine(...)
|
-- ImGui.SameLine(...)
|
||||||
-- Parameters: float (offset_from_start_x) [O], float (spacing) [O]
|
-- Parameters: float (offset_from_start_x) [O], float (spacing) [O]
|
||||||
-- Overloads
|
-- Overloads
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Table containing functions for modifying the menu GUI.
|
Table containing functions for modifying the menu GUI.
|
||||||
|
|
||||||
## Functions (8)
|
## Functions (12)
|
||||||
|
|
||||||
### `get_tab(tab_name)`
|
### `get_tab(tab_name)`
|
||||||
|
|
||||||
@ -92,6 +92,38 @@ gui.show_error(title, message)
|
|||||||
bool = gui.is_open()
|
bool = gui.is_open()
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### `toggle(toggle)`
|
||||||
|
|
||||||
|
Opens and closes the gui.
|
||||||
|
|
||||||
|
- **Parameters:**
|
||||||
|
- `toggle` (boolean)
|
||||||
|
|
||||||
|
**Example Usage:**
|
||||||
|
```lua
|
||||||
|
gui.toggle(toggle)
|
||||||
|
```
|
||||||
|
|
||||||
|
### `mouse_override()`
|
||||||
|
|
||||||
|
- **Returns:**
|
||||||
|
- `bool`: Returns true if the mouse is overridden.
|
||||||
|
|
||||||
|
**Example Usage:**
|
||||||
|
```lua
|
||||||
|
bool = gui.mouse_override()
|
||||||
|
```
|
||||||
|
|
||||||
|
### `override_mouse(override)`
|
||||||
|
|
||||||
|
- **Parameters:**
|
||||||
|
- `override` (boolean)
|
||||||
|
|
||||||
|
**Example Usage:**
|
||||||
|
```lua
|
||||||
|
gui.override_mouse(override)
|
||||||
|
```
|
||||||
|
|
||||||
### `add_imgui(imgui_rendering)`
|
### `add_imgui(imgui_rendering)`
|
||||||
|
|
||||||
Registers a function that will be called every rendering frame, you can call ImGui functions in it, please check the ImGui.md documentation file for more info.
|
Registers a function that will be called every rendering frame, you can call ImGui functions in it, please check the ImGui.md documentation file for more info.
|
||||||
@ -118,4 +150,30 @@ end)
|
|||||||
gui.add_imgui(imgui_rendering)
|
gui.add_imgui(imgui_rendering)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### `add_always_draw_imgui(imgui_rendering)`
|
||||||
|
|
||||||
|
Registers a function that will be called every rendering frame, you can call ImGui functions in it, please check the ImGui.md documentation file for more info. This function will be called even when the menu is closed.
|
||||||
|
**Example Usage:**
|
||||||
|
```lua
|
||||||
|
gui.add_always_draw_imgui(function()
|
||||||
|
if ImGui.Begin("My Custom Window") then
|
||||||
|
if ImGui.Button("Label") then
|
||||||
|
script.run_in_fiber(function(script)
|
||||||
|
-- call natives in there
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
ImGui.End()
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
``
|
||||||
|
|
||||||
|
- **Parameters:**
|
||||||
|
- `imgui_rendering` (function): Function that will be called every rendering frame, you can call ImGui functions in it, please check the ImGui.md documentation file for more info.
|
||||||
|
|
||||||
|
**Example Usage:**
|
||||||
|
```lua
|
||||||
|
gui.add_always_draw_imgui(imgui_rendering)
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Table containing all possible events to which you can respond.
|
Table containing all possible events to which you can respond.
|
||||||
|
|
||||||
## Fields (8)
|
## Fields (9)
|
||||||
|
|
||||||
### `PlayerLeave`
|
### `PlayerLeave`
|
||||||
|
|
||||||
@ -103,3 +103,16 @@ end)
|
|||||||
|
|
||||||
- Type: `integer`
|
- Type: `integer`
|
||||||
|
|
||||||
|
### `Wndproc`
|
||||||
|
|
||||||
|
Event that is triggered when Wndproc is called
|
||||||
|
**Example Usage:**
|
||||||
|
```lua
|
||||||
|
event.register_handler(menu_event.Wndproc, function (hwnd, msg, wparam, lparam)
|
||||||
|
if msg == 132 then return end
|
||||||
|
log.debug("hwnd = " .. tostring(hwnd) .. ", msg = " .. tostring(msg) .. ", wparam = " .. tostring(wparam) .. ", lparam = " .. tostring(lparam))
|
||||||
|
end)
|
||||||
|
```
|
||||||
|
|
||||||
|
- Type: `integer`
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Table containing helper functions for network related features.
|
Table containing helper functions for network related features.
|
||||||
|
|
||||||
## Functions (17)
|
## Functions (22)
|
||||||
|
|
||||||
### `trigger_script_event(bitset, _args)`
|
### `trigger_script_event(bitset, _args)`
|
||||||
|
|
||||||
@ -146,7 +146,7 @@ string = network.get_flagged_modder_reason(player_idx)
|
|||||||
Try to force ourself to be host for the given GTA Script. Needs to be called in the fiber pool or a loop.
|
Try to force ourself to be host for the given GTA Script. Needs to be called in the fiber pool or a loop.
|
||||||
|
|
||||||
- **Parameters:**
|
- **Parameters:**
|
||||||
- `script_name` (string): Name of the script
|
- `script_name` (string): Name of the script.
|
||||||
|
|
||||||
**Example Usage:**
|
**Example Usage:**
|
||||||
```lua
|
```lua
|
||||||
@ -164,7 +164,7 @@ Forces the given GTA script to be started on a player. Needs to be called in the
|
|||||||
|
|
||||||
**Example Usage:**
|
**Example Usage:**
|
||||||
```lua
|
```lua
|
||||||
network.force_script_on_player(script_name)
|
network.force_script_on_player(player_idx, script_name, instance_id)
|
||||||
```
|
```
|
||||||
|
|
||||||
### `send_chat_message(msg, team_only)`
|
### `send_chat_message(msg, team_only)`
|
||||||
@ -198,14 +198,14 @@ network.send_chat_message_to_player(player_idx, msg)
|
|||||||
Call get_player_rank(playerID)
|
Call get_player_rank(playerID)
|
||||||
|
|
||||||
- **Parameters:**
|
- **Parameters:**
|
||||||
- `pid` (int)
|
- `pid` (integer): Index of the player.
|
||||||
|
|
||||||
- **Returns:**
|
- **Returns:**
|
||||||
- `int`: Returns an integer which contains the players rank.
|
- `integer`: An integer which contains the players rank.
|
||||||
|
|
||||||
**Example Usage:**
|
**Example Usage:**
|
||||||
```lua
|
```lua
|
||||||
network.get_player_rank(pid)
|
integer = network.get_player_rank(pid)
|
||||||
```
|
```
|
||||||
|
|
||||||
### `get_player_rp(pid)`
|
### `get_player_rp(pid)`
|
||||||
@ -213,14 +213,14 @@ network.get_player_rank(pid)
|
|||||||
Call get_player_rp(playerID)
|
Call get_player_rp(playerID)
|
||||||
|
|
||||||
- **Parameters:**
|
- **Parameters:**
|
||||||
- `pid` (int)
|
- `pid` (integer): Index of the player.
|
||||||
|
|
||||||
- **Returns:**
|
- **Returns:**
|
||||||
- `int`: Returns an integer which contains the players rp.
|
- `integer`: An integer which contains the players rp.
|
||||||
|
|
||||||
**Example Usage:**
|
**Example Usage:**
|
||||||
```lua
|
```lua
|
||||||
network.get_player_rp(pid)
|
integer = network.get_player_rp(pid)
|
||||||
```
|
```
|
||||||
|
|
||||||
### `get_player_money(pid)`
|
### `get_player_money(pid)`
|
||||||
@ -228,14 +228,14 @@ network.get_player_rp(pid)
|
|||||||
Call get_player_money(playerID)
|
Call get_player_money(playerID)
|
||||||
|
|
||||||
- **Parameters:**
|
- **Parameters:**
|
||||||
- `pid` (int)
|
- `pid` (integer): Index of the player.
|
||||||
|
|
||||||
- **Returns:**
|
- **Returns:**
|
||||||
- `int`: Returns an integer which contains the players money.
|
- `integer`: An integer which contains the players money.
|
||||||
|
|
||||||
**Example Usage:**
|
**Example Usage:**
|
||||||
```lua
|
```lua
|
||||||
network.get_player_money(pid)
|
integer = network.get_player_money(pid)
|
||||||
```
|
```
|
||||||
|
|
||||||
### `get_player_wallet(pid)`
|
### `get_player_wallet(pid)`
|
||||||
@ -243,14 +243,14 @@ network.get_player_money(pid)
|
|||||||
Call get_player_wallet(playerID)
|
Call get_player_wallet(playerID)
|
||||||
|
|
||||||
- **Parameters:**
|
- **Parameters:**
|
||||||
- `pid` (int)
|
- `pid` (integer): Index of the player.
|
||||||
|
|
||||||
- **Returns:**
|
- **Returns:**
|
||||||
- `int`: Returns an integer which contains the players wallet.
|
- `integer`: An integer which contains the players wallet.
|
||||||
|
|
||||||
**Example Usage:**
|
**Example Usage:**
|
||||||
```lua
|
```lua
|
||||||
network.get_player_wallet(pid)
|
integer = network.get_player_wallet(pid)
|
||||||
```
|
```
|
||||||
|
|
||||||
### `get_player_bank(pid)`
|
### `get_player_bank(pid)`
|
||||||
@ -258,14 +258,14 @@ network.get_player_wallet(pid)
|
|||||||
Call get_player_bank(playerID)
|
Call get_player_bank(playerID)
|
||||||
|
|
||||||
- **Parameters:**
|
- **Parameters:**
|
||||||
- `pid` (int)
|
- `pid` (integer): Index of the player.
|
||||||
|
|
||||||
- **Returns:**
|
- **Returns:**
|
||||||
- `int`: Returns an integer which contains the players bank.
|
- `integer`: An integer which contains the players bank.
|
||||||
|
|
||||||
**Example Usage:**
|
**Example Usage:**
|
||||||
```lua
|
```lua
|
||||||
network.get_player_bank(pid)
|
integer = network.get_player_bank(pid)
|
||||||
```
|
```
|
||||||
|
|
||||||
### `get_player_language_id(pid)`
|
### `get_player_language_id(pid)`
|
||||||
@ -273,14 +273,14 @@ network.get_player_bank(pid)
|
|||||||
Call get_player_language_id(playerID)
|
Call get_player_language_id(playerID)
|
||||||
|
|
||||||
- **Parameters:**
|
- **Parameters:**
|
||||||
- `pid` (int)
|
- `pid` (integer): Index of the player.
|
||||||
|
|
||||||
- **Returns:**
|
- **Returns:**
|
||||||
- `int`: Returns an integer which contains the players language id.
|
- `integer`: An integer which contains the players language id.
|
||||||
|
|
||||||
**Example Usage:**
|
**Example Usage:**
|
||||||
```lua
|
```lua
|
||||||
network.get_player_language_id(pid)
|
integer = network.get_player_language_id(pid)
|
||||||
```
|
```
|
||||||
|
|
||||||
### `get_player_language_name(pid)`
|
### `get_player_language_name(pid)`
|
||||||
@ -288,12 +288,14 @@ network.get_player_language_id(pid)
|
|||||||
Call get_player_language_name(playerID)
|
Call get_player_language_name(playerID)
|
||||||
|
|
||||||
- **Parameters:**
|
- **Parameters:**
|
||||||
- `pid` (int)
|
- `pid` (integer): Index of the player.
|
||||||
|
|
||||||
- **Returns:**
|
- **Returns:**
|
||||||
- `string`: Returns a string which contains the players language name.
|
- `string`: A string which contains the players language name.
|
||||||
|
|
||||||
**Example Usage:**
|
**Example Usage:**
|
||||||
```lua
|
```lua
|
||||||
network.get_player_language_name(pid)
|
string = network.get_player_language_name(pid)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,20 +1,12 @@
|
|||||||
# Table: scr_function
|
# Table: scr_function
|
||||||
|
|
||||||
Table for calling GTA script functions. Needs to be called in the fiber pool or a GTA script. Only call the function when necessary.
|
Table for calling GTA script functions. Needs to be called in the fiber pool. Only call the function when necessary.
|
||||||
|
|
||||||
## Functions (2)
|
## Functions (2)
|
||||||
|
|
||||||
### `call_script_function(script_name, function_name, pattern, return_type_string, args_)`
|
### `call_script_function(script_name, function_name, pattern, return_type_string, args_)`
|
||||||
|
|
||||||
Calls a script function with the given arguments. Returns the return value as the given type.
|
Calls a script function with the given arguments. Returns the return value as the given type.
|
||||||
|
|
||||||
- **Parameters:**
|
|
||||||
- `script_name` (string): Name of the script.
|
|
||||||
- `function_name` (string): Name of the function. This parameter needs to be unique.
|
|
||||||
- `pattern` (string): Pattern to scan for within the script.
|
|
||||||
- `return_type_string` (string): Return type of the function. Supported types are **"int"**, **"bool"**, **"const char\*/string"**, **"ptr/pointer/*"**, **"float"**, and **"vector3"**. Anything different will be rejected.
|
|
||||||
- `_args` (table): Arguments to pass to the function. Supported types are the same as return types.
|
|
||||||
|
|
||||||
**Example Usage:**
|
**Example Usage:**
|
||||||
```lua
|
```lua
|
||||||
local value = scr_function.call_script_function("freemode", "wear_sunglasses_at_night", "69 42 06 66", "bool", {
|
local value = scr_function.call_script_function("freemode", "wear_sunglasses_at_night", "69 42 06 66", "bool", {
|
||||||
@ -24,20 +16,37 @@ local value = scr_function.call_script_function("freemode", "wear_sunglasses_at_
|
|||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- **Parameters:**
|
||||||
|
- `script_name` (string): Name of the script.
|
||||||
|
- `function_name` (string): Name of the function. This parameter needs to be unique.
|
||||||
|
- `pattern` (string): Pattern to scan for within the script.
|
||||||
|
- `return_type_string` (string): Return type of the function. Supported types are **"int"**, **"bool"**, **"const char\*/string"**, **"ptr/pointer/*"**, **"float"**, and **"vector3"**. Anything different will be rejected.
|
||||||
|
- `args_` (table): Arguments to pass to the function. Supported types are the same as return types.
|
||||||
|
|
||||||
|
**Example Usage:**
|
||||||
|
```lua
|
||||||
|
scr_function.call_script_function(script_name, function_name, pattern, return_type_string, args_)
|
||||||
|
```
|
||||||
|
|
||||||
### `call_script_function(script_name, instruction_pointer, return_type_string, args_)`
|
### `call_script_function(script_name, instruction_pointer, return_type_string, args_)`
|
||||||
|
|
||||||
Calls a script function directly using the function position with the given arguments. Returns the return value as the given type.
|
Calls a script function directly using the function position with the given arguments. Returns the return value as the given type.
|
||||||
|
|
||||||
- **Parameters:**
|
|
||||||
- `script_name` (string): Name of the script.
|
|
||||||
- `function_name` (string): Name of the function.
|
|
||||||
- `instruction_pointer` (integer): Position of the function within the script.
|
|
||||||
- `return_type_string` (string): Return type of the function. Supported types are **"int"**, **"bool"**, **"const char\*/string"**, **"ptr/pointer/*"**, **"float"**, and **"vector3"**. Anything different will be rejected.
|
|
||||||
- `_args` (table): Arguments to pass to the function. Supported types are the same as return types.
|
|
||||||
|
|
||||||
**Example Usage:**
|
**Example Usage:**
|
||||||
```lua
|
```lua
|
||||||
local value = scr_function.call_script_function("freemode", 0xE792, "string", {
|
local value = scr_function.call_script_function("freemode", 0xE792, "string", {
|
||||||
{ "int", 191 }
|
{ "int", 191 }
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- **Parameters:**
|
||||||
|
- `script_name` (string): Name of the script.
|
||||||
|
- `instruction_pointer` (integer): Position of the function within the script.
|
||||||
|
- `return_type_string` (string): Return type of the function. Supported types are **"int"**, **"bool"**, **"const char\*/string"**, **"ptr/pointer/*"**, **"float"**, and **"vector3"**. Anything different will be rejected.
|
||||||
|
- `args_` (table): Arguments to pass to the function. Supported types are the same as return types.
|
||||||
|
|
||||||
|
**Example Usage:**
|
||||||
|
```lua
|
||||||
|
scr_function.call_script_function(script_name, instruction_pointer, return_type_string, args_)
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,16 +2,11 @@
|
|||||||
|
|
||||||
Table containing helper functions related to gta scripts.
|
Table containing helper functions related to gta scripts.
|
||||||
|
|
||||||
## Functions (7)
|
## Functions (6)
|
||||||
|
|
||||||
### `register_looped(name, func)`
|
### `register_looped(name, func)`
|
||||||
|
|
||||||
Registers a function that will be looped as a gta script.
|
Registers a function that will be looped as a gta script.
|
||||||
|
|
||||||
- **Parameters:**
|
|
||||||
- `name` (string): name of your new looped script
|
|
||||||
- `func` (function): function that will be executed in a forever loop.
|
|
||||||
|
|
||||||
**Example Usage:**
|
**Example Usage:**
|
||||||
```lua
|
```lua
|
||||||
script.register_looped("nameOfMyLoopedScript", function (script)
|
script.register_looped("nameOfMyLoopedScript", function (script)
|
||||||
@ -36,13 +31,18 @@ script.register_looped("nameOfMyLoopedScript", function (script)
|
|||||||
end)
|
end)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- **Parameters:**
|
||||||
|
- `name` (string): name of your new looped script
|
||||||
|
- `func` (function): function that will be executed in a forever loop.
|
||||||
|
|
||||||
|
**Example Usage:**
|
||||||
|
```lua
|
||||||
|
script.register_looped(name, func)
|
||||||
|
```
|
||||||
|
|
||||||
### `run_in_fiber(func)`
|
### `run_in_fiber(func)`
|
||||||
|
|
||||||
Executes a function once inside the fiber pool, you can call natives inside it and yield or sleep.
|
Executes a function once inside the fiber pool, you can call natives inside it and yield or sleep.
|
||||||
|
|
||||||
- **Parameters:**
|
|
||||||
- `func` (function): function that will be executed once in the fiber pool.
|
|
||||||
|
|
||||||
**Example Usage:**
|
**Example Usage:**
|
||||||
```lua
|
```lua
|
||||||
script.run_in_fiber(function (script)
|
script.run_in_fiber(function (script)
|
||||||
@ -67,16 +67,28 @@ script.run_in_fiber(function (script)
|
|||||||
end)
|
end)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- **Parameters:**
|
||||||
|
- `func` (function): function that will be executed once in the fiber pool.
|
||||||
|
|
||||||
|
**Example Usage:**
|
||||||
|
```lua
|
||||||
|
script.run_in_fiber(func)
|
||||||
|
```
|
||||||
|
|
||||||
### `is_active(script_name)`
|
### `is_active(script_name)`
|
||||||
|
|
||||||
Returns true if the specified script is currently active/running.
|
Returns true if the specified script is currently active/running.
|
||||||
|
**Example Usage:**
|
||||||
|
```lua
|
||||||
|
local is_freemode_active = script.is_active("freemode")
|
||||||
|
```
|
||||||
|
|
||||||
- **Parameters:**
|
- **Parameters:**
|
||||||
- `script_name` (string): The name of the script.
|
- `script_name` (string): The name of the script.
|
||||||
|
|
||||||
**Example Usage:**
|
**Example Usage:**
|
||||||
```lua
|
```lua
|
||||||
local is_freemode_active = script.is_active("freemode")
|
script.is_active(script_name)
|
||||||
```
|
```
|
||||||
|
|
||||||
### `execute_as_script(script_name, func)`
|
### `execute_as_script(script_name, func)`
|
||||||
@ -93,29 +105,39 @@ script.execute_as_script(script_name, func)
|
|||||||
### `add_patch(script_name, name, pattern, offset, _patch)`
|
### `add_patch(script_name, name, pattern, offset, _patch)`
|
||||||
|
|
||||||
Adds a patch for the specified script.
|
Adds a patch for the specified script.
|
||||||
|
|
||||||
- **Parameters:**
|
|
||||||
- `script_name` (string): The name of the script.
|
|
||||||
- `name` (string): The name of the patch.
|
|
||||||
- `pattern` (string): Pattern to scan for within the script.
|
|
||||||
- `offset` (integer): The position within the pattern.
|
|
||||||
- `_patch` (table): The bytes to be written into the script's bytecode.
|
|
||||||
|
|
||||||
**Example Usage:**
|
**Example Usage:**
|
||||||
```lua
|
```lua
|
||||||
script.add_patch("fm_content_xmas_truck", "Flickering Fix", "56 ? ? 4F ? ? 40 ? 5D ? ? ? 74", 0, {0x2B, 0x00, 0x00})
|
script.add_patch("fm_content_xmas_truck", "Flickering Fix", "56 ? ? 4F ? ? 40 ? 5D ? ? ? 74", 0, {0x2B, 0x00, 0x00})
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- **Parameters:**
|
||||||
|
- `script_name` (string): The name of the script.
|
||||||
|
- `name` (string): The name of the patch.
|
||||||
|
- `pattern` (string): The pattern to scan for within the script.
|
||||||
|
- `offset` (integer): The position within the pattern.
|
||||||
|
- `_patch` (table): The bytes to be written into the script's bytecode.
|
||||||
|
|
||||||
|
**Example Usage:**
|
||||||
|
```lua
|
||||||
|
script.add_patch(script_name, name, pattern, offset, _patch)
|
||||||
|
```
|
||||||
|
|
||||||
### `start_launcher_script(script_name)`
|
### `start_launcher_script(script_name)`
|
||||||
|
|
||||||
Tries to start a launcher script. Needs to be called in the fiber pool or a loop.
|
Tries to start a launcher script. Needs to be called in the fiber pool or a loop.
|
||||||
|
|
||||||
- **Parameters:**
|
|
||||||
- `name` (string): The name of the script.
|
|
||||||
|
|
||||||
**Example Usage:**
|
**Example Usage:**
|
||||||
```lua
|
```lua
|
||||||
script.run_in_fiber(function()
|
script.run_in_fiber(function()
|
||||||
script.start_launcher_script("am_hunt_the_beast")
|
script.start_launcher_script("am_hunt_the_beast")
|
||||||
end)
|
end)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- **Parameters:**
|
||||||
|
- `script_name` (string): The name of the script.
|
||||||
|
|
||||||
|
**Example Usage:**
|
||||||
|
```lua
|
||||||
|
script.start_launcher_script(script_name)
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include "backend/looped_command.hpp"
|
#include "backend/looped_command.hpp"
|
||||||
#include "natives.hpp"
|
#include "natives.hpp"
|
||||||
|
#include "gta/vehicle_values.hpp"
|
||||||
|
|
||||||
namespace big
|
namespace big
|
||||||
{
|
{
|
||||||
@ -9,7 +10,7 @@ namespace big
|
|||||||
|
|
||||||
virtual void on_tick() override
|
virtual void on_tick() override
|
||||||
{
|
{
|
||||||
if (ENTITY::DOES_ENTITY_EXIST(self::veh))
|
if (self::veh != 0 && VEHICLE::GET_PED_IN_VEHICLE_SEAT(self::veh, SEAT_DRIVER, FALSE) == self::ped)
|
||||||
{
|
{
|
||||||
VEHICLE::SET_VEHICLE_DIRT_LEVEL(self::veh, 0.0f);
|
VEHICLE::SET_VEHICLE_DIRT_LEVEL(self::veh, 0.0f);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include "backend/looped_command.hpp"
|
#include "backend/looped_command.hpp"
|
||||||
#include "natives.hpp"
|
#include "natives.hpp"
|
||||||
#include "util/vehicle.hpp"
|
#include "util/vehicle.hpp"
|
||||||
|
#include "gta/vehicle_values.hpp"
|
||||||
|
|
||||||
namespace big
|
namespace big
|
||||||
{
|
{
|
||||||
@ -10,8 +11,14 @@ namespace big
|
|||||||
|
|
||||||
virtual void on_tick() override
|
virtual void on_tick() override
|
||||||
{
|
{
|
||||||
const auto veh = self::veh;
|
Vehicle veh = self::veh;
|
||||||
if (!ENTITY::IS_ENTITY_A_VEHICLE(veh) || !entity::take_control_of(veh, 0))
|
|
||||||
|
if (veh == 0 || VEHICLE::GET_PED_IN_VEHICLE_SEAT(self::veh, SEAT_DRIVER, FALSE) != self::ped)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!entity::take_control_of(veh, 0))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -30,7 +37,7 @@ namespace big
|
|||||||
VEHICLE::FIX_VEHICLE_WINDOW(veh, rear_window_index);
|
VEHICLE::FIX_VEHICLE_WINDOW(veh, rear_window_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_pointers->m_gta.m_decal_manager_remove(g_pointers->m_gta.m_decal_manager, g_pointers->m_gta.m_handle_to_ptr(veh), -1, 0, 0x00'01'E0'00);
|
g_pointers->m_gta.m_decal_manager_remove(g_pointers->m_gta.m_decal_manager, g_pointers->m_gta.m_handle_to_ptr(veh), -1, 0, 0x0001E000);
|
||||||
|
|
||||||
if (!g.vehicle.god_mode)
|
if (!g.vehicle.god_mode)
|
||||||
{
|
{
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include "util/pools.hpp"
|
#include "util/pools.hpp"
|
||||||
#include "services/friends/friends_service.hpp"
|
#include "services/friends/friends_service.hpp"
|
||||||
#include "services/player_database/player_database_service.hpp"
|
#include "services/player_database/player_database_service.hpp"
|
||||||
|
#include "util/ped.hpp"
|
||||||
|
|
||||||
namespace big
|
namespace big
|
||||||
{
|
{
|
||||||
@ -15,6 +16,9 @@ namespace big
|
|||||||
bool_command g_aimbot_only_on_enemy("aimonlyatenemy", "BACKEND_LOOPED_WEAPONS_AIM_ONLY_AT_ENEMY", "BACKEND_LOOPED_WEAPONS_AIM_ONLY_AT_ENEMY_DESC",
|
bool_command g_aimbot_only_on_enemy("aimonlyatenemy", "BACKEND_LOOPED_WEAPONS_AIM_ONLY_AT_ENEMY", "BACKEND_LOOPED_WEAPONS_AIM_ONLY_AT_ENEMY_DESC",
|
||||||
g.weapons.aimbot.only_on_enemy);
|
g.weapons.aimbot.only_on_enemy);
|
||||||
|
|
||||||
|
bool_command g_aimbot_only_on_threat("aimonlyatthreats", "BACKEND_LOOPED_WEAPONS_AIM_ONLY_AT_THREATS", "BACKEND_LOOPED_WEAPONS_AIM_ONLY_AT_THREATS_DESC",
|
||||||
|
g.weapons.aimbot.only_on_threats);
|
||||||
|
|
||||||
class aimbot : looped_command
|
class aimbot : looped_command
|
||||||
{
|
{
|
||||||
using looped_command::looped_command;
|
using looped_command::looped_command;
|
||||||
@ -144,13 +148,18 @@ namespace big
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const auto ped_handle = g_pointers->m_gta.m_ptr_to_handle(ped);
|
||||||
const bool is_not_a_player_and_we_target_only_players = g_aimbot_only_on_player.is_enabled() && !ped->m_player_info;
|
const bool is_not_a_player_and_we_target_only_players = g_aimbot_only_on_player.is_enabled() && !ped->m_player_info;
|
||||||
const bool we_in_the_same_vehicle = self::veh != 0 && ped->m_vehicle == g_player_service->get_self()->get_current_vehicle();
|
const bool are_we_in_the_same_vehicle = self::veh != 0 && self::veh == PED::GET_VEHICLE_PED_IS_IN(ped_handle, TRUE);
|
||||||
if (is_not_a_player_and_we_target_only_players || we_in_the_same_vehicle)
|
if (is_not_a_player_and_we_target_only_players || are_we_in_the_same_vehicle)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto weapon_info = g_local_player->m_weapon_manager->m_weapon_info;
|
||||||
|
if (PED::GET_PED_CONFIG_FLAG(ped_handle, 9, TRUE) || !g_pointers->m_gta.m_can_do_damage_to_ped(g_local_player, weapon_info, ped)) //Can't do damage to them, skip.
|
||||||
|
continue;
|
||||||
|
|
||||||
if (g.weapons.aimbot.exclude_friends && ped->m_player_info)
|
if (g.weapons.aimbot.exclude_friends && ped->m_player_info)
|
||||||
{
|
{
|
||||||
auto rockstar_id = ped->m_player_info->m_net_player_data.m_gamer_handle.m_rockstar_id;
|
auto rockstar_id = ped->m_player_info->m_net_player_data.m_gamer_handle.m_rockstar_id;
|
||||||
@ -162,29 +171,14 @@ namespace big
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto ped_handle = g_pointers->m_gta.m_ptr_to_handle(ped);
|
if (g_aimbot_only_on_enemy.is_enabled() && ped::is_ped_a_friend(ped_handle, ped))
|
||||||
|
|
||||||
if (g_aimbot_only_on_enemy.is_enabled())
|
|
||||||
{
|
|
||||||
bool is_hated_relationship = false;
|
|
||||||
bool is_in_combat = PED::IS_PED_IN_COMBAT(ped_handle, self::ped);
|
|
||||||
auto blip_color = HUD::GET_BLIP_HUD_COLOUR(HUD::GET_BLIP_FROM_ENTITY(ped_handle));
|
|
||||||
bool is_enemy = ((PED::GET_PED_CONFIG_FLAG(ped_handle, 38, TRUE) == TRUE) || (blip_color == HUD_COLOUR_RED));
|
|
||||||
|
|
||||||
switch (PED::GET_RELATIONSHIP_BETWEEN_PEDS(ped_handle, self::ped))
|
|
||||||
{
|
|
||||||
case Dislike:
|
|
||||||
case Wanted:
|
|
||||||
case Hate: is_hated_relationship = blip_color != HUD_COLOUR_BLUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!is_hated_relationship && !is_in_combat && !is_enemy)
|
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*if (PED::GET_PED_TYPE(ped_handle) != PED_TYPE_ANIMAL)
|
if (g.weapons.aimbot.only_on_threats && WEAPON::HAS_PED_GOT_WEAPON(ped_handle, 1, 1) == FALSE)
|
||||||
LOG(INFO) << " PED_TYPE " << PED::GET_PED_TYPE(ped_handle) << " hated " << is_hated_relationship << " combat " << is_in_combat << " enemy " << is_enemy << " blip_color " << blip_color;*/
|
{
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_a_ped_type_we_dont_care_about(ped_handle))
|
if (is_a_ped_type_we_dont_care_about(ped_handle))
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include "util/entity.hpp"
|
#include "util/entity.hpp"
|
||||||
#include "services/friends/friends_service.hpp"
|
#include "services/friends/friends_service.hpp"
|
||||||
#include "services/player_database/player_database_service.hpp"
|
#include "services/player_database/player_database_service.hpp"
|
||||||
|
#include "util/ped.hpp"
|
||||||
|
|
||||||
namespace big
|
namespace big
|
||||||
{
|
{
|
||||||
@ -31,12 +32,16 @@ namespace big
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
const bool trace_hit_non_player = g.weapons.aimbot.only_on_player && !ped_ptr->m_player_info;
|
const bool trace_hit_non_player = g.weapons.aimbot.only_on_player && !ped_ptr->m_player_info;
|
||||||
const bool we_in_the_same_vehicle = self::veh != 0 && ped_ptr->m_vehicle == g_player_service->get_self()->get_current_vehicle();
|
const bool are_we_in_the_same_vehicle = self::veh != 0 && self::veh == PED::GET_VEHICLE_PED_IS_IN(ped, TRUE);
|
||||||
if (trace_hit_non_player || we_in_the_same_vehicle)
|
if (trace_hit_non_player || are_we_in_the_same_vehicle)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto weapon_info = g_local_player->m_weapon_manager->m_weapon_info;
|
||||||
|
if (PED::GET_PED_CONFIG_FLAG(ped, 9, TRUE) || !g_pointers->m_gta.m_can_do_damage_to_ped(g_local_player, weapon_info, ped_ptr)) //Can't do damage to them, skip.
|
||||||
|
return;
|
||||||
|
|
||||||
if (g.weapons.aimbot.exclude_friends && ped_ptr->m_player_info)
|
if (g.weapons.aimbot.exclude_friends && ped_ptr->m_player_info)
|
||||||
{
|
{
|
||||||
auto rockstar_id = ped_ptr->m_player_info->m_net_player_data.m_gamer_handle.m_rockstar_id;
|
auto rockstar_id = ped_ptr->m_player_info->m_net_player_data.m_gamer_handle.m_rockstar_id;
|
||||||
@ -48,24 +53,14 @@ namespace big
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g.weapons.aimbot.only_on_enemy)
|
if (g.weapons.aimbot.only_on_enemy && ped::is_ped_a_friend(ped, ped_ptr))
|
||||||
{
|
|
||||||
bool is_hated_relationship = false;
|
|
||||||
bool is_in_combat = PED::IS_PED_IN_COMBAT(ped, self::ped);
|
|
||||||
auto blip_color = HUD::GET_BLIP_HUD_COLOUR(HUD::GET_BLIP_FROM_ENTITY(ped));
|
|
||||||
bool is_enemy = ((PED::GET_PED_CONFIG_FLAG(ped, 38, TRUE) == TRUE) || (blip_color == HUD_COLOUR_RED));
|
|
||||||
|
|
||||||
switch (PED::GET_RELATIONSHIP_BETWEEN_PEDS(ped, self::ped))
|
|
||||||
{
|
|
||||||
case Dislike:
|
|
||||||
case Wanted:
|
|
||||||
case Hate: is_hated_relationship = blip_color != HUD_COLOUR_BLUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!is_hated_relationship && !is_in_combat && !is_enemy)
|
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (g.weapons.aimbot.only_on_threats && WEAPON::HAS_PED_GOT_WEAPON(ped, 1, 1) == FALSE)
|
||||||
|
{
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_a_ped_type_we_dont_care_about;
|
bool is_a_ped_type_we_dont_care_about;
|
||||||
|
@ -10,4 +10,5 @@ enum class menu_event
|
|||||||
ScriptedGameEventReceived,
|
ScriptedGameEventReceived,
|
||||||
MenuUnloaded,
|
MenuUnloaded,
|
||||||
ScriptsReloaded,
|
ScriptsReloaded,
|
||||||
|
Wndproc,
|
||||||
};
|
};
|
@ -897,6 +897,7 @@ namespace big
|
|||||||
bool only_on_player = false;
|
bool only_on_player = false;
|
||||||
bool exclude_friends = false;
|
bool exclude_friends = false;
|
||||||
bool only_on_enemy = false;
|
bool only_on_enemy = false;
|
||||||
|
bool only_on_threats = false;
|
||||||
bool has_target = false;
|
bool has_target = false;
|
||||||
bool use_weapon_range = false;
|
bool use_weapon_range = false;
|
||||||
float fov = 60.f;
|
float fov = 60.f;
|
||||||
|
@ -225,4 +225,7 @@ namespace big::functions
|
|||||||
using create_chat_guid = void (*)(GUID* guid);
|
using create_chat_guid = void (*)(GUID* guid);
|
||||||
|
|
||||||
using begin_scaleform = bool (*)(uint32_t* scaleform, const char* method);
|
using begin_scaleform = bool (*)(uint32_t* scaleform, const char* method);
|
||||||
|
|
||||||
|
using is_ped_enemies_with = bool (*)(CPedIntelligence* from, CPed* target, bool check_relationship, bool skip_friend_check, bool skip_combat_task_check);
|
||||||
|
using can_do_damage_to_ped = bool (*)(CPed* from, CWeaponInfo* current_weapon, CPed* target);
|
||||||
}
|
}
|
||||||
|
@ -1469,6 +1469,7 @@ enum class BlipColors
|
|||||||
|
|
||||||
enum BlipDisplayBits : uint32_t
|
enum BlipDisplayBits : uint32_t
|
||||||
{
|
{
|
||||||
|
BlipIsFriendly = (1 << 1),
|
||||||
BlipIsFlashing = (1 << 2),
|
BlipIsFlashing = (1 << 2),
|
||||||
BlipIsGPSRoute = (1 << 4),
|
BlipIsGPSRoute = (1 << 4),
|
||||||
BlipShowHeightMarker = (1 << 5),
|
BlipShowHeightMarker = (1 << 5),
|
||||||
|
@ -408,6 +408,9 @@ namespace big
|
|||||||
uint32_t* m_game_lifetime;
|
uint32_t* m_game_lifetime;
|
||||||
|
|
||||||
functions::begin_scaleform m_begin_scaleform;
|
functions::begin_scaleform m_begin_scaleform;
|
||||||
|
|
||||||
|
functions::is_ped_enemies_with m_is_ped_enemies_with;
|
||||||
|
functions::can_do_damage_to_ped m_can_do_damage_to_ped;
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
static_assert(sizeof(gta_pointers) % 8 == 0, "Pointers are not properly aligned");
|
static_assert(sizeof(gta_pointers) % 8 == 0, "Pointers are not properly aligned");
|
||||||
|
11
src/gui.cpp
11
src/gui.cpp
@ -1,5 +1,6 @@
|
|||||||
#include "gui.hpp"
|
#include "gui.hpp"
|
||||||
|
|
||||||
|
#include "lua/lua_manager.hpp"
|
||||||
#include "natives.hpp"
|
#include "natives.hpp"
|
||||||
#include "renderer/renderer.hpp"
|
#include "renderer/renderer.hpp"
|
||||||
#include "script.hpp"
|
#include "script.hpp"
|
||||||
@ -21,6 +22,7 @@ namespace big
|
|||||||
// medium priority
|
// medium priority
|
||||||
MENU = 0x1000,
|
MENU = 0x1000,
|
||||||
VEHICLE_CONTROL,
|
VEHICLE_CONTROL,
|
||||||
|
LUA,
|
||||||
|
|
||||||
// high priority
|
// high priority
|
||||||
INFO_OVERLAY = 0x2000,
|
INFO_OVERLAY = 0x2000,
|
||||||
@ -53,6 +55,15 @@ namespace big
|
|||||||
},
|
},
|
||||||
eRenderPriority::MENU);
|
eRenderPriority::MENU);
|
||||||
|
|
||||||
|
g_renderer.add_dx_callback(
|
||||||
|
[] {
|
||||||
|
g_lua_manager->draw_always_draw_gui();
|
||||||
|
},
|
||||||
|
eRenderPriority::LUA);
|
||||||
|
|
||||||
|
g_renderer.add_wndproc_callback([](HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
|
||||||
|
g_lua_manager->trigger_event<menu_event::Wndproc>(hwnd, msg, wparam, lparam);
|
||||||
|
});
|
||||||
g_renderer.add_wndproc_callback([this](HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
|
g_renderer.add_wndproc_callback([this](HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
|
||||||
wndproc(hwnd, msg, wparam, lparam);
|
wndproc(hwnd, msg, wparam, lparam);
|
||||||
});
|
});
|
||||||
|
@ -98,6 +98,18 @@ namespace lua::event
|
|||||||
// end)
|
// end)
|
||||||
// ```
|
// ```
|
||||||
|
|
||||||
|
// Lua API: Field
|
||||||
|
// Table: menu_event
|
||||||
|
// Field: Wndproc: integer
|
||||||
|
// Event that is triggered when Wndproc is called
|
||||||
|
// **Example Usage:**
|
||||||
|
// ```lua
|
||||||
|
// event.register_handler(menu_event.Wndproc, function (hwnd, msg, wparam, lparam)
|
||||||
|
// if msg == 132 then return end
|
||||||
|
// log.debug("hwnd = " .. tostring(hwnd) .. ", msg = " .. tostring(msg) .. ", wparam = " .. tostring(wparam) .. ", lparam = " .. tostring(lparam))
|
||||||
|
// end)
|
||||||
|
// ```
|
||||||
|
|
||||||
// Lua API: Table
|
// Lua API: Table
|
||||||
// Name: event
|
// Name: event
|
||||||
// Table for responding to various events. The list of events is available in the menu_event table.
|
// Table for responding to various events. The list of events is available in the menu_event table.
|
||||||
@ -127,6 +139,7 @@ namespace lua::event
|
|||||||
{"ScriptedGameEventReceived", menu_event::ScriptedGameEventReceived},
|
{"ScriptedGameEventReceived", menu_event::ScriptedGameEventReceived},
|
||||||
{"MenuUnloaded", menu_event::MenuUnloaded},
|
{"MenuUnloaded", menu_event::MenuUnloaded},
|
||||||
{"ScriptsReloaded", menu_event::ScriptsReloaded},
|
{"ScriptsReloaded", menu_event::ScriptsReloaded},
|
||||||
|
{"Wndproc", menu_event::Wndproc},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
@ -11,6 +11,13 @@ namespace lua::gui
|
|||||||
module->m_independent_gui.push_back(std::move(element));
|
module->m_independent_gui.push_back(std::move(element));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void add_always_draw_element(lua_State* state, std::unique_ptr<lua::gui::gui_element> element)
|
||||||
|
{
|
||||||
|
big::lua_module* module = sol::state_view(state)["!this"];
|
||||||
|
|
||||||
|
module->m_always_draw_gui.push_back(std::move(element));
|
||||||
|
}
|
||||||
|
|
||||||
static void add_element(lua_State* state, uint32_t hash, std::unique_ptr<lua::gui::gui_element> element)
|
static void add_element(lua_State* state, uint32_t hash, std::unique_ptr<lua::gui::gui_element> element)
|
||||||
{
|
{
|
||||||
big::lua_module* module = sol::state_view(state)["!this"];
|
big::lua_module* module = sol::state_view(state)["!this"];
|
||||||
@ -296,6 +303,35 @@ namespace lua::gui
|
|||||||
return big::g_gui->is_open();
|
return big::g_gui->is_open();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Lua API: Function
|
||||||
|
// Table: gui
|
||||||
|
// Name: toggle
|
||||||
|
// Param: toggle: boolean
|
||||||
|
// Opens and closes the gui.
|
||||||
|
static void toggle(bool toggle)
|
||||||
|
{
|
||||||
|
big::g_gui->toggle(toggle);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Lua API: Function
|
||||||
|
// Table: gui
|
||||||
|
// Name: mouse_override
|
||||||
|
// Returns: bool: Returns true if the mouse is overridden.
|
||||||
|
static bool mouse_override()
|
||||||
|
{
|
||||||
|
return big::g_gui->mouse_override();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Lua API: Function
|
||||||
|
// Table: gui
|
||||||
|
// Name: override_mouse
|
||||||
|
// Param: override: boolean
|
||||||
|
static void override_mouse(bool override)
|
||||||
|
{
|
||||||
|
big::g_gui->override_mouse(override);
|
||||||
|
}
|
||||||
|
|
||||||
// Lua API: Function
|
// Lua API: Function
|
||||||
// Table: gui
|
// Table: gui
|
||||||
// Name: add_imgui
|
// Name: add_imgui
|
||||||
@ -323,6 +359,33 @@ namespace lua::gui
|
|||||||
return el_ptr;
|
return el_ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Lua API: Function
|
||||||
|
// Table: gui
|
||||||
|
// Name: add_always_draw_imgui
|
||||||
|
// Param: imgui_rendering: function: Function that will be called every rendering frame, you can call ImGui functions in it, please check the ImGui.md documentation file for more info.
|
||||||
|
// Registers a function that will be called every rendering frame, you can call ImGui functions in it, please check the ImGui.md documentation file for more info. This function will be called even when the menu is closed.
|
||||||
|
// **Example Usage:**
|
||||||
|
// ```lua
|
||||||
|
// gui.add_always_draw_imgui(function()
|
||||||
|
// if ImGui.Begin("My Custom Window") then
|
||||||
|
// if ImGui.Button("Label") then
|
||||||
|
// script.run_in_fiber(function(script)
|
||||||
|
// -- call natives in there
|
||||||
|
// end)
|
||||||
|
// end
|
||||||
|
//
|
||||||
|
// ImGui.End()
|
||||||
|
// end
|
||||||
|
// end)
|
||||||
|
// ``
|
||||||
|
static lua::gui::raw_imgui_callback* add_always_draw_imgui(sol::protected_function imgui_rendering, sol::this_state state)
|
||||||
|
{
|
||||||
|
auto element = std::make_unique<lua::gui::raw_imgui_callback>(imgui_rendering);
|
||||||
|
auto el_ptr = element.get();
|
||||||
|
add_always_draw_element(state, std::move(element));
|
||||||
|
return el_ptr;
|
||||||
|
}
|
||||||
|
|
||||||
void bind(sol::state& state)
|
void bind(sol::state& state)
|
||||||
{
|
{
|
||||||
auto ns = state["gui"].get_or_create<sol::table>();
|
auto ns = state["gui"].get_or_create<sol::table>();
|
||||||
@ -333,7 +396,11 @@ namespace lua::gui
|
|||||||
ns["show_warning"] = show_warning;
|
ns["show_warning"] = show_warning;
|
||||||
ns["show_error"] = show_error;
|
ns["show_error"] = show_error;
|
||||||
ns["is_open"] = is_open;
|
ns["is_open"] = is_open;
|
||||||
|
ns["toggle"] = toggle;
|
||||||
|
ns["mouse_override"] = mouse_override;
|
||||||
|
ns["override_mouse"] = override_mouse;
|
||||||
ns["add_imgui"] = add_imgui;
|
ns["add_imgui"] = add_imgui;
|
||||||
|
ns["add_always_draw_imgui"] = add_always_draw_imgui;
|
||||||
|
|
||||||
auto button_ut = ns.new_usertype<lua::gui::button>("button");
|
auto button_ut = ns.new_usertype<lua::gui::button>("button");
|
||||||
button_ut["get_text"] = &lua::gui::button::get_text;
|
button_ut["get_text"] = &lua::gui::button::get_text;
|
||||||
|
@ -50,6 +50,8 @@ namespace lua::gui
|
|||||||
// Lua API: Function
|
// Lua API: Function
|
||||||
// Class: tab
|
// Class: tab
|
||||||
// Name: add_tab
|
// Name: add_tab
|
||||||
|
// Param: tab_name: string: Name of the tab to add.
|
||||||
|
// Returns: tab: A tab instance which corresponds to the new tab in the GUI.
|
||||||
// Add a sub tab to this tab.
|
// Add a sub tab to this tab.
|
||||||
tab add_tab(const std::string& name, sol::this_state state);
|
tab add_tab(const std::string& name, sol::this_state state);
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
#include "imgui.h"
|
||||||
|
|
||||||
namespace lua::imgui
|
namespace lua::imgui
|
||||||
{
|
{
|
||||||
@ -417,6 +418,10 @@ namespace lua::imgui
|
|||||||
{
|
{
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
}
|
}
|
||||||
|
inline void SeparatorText(const char* label)
|
||||||
|
{
|
||||||
|
ImGui::SeparatorText(label);
|
||||||
|
}
|
||||||
inline void SameLine()
|
inline void SameLine()
|
||||||
{
|
{
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
@ -1255,7 +1260,7 @@ namespace lua::imgui
|
|||||||
float value[3] = {static_cast<float>(v1), static_cast<float>(v2), static_cast<float>(v3)};
|
float value[3] = {static_cast<float>(v1), static_cast<float>(v2), static_cast<float>(v3)};
|
||||||
bool used = ImGui::SliderFloat3(label.c_str(), value, v_min, v_max);
|
bool used = ImGui::SliderFloat3(label.c_str(), value, v_min, v_max);
|
||||||
|
|
||||||
sol::as_table_t float3 = sol::as_table(std::vector<float>{value[0], value[1], value[3]});
|
sol::as_table_t float3 = sol::as_table(std::vector<float>{value[0], value[1], value[2]});
|
||||||
|
|
||||||
return std::make_tuple(float3, used);
|
return std::make_tuple(float3, used);
|
||||||
}
|
}
|
||||||
@ -1267,7 +1272,7 @@ namespace lua::imgui
|
|||||||
float value[3] = {static_cast<float>(v1), static_cast<float>(v2), static_cast<float>(v3)};
|
float value[3] = {static_cast<float>(v1), static_cast<float>(v2), static_cast<float>(v3)};
|
||||||
bool used = ImGui::SliderFloat3(label.c_str(), value, v_min, v_max, format.c_str());
|
bool used = ImGui::SliderFloat3(label.c_str(), value, v_min, v_max, format.c_str());
|
||||||
|
|
||||||
sol::as_table_t float3 = sol::as_table(std::vector<float>{value[0], value[1], value[3]});
|
sol::as_table_t float3 = sol::as_table(std::vector<float>{value[0], value[1], value[2]});
|
||||||
|
|
||||||
return std::make_tuple(float3, used);
|
return std::make_tuple(float3, used);
|
||||||
}
|
}
|
||||||
@ -1279,7 +1284,7 @@ namespace lua::imgui
|
|||||||
float value[3] = {static_cast<float>(v1), static_cast<float>(v2), static_cast<float>(v3)};
|
float value[3] = {static_cast<float>(v1), static_cast<float>(v2), static_cast<float>(v3)};
|
||||||
bool used = ImGui::SliderFloat3(label.c_str(), value, v_min, v_max, format.c_str(), flags);
|
bool used = ImGui::SliderFloat3(label.c_str(), value, v_min, v_max, format.c_str(), flags);
|
||||||
|
|
||||||
sol::as_table_t float3 = sol::as_table(std::vector<float>{value[0], value[1], value[3]});
|
sol::as_table_t float3 = sol::as_table(std::vector<float>{value[0], value[1], value[2]});
|
||||||
|
|
||||||
return std::make_tuple(float3, used);
|
return std::make_tuple(float3, used);
|
||||||
}
|
}
|
||||||
@ -3338,6 +3343,7 @@ namespace lua::imgui
|
|||||||
|
|
||||||
#pragma region Cursor / Layout
|
#pragma region Cursor / Layout
|
||||||
ImGui.set_function("Separator", Separator);
|
ImGui.set_function("Separator", Separator);
|
||||||
|
ImGui.set_function("SeparatorText", SeparatorText);
|
||||||
ImGui.set_function("SameLine", sol::overload(sol::resolve<void()>(SameLine), sol::resolve<void(float)>(SameLine)));
|
ImGui.set_function("SameLine", sol::overload(sol::resolve<void()>(SameLine), sol::resolve<void(float)>(SameLine)));
|
||||||
ImGui.set_function("NewLine", NewLine);
|
ImGui.set_function("NewLine", NewLine);
|
||||||
ImGui.set_function("Spacing", Spacing);
|
ImGui.set_function("Spacing", Spacing);
|
||||||
|
@ -62,6 +62,11 @@ namespace lua::memory
|
|||||||
return m_address;
|
return m_address;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void pointer::set_address(uint64_t address)
|
||||||
|
{
|
||||||
|
m_address = address;
|
||||||
|
}
|
||||||
|
|
||||||
// Lua API: Table
|
// Lua API: Table
|
||||||
// Name: memory
|
// Name: memory
|
||||||
// Table containing helper functions related to process memory.
|
// Table containing helper functions related to process memory.
|
||||||
@ -647,6 +652,7 @@ namespace lua::memory
|
|||||||
pointer_ut["is_valid"] = &pointer::is_valid;
|
pointer_ut["is_valid"] = &pointer::is_valid;
|
||||||
pointer_ut["deref"] = &pointer::deref;
|
pointer_ut["deref"] = &pointer::deref;
|
||||||
pointer_ut["get_address"] = &pointer::get_address;
|
pointer_ut["get_address"] = &pointer::get_address;
|
||||||
|
pointer_ut["set_address"] = &pointer::set_address;
|
||||||
|
|
||||||
auto patch_ut = ns.new_usertype<big::lua_patch>("patch", sol::no_constructor);
|
auto patch_ut = ns.new_usertype<big::lua_patch>("patch", sol::no_constructor);
|
||||||
patch_ut["apply"] = &big::lua_patch::apply;
|
patch_ut["apply"] = &big::lua_patch::apply;
|
||||||
|
@ -58,6 +58,12 @@ namespace lua::memory
|
|||||||
// Returns: number: the value stored at the memory address as the specified type.
|
// Returns: number: the value stored at the memory address as the specified type.
|
||||||
// Retrieves the value stored at the memory address as the specified type.
|
// Retrieves the value stored at the memory address as the specified type.
|
||||||
|
|
||||||
|
// Lua API: Function
|
||||||
|
// Class: pointer
|
||||||
|
// Name: get_int
|
||||||
|
// Returns: number: the value stored at the memory address as the specified type.
|
||||||
|
// Retrieves the value stored at the memory address as the specified type.
|
||||||
|
|
||||||
// Lua API: Function
|
// Lua API: Function
|
||||||
// Class: pointer
|
// Class: pointer
|
||||||
// Name: get_dword
|
// Name: get_dword
|
||||||
@ -94,6 +100,12 @@ namespace lua::memory
|
|||||||
// Param: value: number: new value.
|
// Param: value: number: new value.
|
||||||
// Sets the value at the memory address to the specified value of the given type.
|
// Sets the value at the memory address to the specified value of the given type.
|
||||||
|
|
||||||
|
// Lua API: Function
|
||||||
|
// Class: pointer
|
||||||
|
// Name: set_int
|
||||||
|
// Param: value: number: new value.
|
||||||
|
// Sets the value at the memory address to the specified value of the given type.
|
||||||
|
|
||||||
// Lua API: Function
|
// Lua API: Function
|
||||||
// Class: pointer
|
// Class: pointer
|
||||||
// Name: set_dword
|
// Name: set_dword
|
||||||
@ -204,6 +216,13 @@ namespace lua::memory
|
|||||||
// Returns: number: The memory address stored in the pointer object as a number.
|
// Returns: number: The memory address stored in the pointer object as a number.
|
||||||
// Retrieves the memory address stored in the pointer object.
|
// Retrieves the memory address stored in the pointer object.
|
||||||
uint64_t get_address() const;
|
uint64_t get_address() const;
|
||||||
|
|
||||||
|
// Lua API: Function
|
||||||
|
// Class: pointer
|
||||||
|
// Name: set_address
|
||||||
|
// Param: address: integer: new address.
|
||||||
|
// Sets the memory address stored in the pointer object.
|
||||||
|
void set_address(uint64_t address);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Lua API: Class
|
// Lua API: Class
|
||||||
|
@ -188,11 +188,11 @@ namespace lua::network
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Lua API: function
|
// Lua API: function
|
||||||
// Table: script
|
// Table: network
|
||||||
// Name: force_script_on_player
|
// Name: force_script_on_player
|
||||||
// Param: player_idx: integer: Index of the player.
|
// Param: player_idx: integer: Index of the player.
|
||||||
// Param: script_name: string: Name of the script.
|
// Param: script_name: string: Name of the script.
|
||||||
// Param: script_name: integer: Instance ID of the script.
|
// Param: instance_id: integer: Instance ID of the script.
|
||||||
// Forces the given GTA script to be started on a player. Needs to be called in the fiber pool or a loop.
|
// Forces the given GTA script to be started on a player. Needs to be called in the fiber pool or a loop.
|
||||||
static void force_script_on_player(int player_idx, const std::string& script_name, int instance_id)
|
static void force_script_on_player(int player_idx, const std::string& script_name, int instance_id)
|
||||||
{
|
{
|
||||||
@ -229,6 +229,7 @@ namespace lua::network
|
|||||||
// Table: network
|
// Table: network
|
||||||
// Name: get_player_rank
|
// Name: get_player_rank
|
||||||
// Param: pid: integer: Index of the player.
|
// Param: pid: integer: Index of the player.
|
||||||
|
// Returns: integer: An integer which contains the players rank.
|
||||||
// Call get_player_rank(playerID)
|
// Call get_player_rank(playerID)
|
||||||
static int get_player_rank(int pid)
|
static int get_player_rank(int pid)
|
||||||
{
|
{
|
||||||
@ -244,6 +245,7 @@ namespace lua::network
|
|||||||
// Table: network
|
// Table: network
|
||||||
// Name: get_player_rp
|
// Name: get_player_rp
|
||||||
// Param: pid: integer: Index of the player.
|
// Param: pid: integer: Index of the player.
|
||||||
|
// Returns: integer: An integer which contains the players rp.
|
||||||
// Call get_player_rp(playerID)
|
// Call get_player_rp(playerID)
|
||||||
static int get_player_rp(int pid)
|
static int get_player_rp(int pid)
|
||||||
{
|
{
|
||||||
@ -259,6 +261,7 @@ namespace lua::network
|
|||||||
// Table: network
|
// Table: network
|
||||||
// Name: get_player_money
|
// Name: get_player_money
|
||||||
// Param: pid: integer: Index of the player.
|
// Param: pid: integer: Index of the player.
|
||||||
|
// Returns: integer: An integer which contains the players money.
|
||||||
// Call get_player_money(playerID)
|
// Call get_player_money(playerID)
|
||||||
static int get_player_money(int pid)
|
static int get_player_money(int pid)
|
||||||
{
|
{
|
||||||
@ -274,6 +277,7 @@ namespace lua::network
|
|||||||
// Table: network
|
// Table: network
|
||||||
// Name: get_player_wallet
|
// Name: get_player_wallet
|
||||||
// Param: pid: integer: Index of the player.
|
// Param: pid: integer: Index of the player.
|
||||||
|
// Returns: integer: An integer which contains the players wallet.
|
||||||
// Call get_player_wallet(playerID)
|
// Call get_player_wallet(playerID)
|
||||||
static int get_player_wallet(int pid)
|
static int get_player_wallet(int pid)
|
||||||
{
|
{
|
||||||
@ -289,6 +293,7 @@ namespace lua::network
|
|||||||
// Table: network
|
// Table: network
|
||||||
// Name: get_player_bank
|
// Name: get_player_bank
|
||||||
// Param: pid: integer: Index of the player.
|
// Param: pid: integer: Index of the player.
|
||||||
|
// Returns: integer: An integer which contains the players bank.
|
||||||
// Call get_player_bank(playerID)
|
// Call get_player_bank(playerID)
|
||||||
static int get_player_bank(int pid)
|
static int get_player_bank(int pid)
|
||||||
{
|
{
|
||||||
@ -304,6 +309,7 @@ namespace lua::network
|
|||||||
// Table: network
|
// Table: network
|
||||||
// Name: get_player_language_id
|
// Name: get_player_language_id
|
||||||
// Param: pid: integer: Index of the player.
|
// Param: pid: integer: Index of the player.
|
||||||
|
// Returns: integer: An integer which contains the players language id.
|
||||||
// Call get_player_language_id(playerID)
|
// Call get_player_language_id(playerID)
|
||||||
static int get_player_language_id(int pid)
|
static int get_player_language_id(int pid)
|
||||||
{
|
{
|
||||||
@ -319,6 +325,7 @@ namespace lua::network
|
|||||||
// Table: network
|
// Table: network
|
||||||
// Name: get_player_language_name
|
// Name: get_player_language_name
|
||||||
// Param: pid: integer: Index of the player.
|
// Param: pid: integer: Index of the player.
|
||||||
|
// Returns: string: A string which contains the players language name.
|
||||||
// Call get_player_language_name(playerID)
|
// Call get_player_language_name(playerID)
|
||||||
static std::string get_player_language_name(int pid)
|
static std::string get_player_language_name(int pid)
|
||||||
{
|
{
|
||||||
|
@ -188,8 +188,8 @@ namespace lua::script
|
|||||||
// Param: script_name: string: The name of the script.
|
// Param: script_name: string: The name of the script.
|
||||||
// Param: name: string: The name of the patch.
|
// Param: name: string: The name of the patch.
|
||||||
// Param: pattern: string: The pattern to scan for within the script.
|
// Param: pattern: string: The pattern to scan for within the script.
|
||||||
// Param offset: integer: The position within the pattern.
|
// Param: offset: integer: The position within the pattern.
|
||||||
// Param _patch: table: The bytes to be written into the script's bytecode.
|
// Param: _patch: table: The bytes to be written into the script's bytecode.
|
||||||
// Adds a patch for the specified script.
|
// Adds a patch for the specified script.
|
||||||
// **Example Usage:**
|
// **Example Usage:**
|
||||||
// ```lua
|
// ```lua
|
||||||
|
@ -11,7 +11,7 @@ namespace lua::vector
|
|||||||
// Param: x: float: x component of the vector.
|
// Param: x: float: x component of the vector.
|
||||||
// Param: y: float: y component of the vector.
|
// Param: y: float: y component of the vector.
|
||||||
// Param: z: float: z component of the vector.
|
// Param: z: float: z component of the vector.
|
||||||
// Returns a vector that contains the x, y, and z values.
|
// Returns: vec3: a vector that contains the x, y, and z values.
|
||||||
|
|
||||||
// Lua API: Field
|
// Lua API: Field
|
||||||
// Class: vec3
|
// Class: vec3
|
||||||
|
@ -150,6 +150,19 @@ namespace big
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void lua_manager::draw_always_draw_gui()
|
||||||
|
{
|
||||||
|
std::lock_guard guard(m_module_lock);
|
||||||
|
|
||||||
|
for (const auto& module : m_modules)
|
||||||
|
{
|
||||||
|
for (const auto& element : module->m_always_draw_gui)
|
||||||
|
{
|
||||||
|
element->draw();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void lua_manager::draw_gui(rage::joaat_t tab_hash)
|
void lua_manager::draw_gui(rage::joaat_t tab_hash)
|
||||||
{
|
{
|
||||||
std::lock_guard guard(m_module_lock);
|
std::lock_guard guard(m_module_lock);
|
||||||
@ -303,6 +316,10 @@ namespace big
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Some scripts are library scripts, they do nothing on their own and are intended to be used with require, they take up space in the script list for no reason.
|
||||||
|
if (std::filesystem::relative(module_path.parent_path(), m_scripts_folder.get_path()).wstring().contains(L"includes"))
|
||||||
|
return {};
|
||||||
|
|
||||||
const auto module_name = module_path.filename().string();
|
const auto module_name = module_path.filename().string();
|
||||||
const auto id = rage::joaat(module_name);
|
const auto id = rage::joaat(module_name);
|
||||||
|
|
||||||
|
@ -48,6 +48,7 @@ namespace big
|
|||||||
|
|
||||||
bool has_gui_to_draw(rage::joaat_t tab_hash);
|
bool has_gui_to_draw(rage::joaat_t tab_hash);
|
||||||
void draw_independent_gui();
|
void draw_independent_gui();
|
||||||
|
void draw_always_draw_gui();
|
||||||
void draw_gui(rage::joaat_t tab_hash);
|
void draw_gui(rage::joaat_t tab_hash);
|
||||||
|
|
||||||
bool dynamic_hook_pre_callbacks(const uintptr_t target_func_ptr, lua::memory::type_info_t return_type, lua::memory::runtime_func_t::return_value_t* return_value, std::vector<lua::memory::type_info_t> param_types, const lua::memory::runtime_func_t::parameters_t* params, const uint8_t param_count);
|
bool dynamic_hook_pre_callbacks(const uintptr_t target_func_ptr, lua::memory::type_info_t return_type, lua::memory::runtime_func_t::return_value_t* return_value, std::vector<lua::memory::type_info_t> param_types, const lua::memory::runtime_func_t::parameters_t* params, const uint8_t param_count);
|
||||||
|
@ -34,6 +34,7 @@ namespace big
|
|||||||
std::unordered_map<big::tabs, std::vector<big::tabs>> m_tab_to_sub_tabs;
|
std::unordered_map<big::tabs, std::vector<big::tabs>> m_tab_to_sub_tabs;
|
||||||
|
|
||||||
std::vector<std::unique_ptr<lua::gui::gui_element>> m_independent_gui;
|
std::vector<std::unique_ptr<lua::gui::gui_element>> m_independent_gui;
|
||||||
|
std::vector<std::unique_ptr<lua::gui::gui_element>> m_always_draw_gui;
|
||||||
std::unordered_map<rage::joaat_t, std::vector<std::unique_ptr<lua::gui::gui_element>>> m_gui;
|
std::unordered_map<rage::joaat_t, std::vector<std::unique_ptr<lua::gui::gui_element>>> m_gui;
|
||||||
std::unordered_map<menu_event, std::vector<sol::protected_function>> m_event_callbacks;
|
std::unordered_map<menu_event, std::vector<sol::protected_function>> m_event_callbacks;
|
||||||
std::vector<void*> m_allocated_memory;
|
std::vector<void*> m_allocated_memory;
|
||||||
|
@ -1940,6 +1940,24 @@ namespace big
|
|||||||
{
|
{
|
||||||
g_pointers->m_gta.m_begin_scaleform = ptr.as<functions::begin_scaleform>();
|
g_pointers->m_gta.m_begin_scaleform = ptr.as<functions::begin_scaleform>();
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
// Is Ped Enemies With
|
||||||
|
{
|
||||||
|
"IPEW",
|
||||||
|
"E8 ? ? ? ? 45 8A FE 84 C0",
|
||||||
|
[](memory::handle ptr)
|
||||||
|
{
|
||||||
|
g_pointers->m_gta.m_is_ped_enemies_with = ptr.add(1).rip().as<functions::is_ped_enemies_with>();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// Can Do Damage
|
||||||
|
{
|
||||||
|
"CDD",
|
||||||
|
"E8 ? ? ? ? 45 8A C4 84 C0",
|
||||||
|
[](memory::handle ptr)
|
||||||
|
{
|
||||||
|
g_pointers->m_gta.m_can_do_damage_to_ped = ptr.add(1).rip().as<functions::can_do_damage_to_ped>();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
>(); // don't leave a trailing comma at the end
|
>(); // don't leave a trailing comma at the end
|
||||||
|
|
||||||
|
@ -30,10 +30,18 @@ namespace big
|
|||||||
{
|
{
|
||||||
auto thread = gta_util::find_script_thread(m_script);
|
auto thread = gta_util::find_script_thread(m_script);
|
||||||
auto program = gta_util::find_script_program(m_script);
|
auto program = gta_util::find_script_program(m_script);
|
||||||
auto ip = get_ip(program);
|
|
||||||
|
|
||||||
if (!thread || !program || !ip)
|
if (!thread || !program)
|
||||||
|
{
|
||||||
|
LOG(FATAL) << m_name << " failed to find its associated script running.";
|
||||||
return Ret();
|
return Ret();
|
||||||
|
}
|
||||||
|
|
||||||
|
auto ip = get_ip(program);
|
||||||
|
if (!ip)
|
||||||
|
{
|
||||||
|
return Ret();
|
||||||
|
}
|
||||||
|
|
||||||
auto tls_ctx = rage::tlsContext::get();
|
auto tls_ctx = rage::tlsContext::get();
|
||||||
auto stack = (uint64_t*)thread->m_stack;
|
auto stack = (uint64_t*)thread->m_stack;
|
||||||
@ -70,5 +78,7 @@ namespace big
|
|||||||
inline script_function reset_session_data("RSD", "main_persistent"_J, "2D 02 7D 00 00");
|
inline script_function reset_session_data("RSD", "main_persistent"_J, "2D 02 7D 00 00");
|
||||||
inline script_function add_clan_logo_to_vehicle("ACLTV", "main_persistent"_J, "2D 02 04 00 00 5D ? ? ? 61");
|
inline script_function add_clan_logo_to_vehicle("ACLTV", "main_persistent"_J, "2D 02 04 00 00 5D ? ? ? 61");
|
||||||
inline script_function vehicle_cannot_accept_clan_logo("CVACL", "main_persistent"_J, "2D 01 03 00 00 2C 01 00 A1 06 ? 04");
|
inline script_function vehicle_cannot_accept_clan_logo("CVACL", "main_persistent"_J, "2D 01 03 00 00 2C 01 00 A1 06 ? 04");
|
||||||
|
inline script_function get_component_name_string("GCNS", "mp_weapons"_J, "2D 02 43 00 00 38 01");
|
||||||
|
inline script_function get_component_desc_string("GCDS", "mp_weapons"_J, "2D 02 43 00 00 38 00");
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -218,6 +218,27 @@ namespace big
|
|||||||
std::sort(m_weapon_types.begin(), m_weapon_types.end());
|
std::sort(m_weapon_types.begin(), m_weapon_types.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static RPFDatafileSource determine_file_type(std::string file_path, std::string_view rpf_filename)
|
||||||
|
{
|
||||||
|
if (file_path.contains("/dlc_patch/"))
|
||||||
|
{
|
||||||
|
return RPFDatafileSource::DLCUPDATE;
|
||||||
|
}
|
||||||
|
else if (rpf_filename == "dlc.rpf")
|
||||||
|
{
|
||||||
|
return RPFDatafileSource::DLC;
|
||||||
|
}
|
||||||
|
else if (rpf_filename == "update.rpf")
|
||||||
|
{
|
||||||
|
return RPFDatafileSource::UPDATE;
|
||||||
|
}
|
||||||
|
else if (rpf_filename == "common.rpf")
|
||||||
|
{
|
||||||
|
return RPFDatafileSource::BASE;
|
||||||
|
}
|
||||||
|
return RPFDatafileSource::UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
inline void parse_ped(std::vector<ped_item>& peds, std::vector<uint32_t>& mapped_peds, pugi::xml_document& doc)
|
inline void parse_ped(std::vector<ped_item>& peds, std::vector<uint32_t>& mapped_peds, pugi::xml_document& doc)
|
||||||
{
|
{
|
||||||
const auto& items = doc.select_nodes("/CPedModelInfo__InitDataList/InitDatas/Item");
|
const auto& items = doc.select_nodes("/CPedModelInfo__InitDataList/InitDatas/Item");
|
||||||
@ -256,9 +277,12 @@ namespace big
|
|||||||
hash_array mapped_weapons;
|
hash_array mapped_weapons;
|
||||||
hash_array mapped_components;
|
hash_array mapped_components;
|
||||||
|
|
||||||
|
int mp_weapons_thread_id = 0;
|
||||||
|
|
||||||
std::vector<ped_item> peds;
|
std::vector<ped_item> peds;
|
||||||
std::vector<vehicle_item> vehicles;
|
std::vector<vehicle_item> vehicles;
|
||||||
std::vector<weapon_item> weapons;
|
//std::vector<weapon_item> weapons;
|
||||||
|
std::unordered_map<Hash, weapon_item_parsed> weapons;
|
||||||
std::vector<weapon_component> weapon_components;
|
std::vector<weapon_component> weapon_components;
|
||||||
|
|
||||||
constexpr auto exists = [](const hash_array& arr, uint32_t val) -> bool {
|
constexpr auto exists = [](const hash_array& arr, uint32_t val) -> bool {
|
||||||
@ -307,7 +331,7 @@ namespace big
|
|||||||
}
|
}
|
||||||
else if (const auto file_str = path.string(); file_str.find("weaponcomponents") != std::string::npos && path.extension() == ".meta")
|
else if (const auto file_str = path.string(); file_str.find("weaponcomponents") != std::string::npos && path.extension() == ".meta")
|
||||||
{
|
{
|
||||||
rpf_wrapper.read_xml_file(path, [&exists, &weapon_components, &mapped_components](pugi::xml_document& doc) {
|
rpf_wrapper.read_xml_file(path, [&exists, &weapon_components, &mapped_components, &mp_weapons_thread_id](pugi::xml_document& doc) {
|
||||||
const auto& items = doc.select_nodes("/CWeaponComponentInfoBlob/Infos/*[self::Item[@type='CWeaponComponentInfo'] or self::Item[@type='CWeaponComponentFlashLightInfo'] or self::Item[@type='CWeaponComponentScopeInfo'] or self::Item[@type='CWeaponComponentSuppressorInfo'] or self::Item[@type='CWeaponComponentVariantModelInfo'] or self::Item[@type='CWeaponComponentClipInfo']]");
|
const auto& items = doc.select_nodes("/CWeaponComponentInfoBlob/Infos/*[self::Item[@type='CWeaponComponentInfo'] or self::Item[@type='CWeaponComponentFlashLightInfo'] or self::Item[@type='CWeaponComponentScopeInfo'] or self::Item[@type='CWeaponComponentSuppressorInfo'] or self::Item[@type='CWeaponComponentVariantModelInfo'] or self::Item[@type='CWeaponComponentClipInfo']]");
|
||||||
for (const auto& item_node : items)
|
for (const auto& item_node : items)
|
||||||
{
|
{
|
||||||
@ -315,7 +339,7 @@ namespace big
|
|||||||
const std::string name = item.child("Name").text().as_string();
|
const std::string name = item.child("Name").text().as_string();
|
||||||
const auto hash = rage::joaat(name);
|
const auto hash = rage::joaat(name);
|
||||||
|
|
||||||
if (!name.starts_with("COMPONENT"))
|
if (!name.starts_with("COMPONENT") || name.ends_with("MK2_UPGRADE"))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -329,10 +353,53 @@ namespace big
|
|||||||
std::string LocName = item.child("LocName").text().as_string();
|
std::string LocName = item.child("LocName").text().as_string();
|
||||||
std::string LocDesc = item.child("LocDesc").text().as_string();
|
std::string LocDesc = item.child("LocDesc").text().as_string();
|
||||||
|
|
||||||
if (LocName.ends_with("INVALID") || LocName.ends_with("RAIL"))
|
if (LocName.ends_with("RAIL"))
|
||||||
{
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (LocName.ends_with("INVALID"))
|
||||||
|
{
|
||||||
|
constexpr Hash script_hash = "MP_Weapons"_J;
|
||||||
|
if (!SCRIPT::GET_NUMBER_OF_THREADS_RUNNING_THE_SCRIPT_WITH_THIS_HASH(script_hash))
|
||||||
|
{
|
||||||
|
while (!SCRIPT::HAS_SCRIPT_WITH_NAME_HASH_LOADED(script_hash))
|
||||||
|
{
|
||||||
|
SCRIPT::REQUEST_SCRIPT_WITH_NAME_HASH(script_hash);
|
||||||
|
script::get_current()->yield(10ms);
|
||||||
}
|
}
|
||||||
|
mp_weapons_thread_id = SYSTEM::START_NEW_SCRIPT_WITH_NAME_HASH(script_hash, 1424);
|
||||||
|
auto thread = gta_util::find_script_thread_by_id(mp_weapons_thread_id);
|
||||||
|
if (thread)
|
||||||
|
thread->m_context.m_state = rage::eThreadState::unk_3;
|
||||||
|
else
|
||||||
|
LOG(FATAL) << "Failed to find MP_Weapons script!";
|
||||||
|
SCRIPT::SET_SCRIPT_WITH_NAME_HASH_AS_NO_LONGER_NEEDED(script_hash);
|
||||||
|
}
|
||||||
|
|
||||||
|
Hash weapon_hash = 0;
|
||||||
|
if (name.starts_with("COMPONENT_KNIFE"))
|
||||||
|
weapon_hash = "WEAPON_KNIFE"_J;
|
||||||
|
else if (name.starts_with("COMPONENT_KNUCKLE"))
|
||||||
|
weapon_hash = "WEAPON_KNUCKLE"_J;
|
||||||
|
else if (name.starts_with("COMPONENT_BAT"))
|
||||||
|
weapon_hash = "WEAPON_BAT"_J;
|
||||||
|
const auto display_string = scr_functions::get_component_name_string.call<const char*>(hash, weapon_hash);
|
||||||
|
if (display_string == nullptr)
|
||||||
|
continue;
|
||||||
|
LocName = display_string;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (LocName.ends_with("INVALID"))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (LocDesc.ends_with("INVALID"))
|
||||||
|
{
|
||||||
|
const auto display_string = scr_functions::get_component_desc_string.call<const char*>(hash, 0);
|
||||||
|
if (display_string != nullptr)
|
||||||
|
LocDesc = display_string;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (LocDesc.ends_with("INVALID"))
|
||||||
|
LocDesc.clear();
|
||||||
|
|
||||||
weapon_component component;
|
weapon_component component;
|
||||||
|
|
||||||
@ -345,9 +412,9 @@ namespace big
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else if (const auto file_str = path.string(); file_str.find("weapon") != std::string::npos && path.extension() == ".meta")
|
else if (const auto file_str = path.string(); file_str.contains("weapon") && !file_str.contains("vehicle") && path.extension() == ".meta")
|
||||||
{
|
{
|
||||||
rpf_wrapper.read_xml_file(path, [&exists, &weapons, &mapped_weapons](pugi::xml_document& doc) {
|
rpf_wrapper.read_xml_file(path, [&exists, &weapons, &mapped_weapons, file_str, &rpf_wrapper](pugi::xml_document& doc) {
|
||||||
const auto& items = doc.select_nodes("/CWeaponInfoBlob/Infos/Item/Infos/Item[@type='CWeaponInfo']");
|
const auto& items = doc.select_nodes("/CWeaponInfoBlob/Infos/Item/Infos/Item[@type='CWeaponInfo']");
|
||||||
for (const auto& item_node : items)
|
for (const auto& item_node : items)
|
||||||
{
|
{
|
||||||
@ -358,19 +425,18 @@ namespace big
|
|||||||
if (hash == "WEAPON_BIRD_CRAP"_J)
|
if (hash == "WEAPON_BIRD_CRAP"_J)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (exists(mapped_weapons, hash))
|
if (!exists(mapped_weapons, hash))
|
||||||
continue;
|
|
||||||
mapped_weapons.emplace_back(hash);
|
mapped_weapons.emplace_back(hash);
|
||||||
|
|
||||||
const auto human_name_hash = item.child("HumanNameHash").text().as_string();
|
const auto human_name_hash = item.child("HumanNameHash").text().as_string();
|
||||||
if (std::strcmp(human_name_hash, "WT_INVALID") == 0 || std::strcmp(human_name_hash, "WT_VEHMINE") == 0)
|
if (std::strcmp(human_name_hash, "WT_INVALID") == 0 || std::strcmp(human_name_hash, "WT_VEHMINE") == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
auto weapon = weapon_item{};
|
auto weapon = weapon_item_parsed{};
|
||||||
|
|
||||||
weapon.m_name = name;
|
weapon.m_name = name;
|
||||||
|
|
||||||
weapon.m_display_name = human_name_hash;
|
weapon.m_display_name = human_name_hash;
|
||||||
|
weapon.rpf_file_type = determine_file_type(file_str, rpf_wrapper.get_name());
|
||||||
|
|
||||||
auto weapon_flags = std::string(item.child("WeaponFlags").text().as_string());
|
auto weapon_flags = std::string(item.child("WeaponFlags").text().as_string());
|
||||||
|
|
||||||
@ -435,7 +501,15 @@ namespace big
|
|||||||
|
|
||||||
weapon.m_hash = hash;
|
weapon.m_hash = hash;
|
||||||
|
|
||||||
weapons.emplace_back(std::move(weapon));
|
if (weapons.contains(hash))
|
||||||
|
{
|
||||||
|
if (weapons[hash].rpf_file_type > weapon.rpf_file_type)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
weapons[hash] = weapon;
|
||||||
skip:
|
skip:
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -475,6 +549,11 @@ namespace big
|
|||||||
yim_fipackfile::for_each_fipackfile();
|
yim_fipackfile::for_each_fipackfile();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mp_weapons_thread_id != 0)
|
||||||
|
{
|
||||||
|
SCRIPT::TERMINATE_THREAD(mp_weapons_thread_id);
|
||||||
|
}
|
||||||
|
|
||||||
static bool translate_label = false;
|
static bool translate_label = false;
|
||||||
|
|
||||||
g_fiber_pool->queue_job([&] {
|
g_fiber_pool->queue_job([&] {
|
||||||
@ -488,12 +567,17 @@ namespace big
|
|||||||
}
|
}
|
||||||
for (auto& item : weapons)
|
for (auto& item : weapons)
|
||||||
{
|
{
|
||||||
item.m_display_name = HUD::GET_FILENAME_FOR_AUDIO_CONVERSATION(item.m_display_name.c_str());
|
item.second.m_display_name = HUD::GET_FILENAME_FOR_AUDIO_CONVERSATION(item.second.m_display_name.c_str());
|
||||||
}
|
}
|
||||||
for (auto& item : weapon_components)
|
for (auto& item : weapon_components)
|
||||||
{
|
{
|
||||||
item.m_display_name = HUD::GET_FILENAME_FOR_AUDIO_CONVERSATION(item.m_display_name.c_str());
|
item.m_display_name = HUD::GET_FILENAME_FOR_AUDIO_CONVERSATION(item.m_display_name.c_str());
|
||||||
|
if (!item.m_display_desc.empty())
|
||||||
|
{
|
||||||
item.m_display_desc = HUD::GET_FILENAME_FOR_AUDIO_CONVERSATION(item.m_display_desc.c_str());
|
item.m_display_desc = HUD::GET_FILENAME_FOR_AUDIO_CONVERSATION(item.m_display_desc.c_str());
|
||||||
|
if (item.m_display_desc == "NULL")
|
||||||
|
item.m_display_desc.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for (auto it = peds.begin(); it != peds.end();)
|
for (auto it = peds.begin(); it != peds.end();)
|
||||||
{
|
{
|
||||||
@ -555,8 +639,8 @@ namespace big
|
|||||||
m_weapons_cache.weapon_map.clear();
|
m_weapons_cache.weapon_map.clear();
|
||||||
for (auto weapon : weapons)
|
for (auto weapon : weapons)
|
||||||
{
|
{
|
||||||
add_if_not_exists(m_weapon_types, weapon.m_weapon_type);
|
add_if_not_exists(m_weapon_types, weapon.second.m_weapon_type);
|
||||||
m_weapons_cache.weapon_map.insert({weapon.m_name, weapon});
|
m_weapons_cache.weapon_map.insert({weapon.second.m_name, weapon.second});
|
||||||
}
|
}
|
||||||
|
|
||||||
m_weapons_cache.weapon_components.clear();
|
m_weapons_cache.weapon_components.clear();
|
||||||
|
@ -2,7 +2,16 @@
|
|||||||
|
|
||||||
namespace big
|
namespace big
|
||||||
{
|
{
|
||||||
class weapon_item final
|
enum RPFDatafileSource : std::uint8_t
|
||||||
|
{
|
||||||
|
UNKNOWN,
|
||||||
|
BASE,
|
||||||
|
UPDATE,
|
||||||
|
DLC,
|
||||||
|
DLCUPDATE
|
||||||
|
};
|
||||||
|
|
||||||
|
class weapon_item
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
std::string m_name;
|
std::string m_name;
|
||||||
@ -16,4 +25,10 @@ namespace big
|
|||||||
|
|
||||||
NLOHMANN_DEFINE_TYPE_INTRUSIVE(weapon_item, m_name, m_display_name, m_weapon_type, m_hash, m_reward_hash, m_reward_ammo_hash, m_attachments, m_throwable)
|
NLOHMANN_DEFINE_TYPE_INTRUSIVE(weapon_item, m_name, m_display_name, m_weapon_type, m_hash, m_reward_hash, m_reward_ammo_hash, m_attachments, m_throwable)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class weapon_item_parsed : public weapon_item
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
RPFDatafileSource rpf_file_type = RPFDatafileSource::UNKNOWN;
|
||||||
|
};
|
||||||
}
|
}
|
@ -79,4 +79,17 @@ namespace big::blip
|
|||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rage::CBlip* get_blip_from_blip_id(Blip blip_id)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 1500; i++)
|
||||||
|
{
|
||||||
|
auto blip = g_pointers->m_gta.m_blip_list->m_Blips[i].m_pBlip;
|
||||||
|
if (blip && (blip->m_blip_array_index == blip_id))
|
||||||
|
{
|
||||||
|
return blip;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
@ -16,4 +16,6 @@ namespace big::blip
|
|||||||
bool get_objective_location(Vector3& location);
|
bool get_objective_location(Vector3& location);
|
||||||
|
|
||||||
rage::CBlip* get_selected_blip();
|
rage::CBlip* get_selected_blip();
|
||||||
|
|
||||||
|
rage::CBlip* get_blip_from_blip_id(Blip);
|
||||||
}
|
}
|
195
src/util/ped.cpp
Normal file
195
src/util/ped.cpp
Normal file
@ -0,0 +1,195 @@
|
|||||||
|
#include "ped.hpp"
|
||||||
|
|
||||||
|
namespace big::ped
|
||||||
|
{
|
||||||
|
bool change_player_model(const Hash hash)
|
||||||
|
{
|
||||||
|
if (entity::request_model(hash))
|
||||||
|
{
|
||||||
|
self::ped = PLAYER::PLAYER_PED_ID();
|
||||||
|
PLAYER::SET_PLAYER_MODEL(self::id, hash);
|
||||||
|
script::get_current()->yield();
|
||||||
|
STREAMING::SET_MODEL_AS_NO_LONGER_NEEDED(hash);
|
||||||
|
for (int i = 0; i < 12; i++)
|
||||||
|
{
|
||||||
|
PED::SET_PED_COMPONENT_VARIATION(self::ped, i, PED::GET_PED_DRAWABLE_VARIATION(self::ped, i), PED::GET_PED_TEXTURE_VARIATION(self::ped, i), PED::GET_PED_PALETTE_VARIATION(self::ped, i));
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool steal_outfit(const Ped target)
|
||||||
|
{
|
||||||
|
Ped ped = self::ped;
|
||||||
|
|
||||||
|
if (ENTITY::GET_ENTITY_MODEL(ped) != ENTITY::GET_ENTITY_MODEL(target))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for (int i = 0; i < 12; i++)
|
||||||
|
{
|
||||||
|
PED::SET_PED_COMPONENT_VARIATION(ped, i, PED::GET_PED_DRAWABLE_VARIATION(target, i), PED::GET_PED_TEXTURE_VARIATION(target, i), PED::GET_PED_PALETTE_VARIATION(target, i));
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void clone_ped(const Ped src, const Ped target)
|
||||||
|
{
|
||||||
|
PED::CLONE_PED_TO_TARGET(src, target);
|
||||||
|
auto src_ptr = g_pointers->m_gta.m_handle_to_ptr(src);
|
||||||
|
auto dst_ptr = g_pointers->m_gta.m_handle_to_ptr(target);
|
||||||
|
|
||||||
|
if (src_ptr && dst_ptr)
|
||||||
|
{
|
||||||
|
for (auto container = src_ptr->m_extension_container; container; container = container->m_next)
|
||||||
|
{
|
||||||
|
if (container->m_entry && container->m_entry->get_id() == 0xB)
|
||||||
|
{
|
||||||
|
g_pointers->m_gta.m_set_head_blend_data(reinterpret_cast<CPed*>(dst_ptr),
|
||||||
|
reinterpret_cast<CHeadBlendData*>(container->m_entry));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void steal_identity(const Ped target)
|
||||||
|
{
|
||||||
|
const int max_health = ENTITY::GET_ENTITY_MAX_HEALTH(self::ped);
|
||||||
|
const int current_health = ENTITY::GET_ENTITY_HEALTH(self::ped);
|
||||||
|
const int current_armor = PED::GET_PED_ARMOUR(self::ped);
|
||||||
|
|
||||||
|
if (ENTITY::GET_ENTITY_MODEL(target) != ENTITY::GET_ENTITY_MODEL(self::id))
|
||||||
|
{
|
||||||
|
PLAYER::SET_PLAYER_MODEL(self::id, ENTITY::GET_ENTITY_MODEL(target));
|
||||||
|
script::get_current()->yield();
|
||||||
|
}
|
||||||
|
clone_ped(target, self::ped);
|
||||||
|
ENTITY::SET_ENTITY_MAX_HEALTH(self::ped, max_health);
|
||||||
|
ENTITY::SET_ENTITY_HEALTH(self::ped, current_health, 0, 0);
|
||||||
|
PED::SET_PED_ARMOUR(self::ped, current_armor);
|
||||||
|
}
|
||||||
|
|
||||||
|
void kill_ped(const Ped ped)
|
||||||
|
{
|
||||||
|
if (entity::take_control_of(ped, 0))
|
||||||
|
ENTITY::SET_ENTITY_HEALTH(ped, 0, self::ped, 0);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
auto ptr = g_pointers->m_gta.m_handle_to_ptr(ped);
|
||||||
|
if (!ptr)
|
||||||
|
return;
|
||||||
|
|
||||||
|
g_pointers->m_gta.m_send_network_damage(g_player_service->get_self()->get_ped(), ptr, ptr->get_position(), 0, true, "weapon_explosion"_J, 10000.0f, 2, 0, (1 << 4), 0, 0, 0, false, false, true, true, nullptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Ped spawn(ePedType pedType, Hash hash, Ped clone, Vector3 location, float heading, bool is_networked)
|
||||||
|
{
|
||||||
|
if (entity::request_model(hash))
|
||||||
|
{
|
||||||
|
Ped ped = PED::CREATE_PED(pedType, hash, location.x, location.y, location.z, heading, is_networked, false);
|
||||||
|
|
||||||
|
script::get_current()->yield();
|
||||||
|
|
||||||
|
if (clone)
|
||||||
|
{
|
||||||
|
clone_ped(clone, ped);
|
||||||
|
}
|
||||||
|
|
||||||
|
STREAMING::SET_MODEL_AS_NO_LONGER_NEEDED(hash);
|
||||||
|
|
||||||
|
return ped;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_ped_random_component_variation(Ped ped)
|
||||||
|
{
|
||||||
|
constexpr auto range = [](int lower_bound, int upper_bound) -> int {
|
||||||
|
return std::rand() % (upper_bound - lower_bound + 1) + lower_bound;
|
||||||
|
};
|
||||||
|
|
||||||
|
outfit::components_t components;
|
||||||
|
|
||||||
|
for (auto& item : components.items)
|
||||||
|
{
|
||||||
|
int drawable_id_max = PED::GET_NUMBER_OF_PED_DRAWABLE_VARIATIONS(ped, item.id) - 1;
|
||||||
|
if (drawable_id_max == -1)
|
||||||
|
continue;
|
||||||
|
int drawable_id = range(0, drawable_id_max);
|
||||||
|
int texture_id_max = PED::GET_NUMBER_OF_PED_TEXTURE_VARIATIONS(ped, item.id, drawable_id) - 1;
|
||||||
|
if (texture_id_max == -1)
|
||||||
|
continue;
|
||||||
|
int texture_id = range(0, texture_id_max);
|
||||||
|
PED::SET_PED_COMPONENT_VARIATION(ped, item.id, drawable_id, texture_id, PED::GET_PED_PALETTE_VARIATION(ped, item.id));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
player_ptr get_player_from_ped(Ped ped)
|
||||||
|
{
|
||||||
|
for (auto& p : g_player_service->players())
|
||||||
|
{
|
||||||
|
if (p.second->get_ped())
|
||||||
|
{
|
||||||
|
if (p.second->get_ped() == g_pointers->m_gta.m_handle_to_ptr(ped))
|
||||||
|
return p.second;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool load_animation_dict(const char* dict)
|
||||||
|
{
|
||||||
|
if (STREAMING::HAS_ANIM_DICT_LOADED(dict))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
for (uint8_t i = 0; !STREAMING::HAS_ANIM_DICT_LOADED(dict) && i < 35; i++)
|
||||||
|
{
|
||||||
|
STREAMING::REQUEST_ANIM_DICT(dict);
|
||||||
|
script::get_current()->yield();
|
||||||
|
}
|
||||||
|
|
||||||
|
return STREAMING::HAS_ANIM_DICT_LOADED(dict);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ped_play_animation(Ped ped, const std::string_view& animDict, const std::string_view& animName, float speed, float speedMultiplier, int duration, int flag, float playbackRate, bool lockPos, Vector3 pos, Vector3 rot, int ik_flags)
|
||||||
|
{
|
||||||
|
if (load_animation_dict(animDict.data()))
|
||||||
|
if (pos.x == 0 && pos.y == 0 && pos.z == 0)
|
||||||
|
TASK::TASK_PLAY_ANIM(ped, animDict.data(), animName.data(), speed, speedMultiplier, duration, flag, playbackRate, lockPos, lockPos, lockPos);
|
||||||
|
else
|
||||||
|
TASK::TASK_PLAY_ANIM_ADVANCED(ped, animDict.data(), animName.data(), pos.x, pos.y, pos.z, rot.x, rot.y, rot.z, speed, speedMultiplier, duration, flag, playbackRate, lockPos, ik_flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Will make the ped enter the vehicle with animation if vehicle is in vicinity
|
||||||
|
* Param movespeed: 1 = walk, 2 = run, 3 = sprint
|
||||||
|
*/
|
||||||
|
void ped_enter_vehicle_animated(Ped ped, Vehicle veh, eVehicleSeats seat, int movespeed)
|
||||||
|
{
|
||||||
|
if (entity::take_control_of(ped))
|
||||||
|
{
|
||||||
|
if (ENTITY::DOES_ENTITY_EXIST(veh))
|
||||||
|
{
|
||||||
|
if (math::distance_between_vectors(ENTITY::GET_ENTITY_COORDS(ped, 0), ENTITY::GET_ENTITY_COORDS(veh, 0)) < 15.f)
|
||||||
|
TASK::TASK_ENTER_VEHICLE(ped, veh, 10000, (int)seat, movespeed, 8, NULL, 0);
|
||||||
|
else
|
||||||
|
PED::SET_PED_INTO_VEHICLE(ped, veh, (int)seat);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool is_ped_a_friend(Ped ped, CPed* ped_ptr)
|
||||||
|
{
|
||||||
|
if (PED::GET_PED_CONFIG_FLAG(ped, 38, TRUE) == TRUE)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (PED::IS_PED_IN_COMBAT(ped, self::ped))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return !g_pointers->m_gta.m_is_ped_enemies_with(ped_ptr->m_ped_intelligence, g_local_player, true, false, false);
|
||||||
|
}
|
||||||
|
}
|
191
src/util/ped.hpp
191
src/util/ped.hpp
@ -445,183 +445,16 @@ namespace big::ped
|
|||||||
{528, "CTaskAnimatedFallback"},
|
{528, "CTaskAnimatedFallback"},
|
||||||
};
|
};
|
||||||
|
|
||||||
inline bool change_player_model(const Hash hash)
|
bool change_player_model(const Hash hash);
|
||||||
{
|
bool steal_outfit(const Ped target);
|
||||||
if (entity::request_model(hash))
|
void clone_ped(const Ped src, const Ped target);
|
||||||
{
|
void steal_identity(const Ped target);
|
||||||
self::ped = PLAYER::PLAYER_PED_ID();
|
void kill_ped(const Ped ped);
|
||||||
PLAYER::SET_PLAYER_MODEL(self::id, hash);
|
Ped spawn(ePedType pedType, Hash hash, Ped clone, Vector3 location, float heading, bool is_networked = true);
|
||||||
script::get_current()->yield();
|
void set_ped_random_component_variation(Ped ped);
|
||||||
STREAMING::SET_MODEL_AS_NO_LONGER_NEEDED(hash);
|
player_ptr get_player_from_ped(Ped ped);
|
||||||
for (int i = 0; i < 12; i++)
|
bool load_animation_dict(const char* dict);
|
||||||
{
|
void ped_play_animation(Ped ped, const std::string_view& animDict, const std::string_view& animName, float speed = 4.f, float speedMultiplier = -4.f, int duration = -1, int flag = 0, float playbackRate = 0, bool lockPos = false, Vector3 pos = {}, Vector3 rot = {}, int ik_flags = 0);
|
||||||
PED::SET_PED_COMPONENT_VARIATION(self::ped, i, PED::GET_PED_DRAWABLE_VARIATION(self::ped, i), PED::GET_PED_TEXTURE_VARIATION(self::ped, i), PED::GET_PED_PALETTE_VARIATION(self::ped, i));
|
void ped_enter_vehicle_animated(Ped ped, Vehicle veh, eVehicleSeats seat, int movespeed);
|
||||||
}
|
bool is_ped_a_friend(Ped ped, CPed* ped_ptr);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool steal_outfit(const Ped target)
|
|
||||||
{
|
|
||||||
Ped ped = self::ped;
|
|
||||||
|
|
||||||
if (ENTITY::GET_ENTITY_MODEL(ped) != ENTITY::GET_ENTITY_MODEL(target))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
for (int i = 0; i < 12; i++)
|
|
||||||
{
|
|
||||||
PED::SET_PED_COMPONENT_VARIATION(ped, i, PED::GET_PED_DRAWABLE_VARIATION(target, i), PED::GET_PED_TEXTURE_VARIATION(target, i), PED::GET_PED_PALETTE_VARIATION(target, i));
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void clone_ped(const Ped src, const Ped target)
|
|
||||||
{
|
|
||||||
PED::CLONE_PED_TO_TARGET(src, target);
|
|
||||||
auto src_ptr = g_pointers->m_gta.m_handle_to_ptr(src);
|
|
||||||
auto dst_ptr = g_pointers->m_gta.m_handle_to_ptr(target);
|
|
||||||
|
|
||||||
if (src_ptr && dst_ptr)
|
|
||||||
{
|
|
||||||
for (auto container = src_ptr->m_extension_container; container; container = container->m_next)
|
|
||||||
{
|
|
||||||
if (container->m_entry && container->m_entry->get_id() == 0xB)
|
|
||||||
{
|
|
||||||
g_pointers->m_gta.m_set_head_blend_data(reinterpret_cast<CPed*>(dst_ptr), reinterpret_cast<CHeadBlendData*>(container->m_entry));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void steal_identity(const Ped target)
|
|
||||||
{
|
|
||||||
const int max_health = ENTITY::GET_ENTITY_MAX_HEALTH(self::ped);
|
|
||||||
const int current_health = ENTITY::GET_ENTITY_HEALTH(self::ped);
|
|
||||||
const int current_armor = PED::GET_PED_ARMOUR(self::ped);
|
|
||||||
|
|
||||||
if (ENTITY::GET_ENTITY_MODEL(target) != ENTITY::GET_ENTITY_MODEL(self::id))
|
|
||||||
{
|
|
||||||
PLAYER::SET_PLAYER_MODEL(self::id, ENTITY::GET_ENTITY_MODEL(target));
|
|
||||||
script::get_current()->yield();
|
|
||||||
}
|
|
||||||
clone_ped(target, self::ped);
|
|
||||||
ENTITY::SET_ENTITY_MAX_HEALTH(self::ped, max_health);
|
|
||||||
ENTITY::SET_ENTITY_HEALTH(self::ped, current_health, 0, 0);
|
|
||||||
PED::SET_PED_ARMOUR(self::ped, current_armor);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void kill_ped(const Ped ped)
|
|
||||||
{
|
|
||||||
if (entity::take_control_of(ped, 0))
|
|
||||||
ENTITY::SET_ENTITY_HEALTH(ped, 0, self::ped, 0);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
auto ptr = g_pointers->m_gta.m_handle_to_ptr(ped);
|
|
||||||
if (!ptr)
|
|
||||||
return;
|
|
||||||
|
|
||||||
g_pointers->m_gta.m_send_network_damage(g_player_service->get_self()->get_ped(), ptr, ptr->get_position(), 0, true, "weapon_explosion"_J, 10000.0f, 2, 0, (1 << 4), 0, 0, 0, false, false, true, true, nullptr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
inline Ped spawn(ePedType pedType, Hash hash, Ped clone, Vector3 location, float heading, bool is_networked = true)
|
|
||||||
{
|
|
||||||
if (entity::request_model(hash))
|
|
||||||
{
|
|
||||||
Ped ped = PED::CREATE_PED(pedType, hash, location.x, location.y, location.z, heading, is_networked, false);
|
|
||||||
|
|
||||||
script::get_current()->yield();
|
|
||||||
|
|
||||||
if (clone)
|
|
||||||
{
|
|
||||||
clone_ped(clone, ped);
|
|
||||||
}
|
|
||||||
|
|
||||||
STREAMING::SET_MODEL_AS_NO_LONGER_NEEDED(hash);
|
|
||||||
|
|
||||||
return ped;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void set_ped_random_component_variation(Ped ped)
|
|
||||||
{
|
|
||||||
constexpr auto range = [](int lower_bound, int upper_bound) -> int {
|
|
||||||
return std::rand() % (upper_bound - lower_bound + 1) + lower_bound;
|
|
||||||
};
|
|
||||||
|
|
||||||
outfit::components_t components;
|
|
||||||
|
|
||||||
for (auto& item : components.items)
|
|
||||||
{
|
|
||||||
int drawable_id_max = PED::GET_NUMBER_OF_PED_DRAWABLE_VARIATIONS(ped, item.id) - 1;
|
|
||||||
if (drawable_id_max == -1)
|
|
||||||
continue;
|
|
||||||
int drawable_id = range(0, drawable_id_max);
|
|
||||||
int texture_id_max = PED::GET_NUMBER_OF_PED_TEXTURE_VARIATIONS(ped, item.id, drawable_id) - 1;
|
|
||||||
if (texture_id_max == -1)
|
|
||||||
continue;
|
|
||||||
int texture_id = range(0, texture_id_max);
|
|
||||||
PED::SET_PED_COMPONENT_VARIATION(ped, item.id, drawable_id, texture_id, PED::GET_PED_PALETTE_VARIATION(ped, item.id));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
inline player_ptr get_player_from_ped(Ped ped)
|
|
||||||
{
|
|
||||||
for (auto& p : g_player_service->players())
|
|
||||||
{
|
|
||||||
if (p.second->get_ped())
|
|
||||||
{
|
|
||||||
if (p.second->get_ped() == g_pointers->m_gta.m_handle_to_ptr(ped))
|
|
||||||
return p.second;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool load_animation_dict(const char* dict)
|
|
||||||
{
|
|
||||||
if (STREAMING::HAS_ANIM_DICT_LOADED(dict))
|
|
||||||
return true;
|
|
||||||
|
|
||||||
for (uint8_t i = 0; !STREAMING::HAS_ANIM_DICT_LOADED(dict) && i < 35; i++)
|
|
||||||
{
|
|
||||||
STREAMING::REQUEST_ANIM_DICT(dict);
|
|
||||||
script::get_current()->yield();
|
|
||||||
}
|
|
||||||
|
|
||||||
return STREAMING::HAS_ANIM_DICT_LOADED(dict);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void ped_play_animation(Ped ped, const std::string_view& animDict, const std::string_view& animName, float speed = 4.f, float speedMultiplier = -4.f, int duration = -1, int flag = 0, float playbackRate = 0, bool lockPos = false, Vector3 pos = {}, Vector3 rot = {}, int ik_flags = 0)
|
|
||||||
{
|
|
||||||
if (load_animation_dict(animDict.data()))
|
|
||||||
if(pos.x == 0 && pos.y == 0 && pos.z == 0)
|
|
||||||
TASK::TASK_PLAY_ANIM(ped, animDict.data(), animName.data(), speed, speedMultiplier, duration, flag, playbackRate, lockPos, lockPos, lockPos);
|
|
||||||
else
|
|
||||||
TASK::TASK_PLAY_ANIM_ADVANCED(ped, animDict.data(), animName.data(), pos.x, pos.y, pos.z, rot.x, rot.y, rot.z, speed, speedMultiplier, duration, flag, playbackRate, lockPos, ik_flags);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Will make the ped enter the vehicle with animation if vehicle is in vicinity
|
|
||||||
* Param movespeed: 1 = walk, 2 = run, 3 = sprint
|
|
||||||
*/
|
|
||||||
inline void ped_enter_vehicle_animated(Ped ped, Vehicle veh, eVehicleSeats seat, int movespeed)
|
|
||||||
{
|
|
||||||
if (entity::take_control_of(ped))
|
|
||||||
{
|
|
||||||
if (ENTITY::DOES_ENTITY_EXIST(veh))
|
|
||||||
{
|
|
||||||
if (math::distance_between_vectors(ENTITY::GET_ENTITY_COORDS(ped, 0), ENTITY::GET_ENTITY_COORDS(veh, 0)) < 15.f)
|
|
||||||
TASK::TASK_ENTER_VEHICLE(ped, veh, 10000, (int)seat, movespeed, 8, NULL, 0);
|
|
||||||
else
|
|
||||||
PED::SET_PED_INTO_VEHICLE(ped, veh, (int)seat);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -194,6 +194,8 @@ namespace big
|
|||||||
ImGui::Checkbox("TRUST_FRIENDS"_T.data(), &g.weapons.aimbot.exclude_friends);
|
ImGui::Checkbox("TRUST_FRIENDS"_T.data(), &g.weapons.aimbot.exclude_friends);
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
components::command_checkbox<"aimonlyatenemy">();
|
components::command_checkbox<"aimonlyatenemy">();
|
||||||
|
ImGui::SameLine();
|
||||||
|
components::command_checkbox<"aimonlyatthreats">();
|
||||||
|
|
||||||
ImGui::CheckboxFlags("PLAYERS"_T.data(), &g.weapons.aimbot.only_on_ped_type, (int64_t)ePedTypeFlag::PED_TYPE_NETWORK_PLAYER);
|
ImGui::CheckboxFlags("PLAYERS"_T.data(), &g.weapons.aimbot.only_on_ped_type, (int64_t)ePedTypeFlag::PED_TYPE_NETWORK_PLAYER);
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
@ -288,20 +290,22 @@ namespace big
|
|||||||
Hash attachment_hash = attachment_component.m_hash;
|
Hash attachment_hash = attachment_component.m_hash;
|
||||||
if (attachment_hash == NULL)
|
if (attachment_hash == NULL)
|
||||||
{
|
{
|
||||||
attachment_name = attachment;
|
continue;
|
||||||
attachment_hash = rage::joaat(attachment);
|
|
||||||
}
|
}
|
||||||
|
ImGui::PushID(attachment_hash);
|
||||||
bool is_selected = attachment_hash == selected_weapon_attachment_hash;
|
bool is_selected = attachment_hash == selected_weapon_attachment_hash;
|
||||||
std::string display_name = attachment_name.append("##").append(std::to_string(attachment_hash));
|
if (ImGui::Selectable(attachment_name.c_str(), is_selected, ImGuiSelectableFlags_None))
|
||||||
if (ImGui::Selectable(display_name.c_str(), is_selected, ImGuiSelectableFlags_None))
|
|
||||||
{
|
{
|
||||||
selected_weapon_attachment = attachment_name;
|
selected_weapon_attachment = attachment_name;
|
||||||
selected_weapon_attachment_hash = attachment_hash;
|
selected_weapon_attachment_hash = attachment_hash;
|
||||||
}
|
}
|
||||||
|
if (ImGui::IsItemHovered() && !attachment_component.m_display_desc.empty())
|
||||||
|
ImGui::SetTooltip(attachment_component.m_display_desc.c_str());
|
||||||
if (is_selected)
|
if (is_selected)
|
||||||
{
|
{
|
||||||
ImGui::SetItemDefaultFocus();
|
ImGui::SetItemDefaultFocus();
|
||||||
}
|
}
|
||||||
|
ImGui::PopID();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user