TmpMenu/docs/lua/tables/network.md
Quentin 76afd97185 Lua: can make new tabs from lua scripts, doc generation for available tabs to use (#1593)
* lua api: add globals.get_uint and globals.set_uint

* lua doc: remove duplicate function check as we can overload so it doesn't make sense

* lua doc gen: add support for parsing the tabs enum

* gui: custom lua tabs don't have a `func` rendering function but can still have elements to draw

* lua doc: update generated doc

* chore: code style

* chore: minor spelling mistake

* chore: code style

* gui_service: add runtime removal of tabs

* refactor: make it so that it's less likely defining tabs and their translation key in a wrong way.

* lua api: ability to add custom tabs to the gui from lua
2023-07-05 00:30:57 +02:00

2.6 KiB

Table: network

Table containing helper functions for network related features.

Functions (10)

trigger_script_event(bitset, _args)

Call trigger_script_event (TSE)

  • Parameters:
    • bitset (integer)
    • _args (table)

Example Usage:

network.trigger_script_event(bitset, _args)

give_pickup_rewards(player, reward)

Give the given pickup reward to the given player.

  • Parameters:
    • player (integer): Index of the player.
    • reward (integer): Index of the reward pickup.

Example Usage:

network.give_pickup_rewards(player, reward)

set_player_coords(player_idx, x, y, z)

Teleport the given player to the given position.

  • Parameters:
    • player_idx (integer): Index of the player.
    • x (float): New x position.
    • y (float): New y position.
    • z (float): New z position.

Example Usage:

network.set_player_coords(player_idx, x, y, z)

set_all_player_coords(x, y, z)

Teleport all players to the given position.

  • Parameters:
    • x (float): New x position.
    • y (float): New y position.
    • z (float): New z position.

Example Usage:

network.set_all_player_coords(x, y, z)

get_selected_player()

  • Returns:
    • integer: Returns the index of the currently selected player in the GUI.

Example Usage:

integer = network.get_selected_player()

get_selected_database_player_rockstar_id()

  • Returns:
    • integer: Returns the rockstar id of the currently selected player in the GUI.

Example Usage:

integer = network.get_selected_database_player_rockstar_id()

flag_player_as_modder(player_idx)

Flags the given player as a modder in our local database.

  • Parameters:
    • player_idx (integer): Index of the player.

Example Usage:

network.flag_player_as_modder(player_idx)

is_player_flagged_as_modder(player_idx)

  • Parameters:

    • player_idx (integer): Index of the player.
  • Returns:

    • boolean: Returns true if the given player is flagged as a modder.

Example Usage:

boolean = network.is_player_flagged_as_modder(player_idx)

force_script_host(script_name)

Try to force ourself to be host for the given GTA Script.

  • Parameters:
    • script_name (string): Name of the script

Example Usage:

network.force_script_host(script_name)

send_chat_message(msg, team_only)

Sends a message to the in game chat.

  • Parameters:
    • msg (string): Message to be sent.
    • team_only (boolean): Should be true if the msg should only be sent to our team.

Example Usage:

network.send_chat_message(msg, team_only)