mirror of
https://github.com/Mr-X-GTA/YimMenu.git
synced 2025-06-23 01:02:23 +08:00
Refactor Debug Threads & Expose More Functions (#3408)
- Added a search box for the script names in Debug -> Threads. - Added `is_session_started` and `force_script_on_player` functions to the Lua network class. - Added `is_active` and `start_launcher_script` functions to the Lua script class. - Moved `view_stat_editor.cpp` to `src/views/network` from `src/views/settings`. - Added a help text for directly editing the sliders in outfit editor.
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
|
||||
Table containing helper functions for network related features.
|
||||
|
||||
## Functions (15)
|
||||
## Functions (17)
|
||||
|
||||
### `trigger_script_event(bitset, _args)`
|
||||
|
||||
@ -17,6 +17,15 @@ Call trigger_script_event (TSE)
|
||||
network.trigger_script_event(bitset, _args)
|
||||
```
|
||||
|
||||
### `is_session_started()`
|
||||
|
||||
Returns true if the local player is in a multiplayer session.
|
||||
|
||||
**Example Usage:**
|
||||
```lua
|
||||
network.is_session_started()
|
||||
```
|
||||
|
||||
### `give_pickup_rewards(player, reward)`
|
||||
|
||||
Give the given pickup reward to the given player.
|
||||
@ -134,7 +143,7 @@ string = network.get_flagged_modder_reason(player_idx)
|
||||
|
||||
### `force_script_host(script_name)`
|
||||
|
||||
Try to force ourself to be host for the given GTA Script.
|
||||
Try to force ourself to be host for the given GTA Script. Needs to be called in the fiber pool or a loop.
|
||||
|
||||
- **Parameters:**
|
||||
- `script_name` (string): Name of the script
|
||||
@ -144,6 +153,20 @@ Try to force ourself to be host for the given GTA Script.
|
||||
network.force_script_host(script_name)
|
||||
```
|
||||
|
||||
### `force_script_on_player(player_idx, script_name, instance_id)`
|
||||
|
||||
Forces the given GTA script to be started on a player. Needs to be called in the fiber pool or a loop.
|
||||
|
||||
- **Parameters:**
|
||||
- `player_idx` (integer): Index of the player.
|
||||
- `script_name` (string): Name of the script.
|
||||
- `instance_id` (integer): Instance ID of the script.
|
||||
|
||||
**Example Usage:**
|
||||
```lua
|
||||
network.force_script_on_player(script_name)
|
||||
```
|
||||
|
||||
### `send_chat_message(msg, team_only)`
|
||||
|
||||
Sends a message to the in game chat.
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
Table containing helper functions related to gta scripts.
|
||||
|
||||
## Functions (5)
|
||||
## Functions (7)
|
||||
|
||||
### `register_looped(name, func)`
|
||||
|
||||
@ -67,6 +67,18 @@ script.run_in_fiber(function (script)
|
||||
end)
|
||||
```
|
||||
|
||||
### `is_active(script_name)`
|
||||
|
||||
Returns true if the specified script is currently active/running.
|
||||
|
||||
- **Parameters:**
|
||||
- `script_name` (string): The name of the script.
|
||||
|
||||
**Example Usage:**
|
||||
```lua
|
||||
local is_freemode_active = script.is_active("freemode")
|
||||
```
|
||||
|
||||
### `execute_as_script(script_name, func)`
|
||||
|
||||
- **Parameters:**
|
||||
@ -108,4 +120,18 @@ Calls a function from the specified script.
|
||||
**Example Usage:**
|
||||
```lua
|
||||
script.call_function("Collect Collectible", "freemode", "2D 05 33 00 00", 0, {17, 0, 1, 1, 0})
|
||||
```
|
||||
|
||||
### `start_launcher_script(script_name)`
|
||||
|
||||
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:**
|
||||
```lua
|
||||
script.run_in_fiber(function()
|
||||
script.start_launcher_script("am_hunt_the_beast")
|
||||
end)
|
||||
```
|
Reference in New Issue
Block a user