DIS2RBED LUA reference
There are multiple namespaces & types in the current DIS2RBED LUA framework, each with their own set of functions.
Note
New, WIP Rage API Documentation is available here: WIP New RAGE API
Types in the LUA Engine
Types in the LUA Engine are defined in the following order:
Hash (uint64)
Entity (int)
Ped (int)
Player (int)
Cam (int)
Blip (int)
Vehicle (int)
Vector2 (float
x
, floaty
)Vector3 (float
x
, floaty
, floatz
)ColorRGB (int
r
, intg
, intb
)ColorRGBA (int
r
, intg
, intb
, inta
)eSessionType (int)
ModelBoundingBox (Vector3, Vector3, Vector3, Vector3, Vector3, Vector3, Vector3, Vector3)
Hash
Hash is a hash of a string that is encrypted using the Jenkins hash function. It’s an in-game identifier that is unique to each object and helps identify a gun or a vehicle.
You can find a hash key using this function: rage.gameplay.get_hash_key(“string”), where string is a game object name.
You can find most of the game objects here:
Menu button, children and task hashes can be anything you want, but they have to be unique.
Entity
Entity is an integer ID of an in-game object (don’t mix up with the Hash
!). It’s an integer that is unique to each object, and, unlike the Hash
, it only lasts one session.
Entity can be used to identify a ped, a vehicle, an animal, a character. Entity is everything.
Ped
Ped is an integer ID which represents the NPC in the game session. It’s unique to each NPC, and it only lasts one session. Ped can be converted to Entity, hence it can be used with methods that take Entity as a parameter.
Easiest way to acquire a ped handle is to call player.get_ped()
function that returns a Ped object of your character. Or spawn it through rage.ped.create_ped()
.
Player
Player is an integer ID that represents Player in the game session. It ranges from 0 to 32. Player ID helps identify a player in the game session. Always 0 in single player mode.
Cam
Cam ID represents the game camera. It’s not used anywhere at the moment.
Blip
Blip is an Integer ID that represents the mark object on the game map. You can spawn and manage different types of blips.
You can find Blip types here:
Any
Any is a type that’s used in native methods, whose parameters weren’t completely figured out.
You can use false
to represent it.
Vehicle
Vehicle is an Integer Vehicle ID which represents the Vehicle in the game session. It’s unique to each vehicle, and it only lasts one session. Vehicle can be converted to Entity, hence it can be used with methods that take Entity as a parameter.
Easiest way to acquire a vehicle handle is to call player.get_vehicle()
function that returns a Vehicle object of your vehicle. Or spawn it through scripting.spawn.spawn_vehicle()
.
Vector2
Vector2 is a 2D vector, and is used to represent the coordinates on the screen. It contains two float variables: x
and y
Only used in Render namespace at the moment.
You can initialize a Vector3 object with following code:
v2 = Vector2.new(x, y)
Vector3
Vector3 is a 3D vector, and is used to represent the coordinates in the game world. It contains three float variables: x
, y
and z
You can initialize vector3 with the following code:
myV3 = Vector3.new(x, y, z)
ColorRGB
ColorRGB represents a color in RGB format. It contains three integer variables: r
, g
and b
.
You can initialize a ColorRGB object with the following code:
myColor = ColorRGB.new(r, g, b)
ColorRGBA
ColorRGBA represents a color in RGBA format. It contains four integer variables: r
, g
, b
and a
.
You can initialize a ColorRGBA object with the following code:
myColor = ColorRGBA.new(r, g, b, a)
eSessionType
eSessionType represents a session type that DIS2RBED uses to set up an online session.
Current available session types are:
PublicJoin
=0
PublicStart
=1
CrewClosed
=2
Crew
=3
FriendsClosed
=6
FriendsFind
=9
Solo
=10
Invite
=11
CrewJoin
=12
Pickup
Used for money drops. It’s not used anywhere at the moment.
ModelBoundingBox
ModelBoundingBox represents a vector consisting of 8 Vector3’s that contain the coordinates of box’s corners (bounding coordinates).

Global Variables
int
chatSenderId
– Last chat message sender IDstring
chatSenderName
– Last chat message sender namestring
chatMessage
– Last chat messageint
scriptEventId
– Last script event hashvector<int>
scriptEventArgs
– Last script event arguments listint
scriptEventSenderID
– Last script event sender IDstring
scriptEventSenderName
– Last script event sender name
Namespaces in LUA Engine
Function namespaces in LUA Engine are defined in the following order:
System namespace
This namespace contains functions that are used to interact with the DIS2RBED’s task management and logging.
log_chat(text
)
Sends a message to the log as [CHAT]
. Has a purple color.
Parameters:
text
(string
) – The text to send to the log.
Returns:
None
Example:
1system.log_chat("Hello World!")
log_debug(text
)
Sends a message to the log as [DEBUG]
. Has a grey color.
Parameters:
text
(string
) – The text to send to the log.
Returns:
None
Example:
1system.log_debug("Hello World!")
log_info(text
)
Sends a message to the log as [INFO]
. Has a blue color.
Parameters:
text
(string
) – The text to send to the log.
Returns:
None
Example:
1system.log_info("Hello World!")
log_online(text
)
Sends a message to the log as [ONLINE]
. Has a bright yellow color.
Parameters:
text
(string
) – The text to send to the log.
Returns:
None
Example:
1system.log_online("Hello World!")
log_protex(text
)
Sends a message to the log as [PROTEX]
. Has a light blue color.
Parameters:
text
(string
) – The text to send to the log.
Returns:
None
Example:
1system.log_protex("Hello World!")
log_warning(text
)
Sends a message to the log as [WARNING]
. Has a red color.
Parameters:
text
(string
) – The text to send to the log.
Returns:
None
Example:
1system.log_warning("Hello World!")
get_user_group()
Gets the group of the current user.
Parameters:
None
Returns:
int
– Returns the group of the user:1
– User is Basic2
– User is VIP3
– User is Tester
Example:
1userGroup = system.get_user_group()
2
3if userGroup == 1 then
4 system.log_info("User is Basic")
5elseif userGroup == 2 then
6 system.log_info("User is VIP")
7elseif userGroup == 3 then
8 system.log_info("User is Tester")
9end
wait(ms
)
Waits for ms
milliseconds.
Parameters:
ms
(int
) – The number of milliseconds to wait. If-1
is set, skips ticks.
Returns:
None
Example:
1system.wait(10000) -- Waits for 10 seconds
add_task(name
, hash
, ms
, fn
)
Adds a task into the process’s main loop.
Note
DO NOT USE system.wait()
inside task functions! You can use it only in the options functions!
Parameters:
name
(string
) – The name of the task.hash
(string
) – The hash of the task. Hash is used to identify the task, so it must be unique.ms
(int
) – The number of milliseconds to wait before calling the task.Can be
-1
to execute the task again and again.
fn
(function
) – The function to call when the task is executed.
Returns:
None
Example:
1function my_script_function()
2 system.log_info("Hello World!")
3end
4system.add_task("My script task", "luaTestTaskHash", 1000, my_script_function)
5--or
6function my_script_function()
7 -- Test key press
8 bIsKeyPressed = system.is_key_pressed("F")
9 if bIsKeyPressed then
10 system.log_info("Pressed F to pay respect!")
11 end
12end
13system.add_task("My script task", "luaTestTaskHash", -1, my_script_function)
remove_task(hash
)
Removes a task from the process’s main loop.
Parameters:
hash
(string
) – The hash of the task to remove.
Returns:
None
Example:
1function my_script_function()
2 system.log_info("Hello World!")
3end
4system.add_task("My script task", "luaTestTaskHash", 1000, my_script_function)
5system.remove_task("luaTestTaskHash")
add_chat_listener(name
, hash
, fn
)
Connects a chat listener that calls a task every time a message is sent in the chat.
Note
Chat listener only reacts to other player’s chat messages, not your own ones.
Note
DO NOT USE system.wait()
inside task functions! You can use it only in the options functions!
Parameters:
name
(string
) – The name of the task.hash
(string
) – The hash of the task. Hash is used to identify the task, so it must be unique.fn
(function
) – The function to call when the task is executed.
Returns:
None
Example:
1function my_script_function(text)
2 system.log_info("Hello World!")
3end
4system.add_chat_listener("My script task", "luaTestTaskHash", my_script_function)
remove_chat_listener(hash
)
Disconnects a chat listener for a certain task.
Parameters:
hash
(string
) – The hash of the task to remove.
Returns:
None
Example:
1function my_script_function(text)
2 system.log_info("Hello World!")
3end
4system.add_chat_listener("My script task", "luaTestTaskHash", my_script_function)
5system.remove_chat_listener("luaTestTaskHash")
add_script_event_listener(name
, hash
, fn
)
Connects a script event listener that calls a task every time a script event is sent.
Parameters:
name
(string
) – The name of the task.hash
(string
) – The hash of the task. Hash is used to identify the task, so it must be unique.fn
(function
) – The function to call when the task is executed.
Returns:
None
Example:
1function my_script_function()
2 system.log_info("Hello World!")
3end
4system.add_script_event_listener("My script task", "luaTestTaskHash", my_script_function)
remove_script_event_listener(hash
)
Disconnects a script event listener for a certain task.
Parameters:
hash
(string
) – The hash of the task to remove.
Returns:
None
Example:
1function my_script_function()
2 system.log_info("Hello World!")
3end
4system.add_script_event_listener("My script task", "luaTestTaskHash", my_script_function)
5system.remove_script_event_listener("luaTestTaskHash")
add_script_event(name
, eventId
, args
= {}
)
Add a script event into the protection blacklist.
Parameters:
name
(string
) – The name of the task.eventId
(int
) – The event ID to add.args
(vector<int>
) – The arguments to pass to the event. Default is an empty vector.
Returns:
None
Example:
remove_script_event(eventId
)
Remove a script event from the protection blacklist.
Parameters:
eventId
(int
) – The event ID to remove.
Returns:
None
Example:
string_to_key(key
)
Converts a string key to a key hash.
Parameters:
key
(string
) – The key to convert.
Returns:
int
– The key hash. -1 if the key is not any special key or it doesn’t exist at all
Example:
1key = system.string_to_key("HOME")
2
3system.log_info(tostring(key)) -- get "HOME" key hash
key_to_string(key
)
Converts a key hash to a string key.
Parameters:
key
(int
) – The key hash to convert.
Returns:
string
– The key as string.
Example:
1key = system.key_to_string(36)
2system.log_info(tostring(key)) -- get "HOME" key hash
3
4-- why 36, you ask? See this: https://www.oreilly.com/library/view/javascript-dhtml/9780596514082/apb.html
is_key_pressed(key
)
Checks whether the key is pressed
Parameters:
key
(string
) – The key to check.
Returns:
bool
True
– The key is pressedfalse
– The key is not pressed
Example:
1function my_script_function(text)
2 bIsKeyPressed = system.is_key_pressed("F")
3 if bIsKeyPressed then
4 system.log_info("Hello World!")
5 end
6end
reinitialize_d2ui()
Reinitializes DIS2RBED UI and Lua scripts.
Parameters:
None
Returns:
None
Web namespace
This namespace contains functions for sending web requests to external servers.
get(url
)
Sends a GET request to a web server.
Parameters:
url
(string
) – The URL to send the request to.
Returns:
string
– The response from the server.
Example:
1system.log_warning("Test HTTP request GET")
2sRequestResult = web.get("http://ip-api.com/php/24.48.0.1")
3system.log_warning(sRequestResult)
4
5--or
6
7system.log_warning("Test HTTPS request GET")
8sRequestResult = web.get("https://ipapi.co/8.8.8.8/json/")
9system.log_warning(sRequestResult)
post(url
, data
)
Sends a POST request to a web server.
Parameters:
url
(string
) – The URL to send the request to.data
(string
) – The data to send.
Returns:
string
– The response from the server.
Example:
1system.log_warning("Test HTTP request POST") -- https is supported too
2sJSONRequest = "[ {\"query\": \"208.80.152.201\", \"fields\": \"city,country,countryCode,query\", \"lang\": \"eu\"}, \"8.8.8.8\", \"24.48.0.1\" ]"
3sRequestResult = web.post("http://ip-api.com/batch", sJSONRequest)
4system.log_warning(sRequestResult)
Stats namespace
This namespace contains functions that are used to get and set certain stats in the game.
Warning
These functions are meant to be used by experienced users only, as they can be used to break the character and the account.
There are no examples for this namespace, as advanced users will know how to use it.
Sapienti sat
set_packed_bool(index
, value
)
Sets a packed boolean stat.
Parameters:
index
(int
) – The index of the packed bool stat.value
(bool
) – The value to set.
Returns:
None
get_packed_bool(index
)
Returns a packed boolean stat.
Parameters:
index
(int
) – The index of the packed bool stat.
Returns:
bool
– The value of the packed bool stat.
set_mass_packed_bool(value
, min
, max
)
Sets a mass-packed boolean stat.
Parameters:
value
(bool
) – The value to set.min
(int
) – The minimum value of the mass-packed bool stat.max
(int
) – The maximum value of the mass-packed bool stat.
Returns:
None
get_mass_packed_bool(min
, max
)
Note
This function is not implemented yet.
Returns a mass-packed boolean stat.
Parameters:
min
(int
) – The minimum value of the mass-packed bool stat.max
(int
) – The maximum value of the mass-packed bool stat.
Returns:
None
set_packed_int(index
, value
)
Sets a packed integer stat.
Parameters:
index
(int
) – The index of the packed integer stat.value
(int
) – The value to set.
Returns:
None
get_packed_int(index
)
Returns a packed integer stat.
Parameters:
index
(int
) – The index of the packed integer stat.
Returns:
int
– The value of the packed integer stat.
get_mass_packed_int(min
, max
)
Note
This function is not implemented yet.
Returns a mass-packed integer stat.
Parameters:
min
(int
) – The minimum value of the mass-packed integer stat.max
(int
) – The maximum value of the mass-packed integer stat.
Returns:
None
set_stat_bit(string stat, int bit)
Set a bit in a stat.
Parameters:
stat
(string
) – The stat name.bit
(int
) – The bit to set.
Returns:
None
clear_stat_bit(stat
, bit
)
Clear a bit in a stat.
Parameters:
stat
(string
) – The stat name.bit
(int
) – The bit to clear.
Returns:
None
stat_get_int(stat
)
Returns an integer stat.
Parameters:
stat
(string
) – The name of the stat.
Returns:
int
– The value of the stat.
stat_set_int(stat
, value
)
Parameters:
stat
(string
) – The name of the stat.value
(int
) – The value to set.
Returns:
None
stat_get_bool(stat
)
Returns a boolean stat.
Parameters:
stat
(string
) – The name of the stat.
Returns:
bool
– The value of the stat.
stat_set_bool(stat
, value
)
Sets a boolean stat.
Parameters:
stat
(string
) – The name of the stat.value
(bool
) – The value to set.
Returns:
None
stat_get_float(stat
)
Returns a float stat.
Parameters:
stat
(string
) – The name of the stat.
Returns:
float
– The value of the stat.
stat_set_float(stat
, value
)
Sets a float stat.
Parameters:
stat
(string
) – The name of the stat.value
(float
) – The value to set.
Returns:
None
Notify namespace
This namespace contains functions for sending notifications.
above_map(text
)
Sends a notification in the bottom-left corner of the screen.
Parameters:
text
(string
) – The text to display.
Returns:
None
Example:
1notify.above_map("Hello world!")
info(text
)
Sends a blue-colored notification in the bottom-right corner of the screen.
Parameters:
text
(string
) – The text to display.
Returns:
None
Example:
1notify.info("Hello world!")
success(text
)
Sends a green-colored notification in the bottom-right corner of the screen.
Parameters:
text
(string
) – The text to display.
Returns:
None
Example:
1notify.success("Hello world!")
warning(text
)
Sends a red-colored notification in the bottom-right corner of the screen.
Parameters:
text
(string
) – The text to display.
Returns:
None
Example:
1notify.warning("Hello world!")
lua(text
)
Sends a lime-colored notification in the bottom-right corner of the screen.
Parameters:
text
(string
) – The text to display.
Returns:
None
Example:
1notify.lua("Hello world!")
force_next_notify()
Disables antispam for the next notification.
Parameters:
None
Returns:
None
Script namespace
This namespace contains functions for executing in-game events.
Warning
These functions are meant to be used by experienced users only.
Sapienti sat
trigger_script_event(eventGroup
, args
, playerId
)
Triggers a script event.
Parameters:
eventGroup
(int
) – The event group ID.args
(int64_t
) – The arguments to pass to the event.playerId
(int
) – The player ID to send the event to.
Returns:
None
Example:
1script.trigger_script_event(0x0000000, { 1234567, 7654321, 1234321 }, chatSenderId)
is_script_running(scriptName
)
Checks whether a script is running.
Parameters:
scriptName
(string
) – The name of the script.
Returns:
bool
– True if the script is running, false otherwise.
execute_as_script(scriptName
, fn
)
Execute function as script
Parameters:
scriptName
(string
) – The name of the script.fn
(function
) – The function to execute.
Returns:
None
Globals namespace
This namespace contains functions for accessing global in-game values.
Warning
These functions are meant to be used by experienced users only.
Sapienti sat
set_global_int(global
, value
)
Sets a new global integer value.
Parameters:
global
(uint64_t
) – The name of the global value.value
(int
) – The value to set.
Returns:
None
set_global_float(global
, value
)
Sets a new global float value.
Parameters:
global
(uint64_t
) – The name of the global value.value
(float
) – The value to set.
Returns:
None
set_global_bool(global
, value
)
Sets a new global boolean value.
Parameters:
global
(uint64_t
) – The name of the global value.value
(bool
) – The value to set.
Returns:
None
set_global_string(global
, value
)
Sets a new global string value.
Parameters:
global
(uint64_t
) – The name of the global value.value
(string
) – The value to set.
Returns:
None
get_global_int(global
)
Returns a global integer value.
Parameters:
global
(uint64_t
) – The name of the global value.
Returns:
int
– The global value.
get_global_float(global
)
Returns a global float value.
Parameters:
global
(uint64_t
) – The name of the global value.
Returns:
float
– The global value.
get_global_bool(global
)
Returns a global boolean value.
Parameters:
global
(uint64_t
) – The name of the global value.
Returns:
bool
– The global value.
get_global_string(global
)
Returns a global string value.
Parameters:
global
(uint64_t
) – The name of the global value.
Returns:
string
– The global value.
get_global_addr(global
)
Returns the memory address of a global.
Parameters:
global
(uint64_t
) – The name of the global value.
Returns:
uint64_t
– The memory address of the global.
Locals namespace
This namespace contains functions for accessing local in-game values.
Warning
These functions are meant to be used by experienced users only.
Sapienti sat
set_local_int(scriptName
, local
, value
)
Sets a new local integer value.
Parameters:
scriptName
(string
) – The name of the script.local
(uint64_t
) – The name of the local value.value
(int
) – The value to set.
Returns:
None
set_local_float(scriptName
, local
, value
)
Sets a new local float value.
Parameters:
scriptName
(string
) – The name of the script.local
(uint64_t
) – The name of the local value.value
(float
) – The value to set.
Returns:
None
set_local_bool(scriptName
, local
, value
)
Sets a new local boolean value.
Parameters:
scriptName
(string
) – The name of the script.local
(uint64_t
) – The name of the local value.value
(bool
) – The value to set.
Returns:
None
set_local_string(scriptName
, local
, value
)
Sets a new local string value.
Parameters:
scriptName
(string
) – The name of the script.local
(uint64_t
) – The name of the local value.value
(string
) – The value to set.
Returns:
None
get_local_int(scriptName
, local
)
Returns a local integer value.
Parameters:
scriptName
(string
) – The name of the script.local
(uint64_t
) – The name of the local value.
Returns:
int
– The local value.
get_local_float(scriptName
, local
)
Returns a local float value.
Parameters:
scriptName
(string
) – The name of the script.local
(uint64_t
) – The name of the local value.
Returns:
float
– The local value.
get_local_bool(scriptName
, local
)
Returns a local boolean value.
Parameters:
scriptName
(string
) – The name of the script.local
(uint64_t
) – The name of the local value.
Returns:
bool
– The local value.
get_local_string(scriptName
, local
)
Returns a local string value.
Parameters:
scriptName
(string
) – The name of the script.local
(uint64_t
) – The name of the local value.
Returns:
string
– The local value.
get_local_addr(scriptName
, local
)
Parameters:
scriptName
(string
) – The name of the script.local
(uint64_t
) – The name of the local value.
Returns:
uint64_t
– The memory address of the local.
Render namespace
This namespace contains functions that are used to render certain objects in the game and gathering certain objects’ coordinates on screen.
draw_rect(hash
, draw
, x
, y
, w
, h
, color
, rounding
= 0
, rounding_flags
= 0
)
Draws a box with the given color and rounding.
Note
This doesn’t have to be called every frame, only if you have to constantly change its parameters.
Parameters:
hash
(string
) – The hash of the box to draw. Hash is used to identify the box, so it must be unique.draw
(bool
) – Whether to draw the box or not.True
to draw the box
false
to not draw the box
x
(float
) – The X coordinate of the box’s starting point.y
(float
) – The Y coordinate of the box’s starting point.w
(float
) – The width of the box (in pixels)h
(float
) – The height of the box (in pixels)color
(ColorRGBA
) – The color of the box.{R, G, B, A}
rounding
(float
) – The rounding rule of the box.Default is
0
.
rounding_flags
(int
) – The rounding flags of the box.Default is
0
.
More about rounding flags: Rounding Flags
Returns:
None
Example:
1render.draw_rect("MyHash", true, 0, 0, 100, 100, { 255, 255, 255, 255 }, 10, 0)
draw_rect_filled(hash
, draw
, x
, y
, w
, h
, color
, rounding
= 0
, rounding_flags
= 0
)
Draws a filled box with the given color and rounding.
Note
This doesn’t have to be called every frame, only if you have to constantly change its parameters.
Parameters:
hash
(string
) – The hash of the box to draw. Hash is used to identify the box, so it must be unique.draw
(bool
) – Whether to draw the box or not.True
to draw the box
false
to not draw the box
x
(float
) – The X coordinate of the box’s starting point.y
(float
) – The Y coordinate of the box’s starting point.w
(float
) – The width of the box (in pixels)h
(float
) – The height of the box (in pixels)color
(ColorRGBA
) – The color of the box.{R, G, B, A}
rounding
(float
) – The rounding rule of the box.Default is
0
.
rounding_flags
(int
) – The rounding flags of the box.Default is
0
.
More about rounding flags: Rounding Flags
Returns:
None
Example:
1render.draw_rect_filled("MyHash", true, 0, 0, 100, 100, { 255, 255, 255, 255 }, 10, 0)
draw_rect_border_filled(hash
, draw
, x
, y
, w
, h
, borderSize
, color
, colorBorder
, borderFilled
= true
, rounding
= 0
, rounding_flags
= 0
)
Draws a filled border box with the given color and rounding.
Note
This doesn’t have to be called every frame, only if you have to constantly change its parameters.
Parameters:
hash
(string
) – The hash of the box to draw. Hash is used to identify the box, so it must be unique.draw
(bool
) – Whether to draw the box or not.True
to draw the box
false
to not draw the box
x
(float
) – The X coordinate of the box’s starting point.y
(float
) – The Y coordinate of the box’s starting point.w
(float
) – The width of the box (in pixels)h
(float
) – The height of the box (in pixels)borderSize
(float
) – The width of the border (in pixels)color
(ColorRGBA
) – The color of the box.{R, G, B, A}
colorBorder
(ColorRGBA
) – The color of the border.{R, G, B, A}
borderFilled
(bool
)True
to fill the border
false
to not fill the border
rounding
(float
) – The rounding rule of the box.Default is
0
.
rounding_flags
(int
) – The rounding flags of the box.Default is
0
.
More about rounding flags: Rounding Flags
Returns:
None
Example:
1render.draw_rect_border_filled("MyHash", true, 0, 0, 100, 100, 10, { 255, 255, 255, 255 }, { 0, 0, 0, 255 }, true, 10, 0)
draw_circle(hash
, draw
, x
, y
, radius
, color
, segments
= 16
)
Draws a circle with the given color.
Note
This doesn’t have to be called every frame, only if you have to constantly change its parameters.
Parameters:
hash
(string
) – The hash of the circle to draw. Hash is used to identify the circle, so it must be unique.draw
(bool
) – Whether to draw the circle or not.True
to draw the circle
false
to not draw the circle
x
(float
) – The X coordinate of the circle’s center.y
(float
) – The Y coordinate of the circle’s center.radius
(float
) – The radius of the circle (in pixels).color
(ColorRGBA
) – The color of the circle.{R, G, B, A}
segments
(int
) – The number of segments of the circle.Default is
16
.
Better to keep between
1-50
. Going further may cause the process to crash.
Returns:
None
Example:
1render.draw_circle("MyHash", true, 0, 0, 100, { 255, 255, 255, 255 }, 16)
draw_circle_filled(hash
, draw
, x
, y
, radius
, color
, segments
= 16
)
Draws a filled circle with the given color.
Note
This doesn’t have to be called every frame, only if you have to constantly change its parameters.
Parameters:
hash
(string
) – The hash of the circle to draw. Hash is used to identify the circle, so it must be unique.draw
(bool
) – Whether to draw the circle or not.True
to draw the circle
false
to not draw the circle
x
(float
) – The X coordinate of the circle’s center.y
(float
) – The Y coordinate of the circle’s center.radius
(float
) – The radius of the circle (in pixels).color
(ColorRGBA
) – The color of the circle.{R, G, B, A}
segments
(int
) – The number of segments of the circle.Default is
16
.
Better to keep between
1-50
. Going further may cause the process to crash.
Returns:
None
Example:
1render.draw_circle_filled("MyHash", true, 0, 0, 100, { 255, 255, 255, 255 }, 16)
draw_circle_border_filled(hash
, draw
, x
, y
, radius
, color
, colorBorder
, borderFilled
= true
, segments
= 16
)
Draws a filled border circle with the given color.
Note
This doesn’t have to be called every frame, only if you have to constantly change its parameters.
Parameters:
hash
(string
) – The hash of the circle to draw. Hash is used to identify the circle, so it must be unique.draw
(bool
) – Whether to draw the circle or not.True
to draw the circle
false
to not draw the circle
x
(float
) – The X coordinate of the circle’s center.y
(float
) – The Y coordinate of the circle’s center.radius
(float
) – The radius of the circle (in pixels).color
(ColorRGBA
) – The color of the circle.{R, G, B, A}
colorBorder
(ColorRGBA
) – The color of the border.{R, G, B, A}
borderFilled
(bool
)True
to fill the border
false
to not fill the border
segments
(int
) – The number of segments of the circle.Default is
16
.
Better to keep between
1-50
. Going further may cause the process to crash.
Returns:
None
Example:
1render.draw_circle_border_filled("MyHash", true, 0, 0, 100, { 255, 255, 255, 255 }, { 0, 0, 0, 255 }, true, 16)
draw_triangle(hash
, draw
, x
, y
, color
, size
= 1.1
)
Draws a triangle with the given color.
Note
This doesn’t have to be called every frame, only if you have to constantly change its parameters.
Parameters:
hash
(string
) – The hash of the triangle to draw. Hash is used to identify the triangle, so it must be unique.draw
(bool
) – Whether to draw the triangle or not.True
to draw the triangle
false
to not draw the triangle
x
(float
) – The X coordinate of the triangle’s center.y
(float
) – The Y coordinate of the triangle’s center.color
(ColorRGBA
) – The color of the triangle.{R, G, B, A}
size
(float
) – The size of the triangle (in pixels).Default is
1.1
.
Returns:
None
Example:
1render.draw_triangle("MyHash", true, 0, 0, { 255, 255, 255, 255 }, 1.1)
draw_triangle_filled(hash
, draw
, x
, y
, color
, size
= 1.1
)
Draws a filled triangle with the given color.
Note
This doesn’t have to be called every frame, only if you have to constantly change its parameters.
Parameters:
hash
(string
) – The hash of the triangle to draw. Hash is used to identify the triangle, so it must be unique.draw
(bool
) – Whether to draw the triangle or not.True
to draw the triangle
false
to not draw the triangle
x
(float
) – The X coordinate of the triangle’s center.y
(float
) – The Y coordinate of the triangle’s center.color
(ColorRGBA
) – The color of the triangle.{R, G, B, A}
size
(float
) – The size of the triangle (in pixels).Default is
1.1
.
Returns:
None
Example:
1render.draw_triangle_filled("MyHash", true, 0.f, 0.f, { 255, 255, 255, 255 }, 1.1)
draw_triangle_border_filled(hash
, draw
, x
, y
, color
, colorBorder
, borderFilled
= true
)
Draws a filled border triangle with the given color.
Note
This doesn’t have to be called every frame, only if you have to constantly change its parameters.
Parameters:
hash
(string
) – The hash of the triangle to draw. Hash is used to identify the triangle, so it must be unique.draw
(bool
) – Whether to draw the triangle or not.True
to draw the triangle
false
to not draw the triangle
x
(float
) – The X coordinate of the triangle’s center.y
(float
) – The Y coordinate of the triangle’s center.color
(ColorRGBA
) – The color of the triangle.{R, G, B, A}
colorBorder
(ColorRGBA
) – The color of the border.{R, G, B, A}
borderFilled
(bool
)True
to fill the border (Default)
false
to not fill the border
Returns:
None
Example:
1render.draw_triangle_border_filled("MyHash", true, 0, 0, { 255, 255, 255, 255 }, { 0, 0, 0, 255 }, true)
draw_text(hash
, draw
, text
, x
, y
, scale
, color
, flags
= 0
)
Note
This doesn’t have to be called every frame, only if you have to constantly change its parameters.
Draws a text with the given color.
Parameters:
hash
(string
) – The hash of the text to draw. Hash is used to identify the text, so it must be unique.draw
(bool
) – Whether to draw the text or not.True
to draw the text
false
to not draw the text
text
(string
) – The text to draw.x
(float
) – The X coordinate of the text’s center.y
(float
) – The Y coordinate of the text’s center.scale
(float
) – The scale of the text.color
(ColorRGBA
) – The color of the text.{R, G, B, A}
flags
(int
) – The flags for the text.Default is
0
.
More about text flags: Text Flags
Returns:
None
Example:
1render.draw_text("MyHash", true, "Hello World", 0, 0, 10, { 255, 255, 255, 255 }, 0)
draw_image(path
, hash
, draw
, x
, y
, w
, h
, color
, rounding
= 0.f
, rounding_flags
= 0
)
Note
This doesn’t have to be called every frame, only if you have to constantly change its parameters.
Draws an image. Supports PNG & JPEG files.
Parameters:
path
(string
) – The path of the image to draw.hash
(string
) – The hash of the image to draw. Hash is used to identify the image, so it must be unique.draw
(bool
) – Whether to draw the image or not.True
to draw the image
false
to not draw the image
x
(float
) – The X coordinate of the image’s center.y
(float
) – The Y coordinate of the image’s center.w
(float
) – The width of the image.h
(float
) – The height of the image.color
(ColorRGBA
) – The color of the image.{R, G, B, A}
rounding
(float
) – The rounding of the image.Default is
0
.
rounding_flags
(int
) – The flags for the rounding.Default is
0
.
More about rounding flags: Rounding Flags
Returns:
None
Example:
1render.draw_image("/path/to/image.png", "MyHash", true, 0, 0, 100, 100, { 255, 255, 255, 255 }, 0.f, 0)
draw_atlas_frame(hash
, atlasHash
, frameName
, draw
, x
, y
, w
, h
, color
, rounding
= 0.0
, rounding_flags
= 0
)
Draw an atlas texture frame.
Note
This doesn’t have to be called every frame, only if you have to constantly change its parameters.
Parameters:
hash
(string
) – The hash of the atlas texture frame to draw.atlasHash
(string
) – The hash of the atlas texture.frameName
(string
) – The name of the frame to draw.draw
(bool
) – Whether to draw the atlas texture frame or not.True
to draw the atlas texture frame
false
to not draw the atlas texture frame
x
(float
) – The X coordinate of the atlas texture framey
(float
) – The Y coordinate of the atlas texture framew
(float
) – The width of the atlas texture frame.h
(float
) – The height of the atlas texture frame.color
(ColorRGBA
) – The color of the atlas texture frame.{R, G, B, A}
rounding
(float
) – The rounding of the atlas texture frame.Default is
0
.
rounding_flags
(int
) – The flags for the rounding.Default is
0
.
More about rounding flags: Rounding Flags
Returns:
None
Example:
1--assuming there's a texture named "test" in the atlas
2render.load_atlas("/path/to/atlas.png", "MyAtlas")
3render.draw_atlas_frame("MyFrameHash", "MyAtlas", "test", true, 240, 15, 0, 0, { 255, 255, 255, 255 }, 0, 0)
draw_box(hash
, draw
, boundingData
, color
, thickness
= 1.0
)
Note
This doesn’t have to be called every frame, only if you have to constantly change its parameters.
Draws a 3D box with the given color and thickness.
Parameters:
hash
(string
) – The hash of the box to draw. Hash is used to identify the box, so it must be unique.draw
(bool
) – Whether to draw the box or not.True
to draw the box
false
to not draw the box
boundingData
(ModelBoundingBox
) – The vector consisting of 8 Vector3’s that contain the coordinates of box’s corners.color
(ColorRGBA
) – The color of the box.{R, G, B, A}
thickness
(float
) – The thickness of the box.Default is
1.0
.
Returns:
None
Example:
1pSelfPed = player.get_ped()
2mbbBoundingCoords = scripting.get_entity_bounding_coords(pSelfPed)
3render.draw_box("MyHash", true, mbbBoundingCoords, { 255, 255, 255, 255 }, 1.0)
remove_draw_task(hash
)
Remove a draw task.
Parameters:
hash
(string
) – The hash of the task to remove.
Returns:
None
Example:
1render.remove_draw_task("MyTask")
remove_draw_tasks_by_mask(mask
)
Remove multiple draw tasks with the same masks.
Parameters:
mask
(string
) – The mask of the tasks to remove.
Returns:
None
Example:
1render.remove_draw_tasks_by_mask("Task_*") -- Remove all tasks with the hash that starts with "Task_"
load_atlas(path
, atlasHash
)
Load a texture atlas.
Parameters:
path
(string
) – The path of the atlas to load.atlasHash
(string
) – The atlas hash.
Returns:
None
Example:
1render.load_atlas("/path/to/atlas.png", "MyAtlas")
remove_atlas(atlasHash
)
Unload a texture atlas.
Parameters:
atlasHash
(string
) – The atlas hash.
Returns:
None
Example:
1render.load_atlas("/path/to/atlas.png", "MyAtlas")
2render.remove_atlas("MyAtlas")
is_color_picker_rendering()
Checks whether the color picker is active.
Parameters:
None
Returns:
bool
true
– The color picker is activefalse
– The color picker is inactive
Example:
1if render.is_color_picker_rendering() then
2 system.log_info("The color picker is active!") -- Prints if the color picker is active.
3end
is_cursor_hover_option()
Checks whether the cursor is hovering over an option.
Parameters:
None
Returns:
bool
true
– The cursor is hovering over an optionfalse
– The cursor is not hovering over an option
Example:
1if render.is_cursor_hover_option() then
2 system.log_info("The cursor is hovering over an option!") -- This will only be logged if the cursor is hovering over an option.
3end
is_input_active()
Checks whether the input window is active. (The input window is for example, the window that appears when you press the ` key in story mode)
Parameters:
None
Returns:
bool
true
– The input window is activefalse
– The input window is inactive
Example:
1if render.is_input_active() then
2 system.log_info("The input window is active!") -- This will only be logged if the input window is active.
3end
get_border_size()
Returns the process window’s border size.
Parameters:
None
Returns:
float
– The border size.
Example:
1v3BorderSize = render.get_border_size() -- Returns the border size.
2system.log_info("The border size is " .. tostring(v3BorderSize) .. ".") -- Prints the border size.
get_fps()
Returns the current FPS.
Parameters:
None
Returns:
float
– The current FPS.
Example:
1fFPSCount = render.get_fps() -- Returns the FPS.
2system.log_info("The FPS is " .. tostring(fFPSCount) .. ".") -- Prints the FPS.
get_font_header_size()
Returns the font header size.
Parameters:
None
Returns:
int
– The font header size.
Example:
1fHeaderFontSize = render.get_font_header_size() -- Returns the header size.
2system.log_info("The header size is " .. tostring(fHeaderFontSize) .. ".") -- Prints the header size.
get_font_helper_size()
Returns the font helper size.
Parameters:
None
Returns:
int
– The font helper size.
Example:
1fHelperFontSize = render.get_font_helper_size() -- Returns the helper size.
2system.log_info("The helper size is " .. tostring(fHelperFontSize) .. ".") -- Prints the helper size.
get_font_option_size()
Returns the font option size.
Parameters:
None
Returns:
int
– The font option size.
Example:
1fOptionFontSize = render.get_font_option_size() -- Returns the option size.
2system.log_info("The option size is " .. tostring(fOptionFontSize) .. ".") -- Prints the option size.
get_font_warning_size()
Returns the font warning size.
Parameters:
None
Returns:
int
– The font warning size.
Example:
1fWarningFontSize = render.get_font_warning_size() -- Returns the warning size.
2system.log_info("The warning size is " .. tostring(fWarningFontSize) .. ".") -- Prints the warning size.
get_screen_resolution()
Returns the screen resolution.
Parameters:
None
Returns:
Vector2
– The screen resolution.
Example:
1v2ScreenRes = render.get_screen_resolution() -- Returns the screen resolution.
2system.log_info("The screen resolution is " .. tostring(v2ScreenRes.x) .. ".") -- Prints the screen X resolution.
3system.log_info("The screen resolution is " .. tostring(v2ScreenRes.y) .. ".") -- Prints the screen Y resolution.
get_text_size()
Returns the size of the drawn text.
Note
not documented yet
set_warning(message
)
Brings up a warning (as if a moderator was detected in a session)
Parameters:
message
(string
) – The warning message.
Returns:
None
Example:
1render.set_warning("This is a warning.") -- Brings up a warning.
Player namespace
This namespace contains functions that are related to the character of the menu user.
is_alive()
Returns whether the user is alive.
Parameters:
None
Returns:
bool
– Whether the user is alive.
Example:
1if player.is_alive() then -- Checks whether the user is alive.
2 system.log_info("The user is alive.")
3else
4 system.log_info("The user is dead.")
5end
is_in_vehicle()
Checks whether the user is in a vehicle.
Parameters:
None
Returns:
bool
– Whether the user is in a vehicle.
Example:
1if player.is_in_vehicle() then -- Checks whether the user is in a vehicle.
2 system.log_info("The user is in a vehicle.")
3else
4 system.log_info("The user is not in a vehicle.")
5end
is_valid()
Checks whether the player is valid – the player is alive, is fully loaded into the session, and has control of the character.
Parameters:
None
Returns:
bool
– Whether the player is valid.Can also be
true
during cutscenes.
Example:
1if player.is_valid() then -- Checks whether the player is valid.
2 system.log_info("The player is valid.")
3else
4 system.log_info("The player is invalid.")
5end
get_online_index()
Returns the online index of the user’s character.
Parameters:
None
Returns:
int
– The online index of the user’s character.0
– The first character is used1
– The second character is used
Example:
1iOnlineIndex = player.get_online_index() -- Returns the online index of the user's character.
2if iOnlineIndex == 0 then -- Checks whether the first character is used.
3 system.log_info("The first character is used.")
4elseif iOnlineIndex == 1 then -- Checks whether the second character is used.
5 system.log_info("The second character is used.")
6end
get_ped()
Returns the user’s character’s ped ID
Parameters:
None
Returns:
int
– The user’s character’s ped ID.
Example:
1pSelfPed = player.get_ped()
2if rage.ped.is_ped_a_player(pSelfPed) then -- If the ped is a player.
3 system.log_info("The ped is a player.")
4end
get_id()
Returns the player as a player handle
Parameters:
None
Returns:
int
– The player handle
Example:
1plHandle = player.get_id()
2system.log_info("The character ID is " .. tostring(plHandle) .. ".")
get_name()
Returns your own username.
Parameters:
None
Returns:
string
Example:
1sUsername = player.get_name()
2system.log_info("My username is: " .. sUsername)
get_original_scid()
Returns your SCID (Social Club ID).
Parameters:
None
Returns:
uint32_t
– Original Social Club ID
Example:
1sMyRealSCID = player.get_original_scid()
2system.log_info("My original SCID is: " .. tostring(sMySCID))
get_scid()
Returns your current SCID (Social Club ID).
Parameters:
None
Returns:
uint32_t
– Current Social Club ID
Example:
1sMySCID = player.get_scid()
2system.log_info("My current SCID is: " .. tostring(sMySCID))
get_saved_scid()
Returns your saved SCID (Social Club ID).
Parameters:
None
Returns:
uint64_t
– Saved Social Club ID
Example:
1sMySavedSCID = player.get_saved_scid()
2system.log_info("My saved SCID is: " .. tostring(sMySavedSCID))
get_coords()
Returns your character’s coordinates.
Parameters:
None
Returns:
Vector3
– Coordinates
Example:
1v3CurrentCoords = player.get_coords()
2system.log_info("I'm located at the following coords: " .. tostring(v3CurrentCoords.x) .. ", " .. tostring(v3CurrentCoords.y) .. ", " .. tostring(v3CurrentCoords.z) .. " .")
get_coords_infront(distance
= 5.0
)
Returns coordinates in front of your character.
Parameters:
distance
(float
) – Distance calculated starting from in front of self.Default value is
5.0
.
Returns:
Vector3
– Coordinates in front of self.
Example:
1v3CoordsInfront = player.get_coords_infront(5)
2system.log_info("The coords in front of me are: " .. tostring(v3CoordsInfront.x) .. ", " .. tostring(v3CoordsInfront.y) .. ", " .. tostring(v3CoordsInfront.z) .. " .")
get_vehicle()
Returns your current vehicle’s ID.
Parameters:
None
Returns:
Vehicle
– Vehicle handle.
Example:
1vCurrentVehicle = player.get_vehicle()
2system.log_info("You're riding vehicle ID: " .. tostring(vCurrentVehicle))
Lobby namespace
This namespace contains functions related to the interaction with the online game session.
Note
Functions from this namespace only work in online mode.
is_player_active(player
)
Checks whether the player is in active, in the session, is fully loaded, connected, is in the same game mode as you (e.g. freemode)
Parameters:
player
(Player
) – The player ID.
Returns:
bool
– Whether the player is active.
Example:
1plHostPlayer = lobby.get_host()
2
3bIsActive = lobby.is_player_active(places) -- Checks whether the player is active.
4if bIsActive then -- If the player is active.
5 system.log_info("The player is active.")
6end
is_player_connected(player
)
Checks whether the player is connected.
Parameters:
player
(Player
) – The player ID.
Returns:
bool
– Whether the player is connected.
Example:
1plHostPlayer = lobby.get_host()
2bIsConnected = lobby.is_player_connected(plHostPlayer) -- Checks whether the player is connected.
3if bIsConnected then -- If the player is connected.
4 system.log_info("The player is connected.")
5end
is_player_friend(player
)
Checks whether the player is a friend.
Parameters:
player
(Player
) – The player ID.
Returns:
bool
– Whether the player is a friend.
Example:
1plHostPlayer = lobby.get_host()
2bIsFriend = lobby.is_player_friend(plHostPlayer) -- Checks whether the session host is a friend.
3if bIsFriend then -- If the player is a friend.
4 system.log_info("The player is a friend.")
5end
is_player_host(player
)
Checks whether the player is the host.
Parameters:
player
(Player
) – The player ID.
Returns:
bool
– Whether the player is the host.
Example:
1plHostPlayer = lobby.get_host()
2bIsHost = lobby.is_player_host(plHostPlayer) -- Checks whether the player is the host.
3if bIsHost then -- If the player is the host.
4 system.log_info("The player is the host.")
5end
is_player_host_next(player
)
Checks whether the player is the next script host.
Parameters:
player
(Player
) – The player ID.
Returns:
bool
– Whether the player is the next script host.
Example:
1plHostPlayer = lobby.get_host()
2bIsNextHost = lobby.is_player_host_next(plHostPlayer) -- Checks whether the player is the next script host.
3if bIsNextHost then -- If the player is the next script host.
4 system.log_info("The player is the next script host.")
5end
is_player_in_vehicle(player
)
Checks whether the player is in a vehicle.
Parameters:
player
(Player
) – The player ID.
Returns:
bool
– Whether the player is in a vehicle.
Example:
1plHostPlayer = lobby.get_host()
2bIsInVehicle = lobby.is_player_in_vehicle(plHostPlayer) -- Checks whether the player is in a vehicle.
3if bIsInVehicle then -- If the player is in a vehicle.
4 system.log_info("The player is in a vehicle.")
5end
is_player_modder(player
)
Checks whether the player is a modder.
Parameters:
player
(Player
) – The player ID.
Returns:
bool
– Whether the player is a modder.
Example:
1plHostPlayer = lobby.get_host()
2bIsModder = lobby.is_player_modder(plHostPlayer) -- Checks whether the player is a modder.
3if bIsModder then -- If the player is a modder.
4 system.log_info("The player is a modder.")
5end
is_player_selected(player
)
Checks whether the player is selected in the menu’s online section.
Parameters:
player
(Player
) – The player ID.
Returns:
bool
– Whether the player is selected.
Example:
1plHostPlayer = lobby.get_host()
2bIsSelected = lobby.is_player_selected(plHostPlayer) -- Checks whether the player is selected.
3if bIsSelected then -- If the player is selected.
4 system.log_info("The player is selected.")
5end
is_player_staff(player
)
Checks whether the player is a Rockstar staff member.
Parameters:
player
(Player
) – The player ID.
Returns:
bool
– Whether the player is a Rockstar staff member.
Example:
1plHostPlayer = lobby.get_host()
2bIsStaff = lobby.is_player_staff(plHostPlayer) -- Checks whether the player is a Rockstar staff member.
3if bIsStaff then -- If the player is a Rockstar staff member.
4 system.log_info("The player is a Rockstar staff member.")
5end
is_player_valid(player
)
Checks whether the player is valid - if it’s connected to the session, fully loaded, and alive.
Parameters:
player
(Player
) – The player ID.
Returns:
bool
– Whether the player is valid.
Example:
1plHostPlayer = lobby.get_host()
2bIsValid = lobby.is_player_valid(plHostPlayer) -- Checks whether the player is valid.
3if bIsValid then -- If the player is valid.
4 system.log_info("The player is valid.")
5end
is_session_started()
Checks whether the session has started: returns true if it’s fully loaded and you’re not hanging in the clouds.
Parameters:
None
Returns:
bool
– Whether the session has started.
Example:
1bIsStarted = lobby.is_session_started() -- Checks whether the session has started.
2if bIsStarted then -- If the session has started.
3 system.log_info("The session has started.")
4end
get_active_players()
Returns a number of all active players.
Parameters:
None
Returns:
int
– a number of all active players.
Example:
1iActivePlayersCount = lobby.get_active_players() -- Returns a number of all active players.
2system.log_info("There are " .. tostring(iActivePlayersCount) .. " active players.")
get_connected_players()
Returns a number of connected players.
Parameters:
None
Returns:
int
– a number of connected players.
Example:
1iConnectedPlayersCount = lobby.get_connected_players() -- Returns a number of connected players.
2system.log_info("There are " .. tostring(iConnectedPlayersCount) .. " connected players.")
get_player_armour(player
)
Returns the player’s armour health.
Parameters:
player
(Player
) – The player ID.
Returns:
int
– The player’s armour health.
Example:
1plHandle = player.get_id()
2iArmourHealth = lobby.get_player_armour(plHandle) -- Returns the player's armour health.
3if armour == 0 then -- If the player has no armour.
4 system.log_info("The player has no armour.")
5end
get_player_health(player
)
Returns the player’s health.
Parameters:
player
(Player
) – The player ID.
Returns:
int
– The player’s health.
Example:
1plHandle = player.get_id()
2
3iHealth = lobby.get_player_health(plHandle)
4iMaxHealth = lobby.get_player_max_health(plHandle)
5if iHealth == iMaxHealth then
6 system.log_info("The player has full health.")
7end
get_player_max_health(player
)
Returns the player’s maximum health.
Parameters:
player
(Player
) – The player ID.
Returns:
int
– The player’s maximum health.
Example:
1plHandle = player.get_id()
2
3iMaxHealth = lobby.get_player_max_health(plHandle)
4iHealth = lobby.get_player_health(plHandle)
5if iMaxHealth == iHealth then
6 system.log_info("The player has full health.")
7end
get_player_team(player
)
Returns the player’s team.
Parameters:
player
(Player
) – The player ID.
Returns:
int
– The player’s team ID. -1 if the player is not in a team.
Example:
1plHandle = player.get_id()
2
3iTeam = lobby.get_player_team(plHandle)
4if iTeam == -1 then -- If the player is not in a team.
5 system.log_info("The player is not in a team.")
6end
get_player_ped(player
)
Returns the player’s ped.
Parameters:
player
(Player
) – The player ID.
Returns:
Ped
– The player’s ped.
Example:
1plHostPlayer = lobby.get_host()
2pHostPed = lobby.get_player_ped(plHostPlayer) -- Returns the host's ped.
3if rage.ped.is_ped_a_player(pHostPed) then -- If the ped is a player.
4 system.log_info("The ped is a player.")
5end
get_host()
Returns the host player ID.
Parameters:
None
Returns:
Player
– The host player ID.
Example:
1plHostPlayer = lobby.get_host() -- Returns the host player ID.
2system.log_debug("The host is " .. get_player_name(plHostPlayer) .. ".")
get_next_host()
Returns the next host player ID.
Parameters:
None
Returns:
Player
– The next host player ID.
Example:
1plNextHost = lobby.get_next_host() -- Returns the next host player ID.
2system.log_debug("The next host is " .. get_player_name(plNextHost) .. ".")
get_selected_player()
Returns the ID of a player that is currently selected in the Online section.
Parameters:
None
Returns:
Player
– The selected player ID.
get_player_coords_str(player
)
Returns the player’s coordinates as a string.
Parameters:
player
(Player
) – The player ID.
Returns:
string
– The player’s coordinates
Example:
1plHostPlayer = lobby.get_host()
2
3v3PlayerCoords = lobby.get_player_coords_str(plHostPlayer) -- Returns the host's coordinates.
4system.log_debug("The host is at " .. v3PlayerCoords .. ".")
get_player_ip(player
)
Returns the player’s IP.
Parameters:
player
(Player
) – The player ID.
Returns:
string
– The player’s IP.
Example:
1plHostPlayer = lobby.get_host()
2
3sIPAddress = lobby.get_player_ip(plHostPlayer) -- Returns the host's IP.
4system.log_debug("The host's IP is " .. sIPAddress .. ".")
get_player_name(player
)
Returns the player’s name.
Parameters:
player
(Player
) – The player ID.
Returns:
string
– The player’s name.
Example:
1plHostPlayer = lobby.get_host()
2sNickname = lobby.get_player_name(plHostPlayer) -- Returns the host's name.
3system.log_debug("The host's name is " .. sNickname .. ".")
get_player_status(player
)
Returns the player’s status.
Parameters:
player
(Player
) – The player ID.
Returns:
string
– The player’s status.H
– The player is the host.NH
– The player is the next host.F
– The player is a friend.M
– The player is a modder.
Example:
1plSelected = lobby.get_selected_player()
2
3sPlayerStatus = lobby.get_player_status(plSelected) -- Returns the selected player's status.
4system.log_debug("The selected player's status is " .. sPlayerStatus .. ".")
get_player_vehicle_name(player
)
Returns the player’s vehicle name.
Parameters:
player
(Player
) – The player ID.
Returns:
string
– The player’s vehicle name. If the player is not in a vehicle, the string “None” is returned.
Example:
1plHostPlayer = lobby.get_host()
2sVehicleName = lobby.get_player_vehicle_name(plHostPlayer) -- Returns the host's vehicle name.
3system.log_debug("The host's vehicle name is " .. sVehicleName .. ".")
get_player_deaths(player
)
Returns the total player’s deaths.
Parameters:
player
(Player
) – The player ID.
Returns:
int
– The player’s deaths.
Example:
1plHostPlayer = lobby.get_host()
2iDeathsCount = lobby.get_player_deaths(plHostPlayer) -- Returns the host's deaths.
3system.log_debug("The host has died " .. tostring(iDeathsCount) .. " times.")
get_player_kills(player
)
Returns the total player’s kills.
Parameters:
player
(Player
) – The player ID.
Returns:
int
– The player’s kills.
Example:
1plHostPlayer = lobby.get_host()
2iKillsCount = lobby.get_player_kills(plHostPlayer) -- Returns the host's kills.
3system.log_debug("The host has killed " .. tostring(iKillsCount) .. " people.")
get_player_level(player
)
Returns the player’s level.
Parameters:
player
(Player
) – The player ID.
Returns:
int
– The player’s level.
Example:
1plHostPlayer = lobby.get_host()
2iLevel = lobby.get_player_level(plHostPlayer) -- Returns the host's level.
3system.log_debug("The host's level is " .. tostring(iLevel) .. ".")
get_player_money_bank(player
)
Returns the player’s bank money.
Parameters:
player
(Player
) – The player ID.
Returns:
int
– The player’s bank money.
Example:
1plHostPlayer = lobby.get_host()
2iBankMoneyAmount = lobby.get_player_money_bank(plHostPlayer) -- Returns the host's bank money.
3system.log_debug("The host has $" .. tostring(iBankMoneyAmount) .. " in the bank.")
get_player_money_wallet(player
)
Returns the player’s wallet money.
Parameters:
player
(Player
) – The player ID.
Returns:
int
– The player’s wallet money.
Example:
1plHostPlayer = lobby.get_host()
2iWalletMoneyAmount = lobby.get_player_money_wallet(plHostPlayer) -- Returns the host's wallet money.
3system.log_debug("The host has $" .. tostring(iWalletMoneyAmount) .. " in the wallet.")
get_player_rp(player
)
Returns the player’s RP points.
Parameters:
player
(Player
) – The player ID.
Returns:
int
– The player’s RP.
Example:
1plHostPlayer = lobby.get_host()
2iRPpoints = lobby.get_player_rp(plHostPlayer) -- Returns the host's RP.
3system.log_debug("The host has " .. tostring(iRPpoints) .. " RP.")
get_player_host_token(player
)
Returns the player’s host token.
Parameters:
player
(Player
) – The player ID.
Returns:
string
– The player’s host token.
Example:
1plHostPlayer = lobby.get_host()
2sHostToken = lobby.get_player_host_token(plHostPlayer) -- Returns the host's host token.
3system.log_debug("The host's host token is " .. sHostToken .. ".")
get_player_original_scid(player
)
Returns the player’s original SCID.
Parameters:
player
(Player
) – The player ID.
Returns:
string
– The player’s original SCID.
Example:
1plHostPlayer = lobby.get_host()
2sPlayerOriginalSCID = lobby.get_player_original_scid(plHostPlayer) -- Returns the host's original SCID.
3system.log_debug("The host's original SCID is " .. sPlayerOriginalSCID .. ".")
get_player_scid(player
)
Returns the player’s SCID.
Parameters:
player
(Player
) – The player ID.
Returns:
string
– The player’s SCID.
Example:
1plHostPlayer = lobby.get_host()
2sPlayerSCID = lobby.get_player_scid(plHostPlayer) -- Returns the host's SCID.
3system.log_debug("The host's SCID is " .. sPlayerSCID .. ".")
get_player_coords(player
)
Returns the player’s coordinates.
Parameters:
player
(Player
) – The player ID.
Returns:
Vector3
– The player’s coordinates.
Example:
1plHostPlayer = lobby.get_host()
2v3PlayerCoords = lobby.get_player_coords(plHostPlayer) -- Returns the host's coordinates.
3system.log_debug("The host is at " .. tostring(v3PlayerCoords.x) .. ", " .. tostring(v3PlayerCoords.y) .. ", " .. tostring(v3PlayerCoords.z) .. " .")
get_player_vehicle(player
)
Returns the player’s vehicle.
Parameters:
player
(Player
) – The player ID.
Returns:
Vehicle
– The player’s vehicle.
Example:
1plHostPlayer = lobby.get_host()
2vPlayerVehicle = lobby.get_player_vehicle(plHostPlayer) -- Returns the host's vehicle.
3system.log_debug("The host's vehicle is " .. tostring(vPlayerVehicle) .. ".")
set_player_modder(player
, toggle
)
Sets the player’s modder status.
Parameters:
player
(Player
) – The player ID.toggle
(bool
) – The modder status.true
– The player is a modder.false
– The player is not a modder.
Returns:
None
Example:
1plHostPlayer = lobby.get_host()
2
3lobby.set_player_modder(plHostPlayer, true) -- Sets the host as a modder.
4system.log_debug("The host is now marked as a modder.")
set_player_selected(player
, toggle
)
Sets the player as selected in the online menu.
Parameters:
player
(Player
) – The player ID.toggle
(bool
) – The selected status.true
– The player is set as selected.false
– The player is set as not selected.
Returns:
None
Example:
1plHostPlayer = lobby.get_host()
2lobby.set_player_selected(plHostPlayer, true) -- Sets the host as selected.
3system.log_debug("The host is now selected.")
set_player_staff(player
, toggle
)
Sets the player’s staff status.
Parameters:
player
(Player
) – The player ID.toggle
(bool
) – The staff status.true
– The player is a staff member.false
– The player is not a staff member.
Returns:
None
Example:
1plHostPlayer = lobby.get_host()
2lobby.set_player_staff(plHostPlayer, true) -- Sets the host as a staff member.
3system.log_debug("The host is a staff member.")
Vehicle namespace
This namespace contains functions related to vehicle manipulation
get_vehicle_handling(vehicle
, param
)
Returns the value for the specified handling parameter.
Parameters:
vehicle
(Vehicle
) – The vehicle ID.param
(string
) – The handling parameter.You can find a list of handling parameters here: Vehicle handling parameters.
Returns:
float
– The value for the specified handling parameter.
Example:
1vCurrentVehicle = player.get_vehicle()
2handling = vehicle.get_vehicle_handling(vCurrentVehicle, "fBrakeForce") -- Returns the brake force of the vehicle.
3system.log_debug("The player's vehicle has " .. tostring(handling) .. " brake force.")
set_vehicle_handling(vehicle
, param
, value
)
Sets the value for the specified handling parameter.
Parameters:
vehicle
(Vehicle
) – The vehicle ID.param
(string
) – The handling parameter.You can find a list of handling parameters here: Vehicle handling parameters.
value
(float
) – The value for the specified handling parameter.
Returns:
None
Example:
1vCurrentVehicle = player.get_vehicle()
2vehicle.set_vehicle_handling(vCurrentVehicle, "fAcceleration", 100) -- Sets the acceleration of the vehicle to 100 points.
3system.log_debug("The player's vehicle has been set to have 100 acceleration points.")
get_vehicle_handling_parameters()
Get all vehicle handling parameters.
Parameters:
None
Returns:
vector<string>
– The vehicle handling parameters vector.
Example:
1vCurrentVehicle = player.get_vehicle()
2vstrHandlingParameters = vehicle.get_vehicle_handling_parameters() -- Returns the vehicle handling parameters vector.
3for i,v in pairs(vstrHandlingParameters) do
4 system.log_debug(tostring(i) .. " " .. tostring(v))
5end
Weapon namespace
This namespace contains functions related to weapon manipulation
get_weapon_info(ped
, param
)
Returns the value for the specified weapon parameter.
Parameters:
ped
(Ped
) – The ped ID.param
(string
) – The weapon parameter.You can find a list of weapon parameters here: Weapon Info parameters.
Returns:
float
– The value for the specified weapon parameter.
Example:
1pSelfPed = player.get_player()
2fWeaponInfo = weapon.get_weapon_info(pSelfPed, "fWeaponRange") -- Returns the weapon range of the player.
3system.log_debug("The player's weapon has " .. tostring(weaponInfo) .. " weapon range.")
set_weapon_info(ped
, param
, value
)
Sets the value for the specified weapon parameter.
Parameters:
ped
(Ped
) – The ped ID.You can find a list of weapon parameters here: Weapon Info parameters.
param
(string
) – The weapon parameter.value
(float
) – The value for the specified weapon parameter.
Returns:
None
Example:
1pSelfPed = player.get_player()
2fWeaponRange = weapon.get_weapon_info(pSelfPed, "fWeaponRange") -- Returns the weapon range of the player.
3weapon.set_weapon_info(pSelfPed, "fWeaponRange", fWeaponRange+10)
4system.log_debug("The player's weapon has been set to have " .. tostring((fWeaponRange+10)) .. " weapon range.")
get_vehicle_weapon_info(vehicle
, param
)
Returns the value of the vehicle weapon for the specified weapon parameter.
Parameters:
vehicle
(Vehicle
) – The vehicle ID.param
(string
) – The weapon parameter.You can find a list of weapon parameters here: Weapon Info parameters.
Returns:
float
– The value for the specified weapon parameter.
Example:
1vCurrentVehicle = player.get_vehicle()
2fWeaponInfo = weapon.get_vehicle_weapon_info(vCurrentVehicle, "fWeaponRange") -- Returns the weapon range of the vehicle.
3system.log_debug("The player's vehicle has " .. tostring(weaponInfo) .. " weapon range.")
set_vehicle_weapon_info(vehicle
, param
, value
)
Sets the value of the vehicle weapon for the specified weapon parameter.
Parameters:
vehicle
(Vehicle
) – The vehicle ID.You can find a list of weapon parameters here: Weapon Info parameters.
param
(string
) – The weapon parameter.value
(float
) – The value for the specified weapon parameter.
Returns:
None
Example:
1vCurrentVehicle = player.get_vehicle()
2fWeaponInfo = weapon.get_vehicle_weapon_info(vCurrentVehicle, "fWeaponRange") -- Returns the weapon range of the vehicle.
3weapon.set_vehicle_weapon_info(vCurrentVehicle, "fWeaponRange", fWeaponRange+10)
4system.log_debug("The player's vehicle has been set to have " .. tostring((fWeaponRange+10)) .. " weapon range.")
get_ammo_info(ped
, param
)
Returns the value for the specified ammo parameter.
Parameters:
ped
(Ped
) – The ped ID.param
(string
) – The ammo parameter.You can find a list of ammo parameters here: Ammo info parameters.
Returns:
float
– The value for the specified ammo parameter.
Example:
1pSelfPed = player.get_player()
2fMissileSpeed = weapon.get_ammo_info(pSelfPed, "fMissileSpeed") -- Returns the missile speed
3system.log_debug("The player's weapon has " .. tostring(fMissileSpeed) .. " missile speed.")
set_ammo_info(ped
, param
, value
)
Sets the value for the specified ammo parameter.
Parameters:
ped
(Ped
) – The ped ID.param
(string
) – The ammo parameter.You can find a list of ammo parameters here: Ammo info parameters.
value
(float
) – The value for the specified ammo parameter.
Returns:
None
Example:
1pSelfPed = player.get_player()
2fMissileSpeed = weapon.get_ammo_info(pSelfPed, "fMissileSpeed") -- Returns the missile speed
3weapon.set_ammo_info(pSelfPed, "fMissileSpeed", fMissileSpeed+10)
4system.log_debug("The player's weapon has been set to have " .. tostring((fMissileSpeed+10)) .. " missile speed.")
get_weapon_info_parameters()
Returns a list of weapon parameters.
Parameters:
None
Returns:
vector<string>
– A list of weapon parameters.
Example:
1vstrWeaponParams = weapon.get_weapon_info_parameters()
2for i,v in pairs(vstrWeaponParams) do
3 system.log_debug(tostring(i) .. " " .. tostring(v))
4end
get_ammo_info_parameters()
Returns a list of ammo parameters.
Parameters:
None
Returns:
vector<string>
– A list of ammo parameters.
Example:
1vstrAmmoParams = weapon.get_ammo_info_parameters()
2for i,v in pairs(vstrAmmoParams) do
3 system.log_debug(tostring(i) .. " " .. tostring(v))
4end
Text namespace
This namespace contains functions related to text manipulation.
contains(source
, data
)
Checks whether a string contains character/word.
Parameters:
source
(string
) – The string to check.data
(string
) – The data to check for.
Returns:
bool
true
– The string contains the data.false
– The string does not contain the data.
Example:
1sloremIpsum = "Lorem ipsum dolor sit amet"
2bContains = text.contains(sloremIpsum, "Lorem")
3if bContains then
4 system.log_debug("The string contains the word \"Lorem\".")
5else
6 system.log_debug("The string does not contain the word \"Lorem\".")
7end
is_float(data
)
Checks whether a string is float
type.
Parameters:
data
(string
) – The data to check.
Returns:
bool
true
– The data is a float.false
– The data is not a float.
Example:
1bIsFloat = text.is_float("10.1")
2if bIsFloat then
3 system.log_debug("The string is a float.")
4else
5 system.log_debug("The string is not a float.")
6end
is_number(data
)
Checks whether a string is a number.
Parameters:
data
(string
) – The data to check.
Returns:
bool
true
– The data is a number.false
– The data is not a number.
Example:
1bIsNumber = text.is_number("10")
2if bIsNumber then
3 system.log_debug("The string is a number.")
4else
5 system.log_debug("The string is not a number.")
6end
is_valid_ip4(data
)
Checks whether the string is a valid IPv4 address.
Parameters:
data
(string
) – The data to check.
Returns:
bool
true
– The data is a valid IPv4 address.false
– The data is not a valid IPv4 address.
Example:
1isValid = text.is_valid_ip4("1.1.1.1")
2if isValid then
3 system.log_debug("The string is a valid IPv4 address.")
4else
5 system.log_debug("The string is not a valid IPv4 address.")
6end
get_random_string(length
, type
)
Generates a random string.
Parameters:
length
(int
) – Length of the string.type
(eRandomType
) – Type of string generation:0
– Upper1
– Lower2
– Digits3
– UpperLower4
– UpperDigits5
– LowerDigits
Returns:
string
– The generated random string.
Example:
1sRandom = text.get_random_string(10, 2) -- Generates a random string made of digits
2system.log_debug(sRandom)
remove_characters(data
, word
)
Removes certain characters from string.
Parameters:
data
(string
) – The data to check.word
(string
) – Word/Character to remove.
Returns:
string
– The output string.
Example:
1sCutCharacters = remove_characters("Road", "o")
2system.log_debug(sCutCharacters)
replace_characters(data
, first
, second
)
Replaces certain characters from string.
Parameters:
data
(string
) – The data to check.first
(string
) – Word/Character to replacesecond
(string
) – Replacement word/character
Returns:
string
– The new, replaced string
Example:
1sReplacedCharacters = replace_characters("John", "hn", "e")
2system.log_debug(sReplacedCharacters)
resize_string_center(data
, length
)
Cuts string from center.
Parameters:
data
(string
) – The data to check.length
(int
) – Length of the end string.
Returns:
string
– The new string.
Example:
1sResizedCenter = resize_string_center("Hello World", 5)
2system.log_debug(sResizedCenter)
Output:
1He...ld
resize_string_left(data
, length
)
Cuts string from the left
Parameters:
data
(string
) – The data to check.length
(int
) – Length of the end string.
Returns:
string
– The new string.
Example:
1sResizedLeft = resize_string_left("Hello World", 5)
2system.log_debug(sResizedLeft)
Output:
1...World
resize_string_right(data
, length
)
Cuts string from the right.
Parameters:
data
(string
) – The data to check.length
(int
) – Length of the end string.
Returns:
string
– The new string.
Example:
1sResizedRight = resize_string_right("Hello World", 5)
2system.log_debug(sResizedRight)
Output:
1Hello...
get_clipboard_text()
Copies the text from the clipboard
Parameters:
None
Returns:
string
– The text from the clipboard.
Example:
1sClipboardText = get_clipboard_text()
2system.log_debug(sClipboardText)
FS namespace
This namespace contains functions that let you interact with the file system.
dir_exist(dir
)
Checks whether the directory exists.
Parameters:
dir
(string
) – Directory to check
Returns:
bool
True
– directory existsFalse
– directory does not exist
Example:
1if fs.dir_exist("C:\Users\") then
2 system.log_info("Directory exists.")
3end
file_exist(file
)
Checks whether the file exists.
Parameters:
file
(string
) – File to check
Returns:
bool
True
– file existsFalse
– file does not exist
Example:
1if not fs.file_exist("D:\NewFolder\BetterCallSaulS05E06.mp4") then
2 system.log_info("Better not to call Saul.")
3end
file_remove(file
)
Removes a file.
Parameters:
file
(string
) – File to remove
Returns:
bool
True
– The file was removedFalse
– The file was not removed (e.g. file was not found)
Example:
1success = fs.file_remove("test.txt") -- Removes the file.
2if success then
3 system.log_info("File removed.") -- Prints a message if the file was removed.
4end
file_validate(file
)
Checks whether the file is corrupted, Checks whether the permissions are correct, if it’s readable and if it’s writable.
Parameters:
file
(string
) – File to validate
Returns:
bool
True
– The file is validFalse
– The file is invalid (e.g. file was not found)
Example:
1if fs.file_validate("test.txt") then
2 system.log_info("File is valid and ready.")
3end
is_file_empty(file
)
Checks whether the file is empty.
Parameters:
file
(string
) – File to check
Returns:
bool
True
– The file is emptyFalse
– The file is not empty
Example:
1if fs.is_file_empty("test.txt") then
2 system.log_info("The file is empty.")
3else
4 system.log_info("The file is not empty.")
5end
dir_check(dir
)
Checks whether the directory exists, and if not, creates it.
Parameters:
dir
(string
) – Directory to check
Returns:
None
Example:
1fs.dir_check("D:\NewFolder") -- Creates the directory if it doesn't exist.
dir_create(dir
)
Creates a directory.
Parameters:
dir
(string
) – Directory to create
Returns:
None
Example
1fs.dir_create("D:\NewFolder") -- Creates a directory.
file_copy(source
, dest
)
Copies a file.
Parameters:
source
(string
) – Path to source filedest
(string
) – Path to destination file
Returns:
None
Example
1fs.file_copy("source.txt", "dest.txt")
2-- or
3fs.file_copy("files/source.txt", "files/dest.txt")
get_dis2rbed_dir()
Returns the filepath for the DIS2RBED home directory.
Parameters:
None
Returns:
string
– The filepath for the DIS2RBED home directory
Example:
1sDirectoryPath = fs.get_dis2rbed_dir()
2system.log_debug(sDirectoryPath)
get_fonts_dir()
Returns the filepath for the DIS2RBED fonts directory.
Parameters:
None
Returns:
string
– The filepath for the DIS2RBED fonts directory
Example:
1sDirectoryPath = fs.get_fonts_dir()
2system.log_debug(sDirectoryPath)
get_themes_dir()
Returns the filepath for the DIS2RBED themes directory.
Parameters:
None
Returns:
string
– The filepath for the DIS2RBED themes directory
Example:
1sDirectoryPath = fs.get_themes_dir()
2system.log_debug(sDirectoryPath)
get_locales_dir()
Returns the filepath for the DIS2RBED locales directory.
Parameters:
None
Returns:
string
– The filepath for the DIS2RBED locales directory
Example:
1sDirectoryPath = fs.get_locales_dir()
2system.log_debug(sDirectoryPath)
get_lua_dir()
Returns the filepath for the DIS2RBED lua directory.
Parameters:
None
Returns:
string
– The filepath for the DIS2RBED lua directory
Example:
1sDirectoryPath = fs.get_lua_dir()
2system.log_debug(sDirectoryPath)
get_gta_dir()
Returns the filepath for the GTA directory.
Parameters:
None
Returns:
string
– The filepath for the GTA directory
Example:
1sDirectoryPath = fs.get_gta_dir()
2system.log_debug(sDirectoryPath)
Scripting functions
Scripting functions are functions that let you interact with DIS2RBED’s built-in options
Functions that are not included in any namespace
get_vehicle_bypass()
Checks whether the bypass for spawning Online cars in SinglePlayer is enabled.
Parameters:
None
Returns:
bool
True
– The bypass is enabledFalse
– The bypass is disabled
Example:
1if get_vehicle_bypass() then
2 system.log_info("The bypass is enabled.")
3end
set_vehicle_bypass(toggle
)
Sets whether the bypass for spawning Online cars in SinglePlayer is enabled.
Parameters:
toggle
(bool
) – Toggle the bypassTrue
– Enable the bypassFalse
– Disable the bypass
Returns:
None
Example:
1if not scripting.get_vehicle_bypass() then
2 scripting.set_vehicle_bypass(true) -- Enables the bypass.
3 system.log_info("The bypass is enabled.")
4end
get_coords_infront_of_coords(position
, rotation
, distance
)
Returns the coordinates in front of the specified coordinates.
Parameters:
position
(Vector3
) – Specified coordinatesrotation
(Vector3
) – Rotation to usedistance
(float
) – Distance to the object
Returns:
Vector3
– Coordinates in front of the object
Example:
1v3CurrentCoords = player.get_coords()
2v3CoordsInfrontOfCoords = scripting.get_coords_infront_of_coords(v3CurrentCoords, rage.entity.get_entity_rotation(player.get_ped(), 1), 10)
3system.log_debug(tostring(v3CoordsInfrontOfCoords.x) .. ", " .. tostring(v3CoordsInfrontOfCoords.y) .. ", " .. tostring(v3CoordsInfrontOfCoords.z))
get_coords_above_of_coords(position
, distance
)
Returns the coordinates above of the specified coordinates.
Parameters:
position
(Vector3
) – Specified coordinatesdistance
(float
) – Distance from the coordinates
Returns:
Vector3
– Coordinates above of the object
Example:
1v3CurrentCoords = player.get_coords()
2v3CoordsAboveCoords = get_coords_above_of_coords(v3CurrentCoords, 10)
3system.log_debug(tostring(v3CoordsAboveCoords.x) .. ", " .. tostring(v3CoordsAboveCoords.y) .. ", " .. tostring(v3CoordsAboveCoords.z))
get_blip_coords(sprite
, color
)
Returns the coordinates of the specified Blip.
Parameters:
sprite
(int
) – Sprite of the blipcolor
(int
) – Color of the blip
Returns:
Vector3
– Coordinates of the blip
Example:
1v3BlipCoords = scripting.get_blip_coords(8, -1) -- waypoint blip
2system.log_debug(tostring(v3BlipCoords.x) .. ", " .. tostring(v3BlipCoords.y) .. ", " .. tostring(v3BlipCoords.z))
get_ground_z(coords
)
Returns the ground Z coordinate (height) of the specified coordinates.
Parameters:
coords
(Vector3
) – Coordinates to check
Returns:
float
– Ground Z coordinate
Example:
1v3CurrentCoords = player.get_coords()
2fGroundZ = scripting.get_ground_z(v3CurrentCoords)
3system.log_debug(tostring(fGroundZ))
get_entity_bounding_coords(entity
)
Returns the bounding coordinates of the specified entity.
Parameters:
entity
(Entity
) – Entity to check
Returns:
ModelBoundingBox
– Bounding coordinates
Example:
1pSelfPed = player.get_ped()
2mbbBoundingCoords = scripting.get_entity_bounding_coords(pSelfPed)
3render.draw_box("MyHash", true, mbbBoundingCoords, { 255, 255, 255, 255 }, 1.0)
get_direction_from_rotation(rotation
)
Returns the direction from the specified rotation.
Parameters:
rotation
(Vector3
) – Rotation to use
Returns:
Vector3
– Direction from the rotation
Example:
1pSelfPed = player.get_ped()
2v3Rotation = rage.entity.get_entity_rotation(pSelfPed, 2)
3v3Direction = scripting.get_direction_from_rotation(v3Rotation)
4system.log_debug(tostring(v3Direction.x) .. ", " .. tostring(v3Direction.y) .. ", " .. tostring(v3Direction.z))
Player namespace
This namespace contains functions that are related to player and are used to execute built-in menu features
get_mp_gender()
Returns the player’s character’s gender.
Parameters:
None
Returns:
int
– Gender ID0
- Any non-gender game model1
- Male (mp_male
)2
- Female (mp_female
)
Example:
1iSelfGenderID = player.get_mp_gender()
2system.log_debug("Gender ID: " .. tostring(iSelfGenderID))
set_clean()
Cleans the character.
Parameters:
None
Returns:
None
Example:
1scripting.player.set_clean()
2system.log_debug("Character cleaned.")
set_force_field(toggle
, type
= 0
)
Toggles and configures the force field.
Parameters:
toggle
(bool
) – Toggletrue
to enable the force fieldfalse
to disable it
type
(int
) – Type of the force field0
forNormal
(Default)1
forLethal
Returns:
None
Example:
1scripting.player.set_force_field(true, 1)
2system.log_debug("Lethal force field enabled.")
set_god_mode(toggle
)
Toggles god mode.
Parameters:
toggle
(bool
) – Toggletrue
to enable god modefalse
to disable it
Returns:
None
Example:
1scripting.player.set_god_mode(true)
2system.log_debug("God mode enabled.")
set_infinite_stamina(toggle
)
Toggles infinite stamina.
Parameters:
toggle
(bool
) – Toggletrue
to enable infinite staminafalse
to disable it
Returns:
None
Example:
1scripting.player.set_infinite_stamina(true)
2system.log_debug("Infinite stamina enabled.")
set_invisibility(toggle
)
Toggles invisibility.
Parameters:
toggle
(bool
) – Toggletrue
to enable invisibilityfalse
to disable it
Returns:
None
Example:
1scripting.player.set_invisibility(true)
2system.log_debug("Invisibility enabled.")
set_mobile_radio(toggle
)
Toggles mobile radio.
Parameters:
toggle
(bool
) – Toggletrue
to enable mobile radiofalse
to disable it
Returns:
None
Example:
1scripting.player.set_mobile_radio(true)
2system.log_debug("Mobile radio enabled.")
set_night_vision(toggle
)
Toggles night vision.
Parameters:
toggle
(bool
) – Toggletrue
to enable night visionfalse
to disable it
Returns:
None
Example:
1scripting.player.set_night_vision(true)
2system.log_debug("Night vision enabled.")
set_no_wanted_level()
Sets the wanted level to 0.
Parameters:
None
Returns:
None
Example:
1scripting.player.set_no_wanted_level()
2system.log_debug("Wanted level set to 0.")
set_noclip(toggle
, speed
)
Toggles noclip.
Parameters:
toggle
(bool
) – Toggletrue
to enable noclipfalse
to disable it
speed
(float
) – Speed of the noclip
Returns:
None
Example:
1scripting.player.set_noclip(true, 1.0)
2system.log_debug("Noclip enabled.")
set_ragdoll(toggle
)
Toggles ragdoll.
Parameters:
toggle
(bool
) – Toggletrue
to enable ragdollfalse
to disable it
Returns:
None
Example:
1scripting.player.set_ragdoll(true)
2system.log_debug("Ragdoll enabled.")
set_regeneration(value
)
Sets the regeneration value.
Parameters:
value
(float
) – The regeneration value
Returns:
None
Example:
1scripting.player.set_regeneration(0.5)
2system.log_debug("Regeneration set to 0.5.")
set_run_speed(toggle
, value
)
Toggles and configures the walk & run speed.
Parameters:
toggle
(bool
) – Toggletrue
to enable speed hackfalse
to disable it
value
(float
) – Speed
Returns:
None
Example:
1scripting.player.set_run_speed(true, 1.0)
2system.log_debug("Run speed enabled.")
set_seatbelt(toggle
)
Toggles seatbelt.
Parameters:
toggle
(bool
) – Toggletrue
to enable seatbeltfalse
to disable it
Returns:
None
Example:
1scripting.player.set_seatbelt(true)
2system.log_debug("Seatbelt enabled.")
set_super_run(value
)
Toggles and configures super run mode.
Parameters:
value
(float
) – Speed
Returns:
None
Example:
1scripting.player.set_super_run(4.0)
2system.log_debug("Super run enabled.")
set_swim_speed(toggle
, value
)
Toggles and configures the swim speed.
Parameters:
toggle
(bool
) – Toggletrue
to enable swim hackfalse
to disable it
value
(float
) – Speed
Returns:
None
Example:
1scripting.player.set_swim_speed(true, 4.0)
2system.log_debug("Swim speed enabled.")
set_thermal_vision(toggle
)
Toggles thermal vision.
Parameters:
toggle
(bool
) – Toggletrue
to enable thermal visionfalse
to disable it
Returns:
None
Example:
1scripting.player.set_thermal_vision(true)
2system.log_debug("Thermal vision enabled.")
set_walk_on_air(toggle
)
Toggles walk on air.
Parameters:
toggle
(bool
) – Toggletrue
to enable walk on airfalse
to disable it
set_wanted_level(value
)
Sets the wanted level.
Parameters:
value
(int
) – The wanted level
Returns:
None
Example:
1scripting.player.set_wanted_level(5)
2system.log_debug("Wanted level set to 5.")
Ped namespace
This namespace contains functions that are related to ped and are used to execute built-in menu features
clone_companion(owner
, target
, weaponHash
)
Clones the target ped and sets it as a companion of the owner.
Parameters:
owner
(Entity
) – The owner of the clonetarget
(Entity
) – The target to cloneweaponHash
(Hash
) – The weapon hash to clone with
Returns:
None
Example:
1pSelfPed = player.get_ped()
2scripting.ped.clone_companion(pSelfPed, pSelfPed, rage.gameplay.get_hash_key("weapon_pistol"))
3system.log_debug("Cloned player.")
kill_enemies()
Kills all enemies.
Parameters:
None
Returns:
None
Example:
1scripting.ped.kill_enemies()
2system.log_debug("Killed all enemies.")
kill_nearby_peds()
Kills all nearby peds.
Parameters:
None
Returns:
None
Example:
1scripting.ped.kill_nearby_peds()
2system.log_debug("Killed all nearby peds.")
get_nearby_peds()
Returns the array of the nearby peds’ IDs
Parameters:
None
Returns:
vector<Ped>
– The array of the nearby peds’ IDs
Example:
1vectPeds = scripting.ped.get_nearby_peds()
2for i, ped in ipairs(vectPeds) do
3 system.log_debug("Ped " .. i .. ": " .. ped)
4end
Entity namespace
This namespace contains functions that are related to Entities and are used to execute built-in menu features
is_entity_in_whitelist(entity
)
Note
This function is still in development.
Checks whether the entity is in the whitelist.
Parameters:
entity
(Entity
) – The entity to check
Returns:
bool
true
– The entity is in the whitelistfalse
– The entity is not in the whitelist
Example:
1pSelfPed = player.get_ped()
2bIsInWhitelist = scripting.entity.is_entity_in_whitelist(pSelfPed)
3system.log_debug("Entity is in whitelist: " .. tostring(bIsInWhitelist))
entity_add_to_whitelist(entity
)
Note
This function is still in development.
Adds the entity to the whitelist.
Parameters:
entity
(Entity
) – The entity to add
Returns:
None
Example:
1pSelfPed = player.get_ped()
2scripting.entity.entity_add_to_whitelist(pSelfPed)
3system.log_debug("Entity added to whitelist.")
entity_remove_from_whitelist(entity
)
Note
This function is still in development.
Removes the entity from the whitelist.
Parameters:
entity
(Entity
) – The entity to remove
Returns:
None
Example:
1pSelfPed = player.get_ped()
2scripting.entity.entity_remove_from_whitelist(pSelfPed)
3system.log_debug("Entity removed from whitelist.")
set_proofs(entity
, bulletProof
, fireProof
, explosionProof
, collisionProof
, meleeProof
, drownProof
)
Sets resistance to certain damage.
Parameters:
entity
(Entity
) – The entity to set resistance tobulletProof
(bool
) – Bullet resistancefireProof
(bool
) – Fire resistanceexplosionProof
(bool
) – Explosion resistancecollisionProof
(bool
) – Collision resistancemeleeProof
(bool
) – Melee resistancedrownProof
(bool
) – Drown resistance
Returns:
None
Example:
1pSelfPed = player.get_ped()
2scripting.entity.set_proofs(pSelfPed, true, true, true, true, true, true)
3system.log_debug("Nanomachines, son.")
get_nearby_entities()
Returns the array of the nearby entities’ IDs
Parameters:
None
Returns:
vector<Entity>
– The array of the nearby entities’ IDs
Example:
1vectEntities = scripting.entity.get_nearby_entities()
2for i, entity in ipairs(vectEntities) do
3 system.log_debug("Entity " .. i .. ": " .. entity)
4end
Vehicle namespace
This namespace contains functions that are related to vehicle mods and are used to execute built-in menu features
get_name_from_hash(hash
)
Returns the name of the vehicle based on its hash.
Parameters:
hash
(Hash
) – The hash of the vehicle
Returns:
string
– The name of the vehicle
Example:
1uBMXHash = rage.gameplay.get_hash_key("BMX")
2sVehicleName = scripting.vehicle.get_name_from_hash(uBMXHash)
3system.log_debug("Vehicle name: " .. sVehicleName)
get_personal_vehicle()
Returns the personal vehicle ID.
Parameters:
None
Returns:
Vehicle
– The personal vehicle ID
Example:
1vPersonalVehicle = scripting.vehicle.get_personal_vehicle()
2system.log_debug("Personal vehicle: " .. tostring(vPersonalVehicle))
remove_nearby_vehicles()
Removes all nearby vehicles.
Parameters:
None
Returns:
None
Example:
1scripting.vehicle.remove_nearby_vehicles()
2system.log_debug("Removed all nearby vehicles.")
set_air_vehicles_collision(toggle
)
Sets the air vehicles collision.
Parameters:
toggle
(bool
) – Toggletrue
– Enable the air vehicles collisionfalse
– Disable the air vehicles collision
Returns:
None
Example:
1scripting.vehicle.set_air_vehicles_collision(true)
2system.log_debug("Air vehicles collision is now enabled.")
set_boost(vehicle
, speed
)
Sets the boost speed of the specified vehicle.
Parameters:
vehicle
(Vehicle
) – The vehicle to set the boost speed ofspeed
(float
) – The boost speed
Returns:
None
Example:
1vCurrentVehicle = player.get_vehicle()
2scripting.vehicle.set_boost(vCurrentVehicle, 50)
3system.log_debug("Boost speed set to 50 units.")
set_bulletproof_tires(toggle
)
Sets the bulletproof tires.
Parameters:
toggle
(bool
) – Toggletrue
– Enable the bulletproof tiresfalse
– Disable the bulletproof tires
Returns:
None
Example:
1scripting.vehicle.set_bulletproof_tires(true)
2system.log_debug("Bulletproof tires are now enabled.")
set_clean(vehicle
)
Cleans the specified vehicle.
Parameters:
vehicle
(Vehicle
) – The vehicle to clean
Returns:
None
Example:
1vCurrentVehicle = player.get_vehicle()
2scripting.vehicle.set_clean(vCurrentVehicle)
3system.log_debug("Vehicle cleaned.")
set_doors_opened(vehicle
, toggle
, doorId
)
Opens or closes the doors of the specified vehicle.
Parameters:
vehicle
(Vehicle
) – The vehicle to open or close the doors oftoggle
(bool
) – Toggletrue
– Open the doorsfalse
– Close the doors
doorId (
int
) – The door IDFor door IDs, see this: Doors Index
Returns:
None
Example:
1vCurrentVehicle = player.get_vehicle()
2scripting.vehicle.set_doors_opened(vCurrentVehicle, true, 0)
3system.log_debug("Door opened.")
set_drift(toggle
)
Toggles the drift mode.
Parameters:
toggle
(bool
) – Toggletrue
– Enable the drift modefalse
– Disable the drift mode
Returns:
None
Example:
1scripting.vehicle.set_drift(true)
2system.log_debug("Drift mode is now enabled.")
set_drive_on_air(vehicle
, toggle
)
Toggles the Drive on Air mode.
Parameters:
vehicle
(Vehicle
) – The vehicle to toggle the Drive on Air mode oftoggle
(bool
) – Toggletrue
– Enable the Drive on Air modefalse
– Disable the Drive on Air mode
Returns:
None
Example:
1vCurrentVehicle = player.get_vehicle()
2scripting.vehicle.set_drive_on_air(vCurrentVehicle, true)
3system.log_debug("Drive on Air mode is now enabled.")
set_force_jump(toggle
)
Toggles the vehicle force jump mode.
Parameters:
toggle
(bool
) – Toggletrue
– Enable the force jump modefalse
– Disable the force jump mode
Returns:
None
Example:
1scripting.vehicle.set_force_jump(true)
2system.log_debug("Force jump mode is now enabled.")
set_god_mode(toggle
)
Toggles the god mode for the vehicle.
Parameters:
toggle
(bool
) – Toggletrue
– Enable the god modefalse
– Disable the god mode
Returns:
None
Example:
1scripting.vehicle.set_god_mode(true)
2system.log_debug("God mode is now enabled.")
set_headlight_color(color
)
Sets the headlight color of the specified vehicle.
Parameters:
color
(int
) – The headlight color IDFor color IDs, see this: things/headlightcolor
Returns:
None
Example:
1scripting.vehicle.set_headlight_color(1)
2system.log_debug("Headlight color set to white.")
set_license_plate_madness(toggle
)
Toggle license plate madness.
Parameters:
toggle
(bool
) – Toggletrue
– Toggle license plate madness onfalse
– Toggle license plate madness off
Returns:
None
Example:
1scripting.vehicle.set_license_plate_madness(true)
set_license_plate_scrolling(toggle
)
Toggle license plate scrolling.
Parameters:
toggle
(bool
) – Toggletrue
– Toggle license plate scrolling onfalse
– Toggle license plate scrolling off
Returns:
None
Example:
1scripting.vehicle.set_license_plate_scrolling(true)
set_license_plate_speedo(toggle
)
Toggle license plate speedo mode.
Parameters:
toggle
(bool
)true
– Toggle license plate speedo onfalse
– Toggle license plate speedo off
Returns:
None
Example:
1scripting.vehicle.set_license_plate_speedo(true)
set_rainbow_car(type
)
Toggle rainbow car mode.
Parameters:
type
(eRainbowCarType
) – Car type0
– Personal car1
– All cars
Returns:
None
Example:
1scripting.vehicle.set_rainbow_car(1) -- Sets all cars rainbow
set_rainbow_headlights()
Toggle rainbow headlights feature.
Parameters:
None
Returns:
None
Example:
1scripting.vehicle.set_rainbow_headlights()
set_rainbow_neon()
Toggle rainbow neon feature.
Parameters:
None
Returns:
None
Example:
1scripting.vehicle.set_rainbow_neon()
set_rainbow_tires_smoke()
Toggle rainbow tires smoke.
Parameters:
None
Returns:
None
Example:
1scripting.vehicle.set_rainbow_tires_smoke()
set_repair()
Repairs vehicle.
Parameters:
None
Returns:
None
Example:
1scripting.vehicle.set_repair()
set_stick_to_ground()
Make a vehicle stick to the ground.
Parameters:
None
Returns:
None
Example:
1scripting.vehicle.set_stick_to_ground()
set_stop(vehicle
)
Make a vehicle stop.
Parameters:
vehicle
(Vehicle
) – Vehicle hash
Returns:
None
Example:
1vCurrentVehicle = player.get_vehicle()
2
3scripting.vehicle.set_stop(vCurrentVehicle)
set_vehicle_clean_upgrade(vehicle
)
Make a vehicle be max upgraded (only non-visible parts eg. engine, turbo…)
Parameters:
vehicle
(Vehicle
) – Vehicle hash
Returns:
None
Example:
1vCurrentVehicle = player.get_vehicle()
2
3scripting.vehicle.set_vehicle_clean_upgrade(vCurrentVehicle)
set_vehicle_color(v
, primary
, secondary
, pearl
, wheel
)
Set vehicle color (primary, secondary, pearlescence, wheels)
Parameters:
v
(Vehicle
) – Vehicle hashprimary
(int
) – Primary color IDsecondary
(int
) – Secondary color IDpearl
(int
) – Pearlescence color ID (if applicable)wheel
(int
) – Wheel color ID
Returns:
None
Example:
1vCurrentVehicle = player.get_vehicle()
2
3scripting.vehicle.set_vehicle_color(vCurrentVehicle, 12, 28, 12)
set_vehicle_max_upgrade(vehicle
)
Make a vehicle be max upgraded.
Parameters:
vehicle
(Vehicle
) – Vehicle hash
Returns:
None
Example:
1vCurrentVehicle = player.get_vehicle()
2
3scripting.vehicle.set_vehicle_max_upgrade(vCurrentVehicle)
set_waterproof(vehicle
, toggle
)
Set a vehicle waterproof.
Parameters:
vehicle
(Vehicle
) – Vehicle hashtoggle
(bool
) – Toggle waterproof on/offtrue
– Vehicle is waterprooffalse
– Vehicle is not waterproof
Returns:
None
Example:
1vCurrentVehicle = player.get_vehicle()
2
3scripting.vehicle.set_waterproof(vCurrentVehicle, true) -- Your vehicle can now swim
set_windows_opened(vehicle
, toggle
, windowId
)
Set windows opened on a vehicle.
Parameters:
vehicle
(Vehicle
) – Vehicle hashtoggle
(bool
) – Toggle windows open/closedtrue
– Windows openfalse
– Windows closed
windowId
(int
) – Window ID to manipulateFor window IDs, see this: Windows Index
Returns:
None
Example:
1vCurrentVehicle = player.get_vehicle()
2
3scripting.vehicle.set_windows_opened(vCurrentVehicle, true, 1)
get_nearby_vehicles()
Returns the array of the nearby vehicles’ IDs
Parameters:
None
Returns:
vector<Vehicle>
– Array of nearby vehicles’ IDs
Example:
1vectVehicles = scripting.vehicle.get_nearby_vehicles()
2for i, veh in ipairs(vectVehicles) do
3 system.log_debug("Vehicle " .. i .. ": " .. veh)
4end
Online namespace
This namespace contains functions that are related to online features and are used to execute built-in menu features
reset_idle_kick_timer()
Resets the AFK kick timer.
Parameters:
None
Returns:
None
Example:
1scripting.online.reset_idle_kick_timer()
2system.log_debug("Reset AFK kick timer.")
set_off_radar(toggle
)
Toggle the off radar feature.
Parameters:
toggle
(bool
) – Toggle the off radar featuretrue
– Enable the off radar featurefalse
– Disable the off radar feature
Returns:
None
Example:
1scripting.online.set_off_radar(true)
2system.log_debug("Off radar enabled.")
set_passive_mode(toggle
)
Toggle the passive mode.
Parameters:
toggle
(bool
) – Toggle the passive modetrue
– Enable the passive modefalse
– Disable the passive mode
Returns:
None
Example:
1scripting.online.set_passive_mode(true)
2system.log_debug("Passive mode enabled.")
set_securoserv_bypass()
Activates the securoserv bypass.
Parameters:
None
Returns:
None
Example:
1scripting.online.set_securoserv_bypass()
2system.log_debug("Securoserv bypass activated.")
set_skip_cutscene()
Activates the skip cutscene feature.
Parameters:
None
Returns:
None
Example:
1scripting.online.set_skip_cutscene()
2system.log_debug("Skip cutscene activated.")
set_spectating_mode(toggle
, player
)
Toggle and configure the spectating mode.
Parameters:
toggle
(bool
) – Toggle the spectating modetrue
– Enable the spectating modefalse
– Disable the spectating mode
player
(Player
) – The player to spectate
Returns:
None
Example:
1plHostPlayer = lobby.get_host()
2scripting.online.set_spectating_mode(true, plHostPlayer)
3system.log_debug("Spectating mode enabled.")
suicide()
Kills the player.
Parameters:
None
Returns:
None
Example:
1scripting.online.suicide()
2system.log_debug("RIP, " .. rage.player.get_player_name(rage.player.player_id()))
teleport_in_player_vehicle(player
)
Teleports the player into specified player’s vehicle.
Parameters:
player
(Player
) – The player to teleport to
Returns:
None
Example:
1plHostPlayer = lobby.get_host()
2scripting.online.teleport_in_player_vehicle(plHostPlayer)
3system.log_debug("Teleported into host's vehicle.")
teleport_to_player(player
)
Teleports the player to specified player.
Parameters:
player
(Player
) – The player to teleport to
Returns:
None
Example:
1plHostPlayer = lobby.get_host()
2scripting.online.teleport_to_player(plHostPlayer)
3system.log_debug("Teleported to host.")
toggle_protex(toggle
)
Toggle the online protections.
Parameters:
toggle
(bool
) – Toggle the online protectionstrue
– Enable the online protectionsfalse
– Disable the online protections
Returns:
None
Example:
1scripting.online.toggle_protex(true)
2system.log_debug("Online protections enabled.")
Network namespace
This namespace contains functions that are related to session creation and are used to execute built-in menu features.
session_choose_character()
Sends the player to the character selection screen.
Parameters:
None
Returns:
None
Example:
1scripting.network.session_choose_character()
2system.log_debug("Sent to character selection screen.")
session_leave_online()
Sends the player to the singleplayer mode.
Parameters:
None
Returns:
None
Example:
1scripting.network.session_leave_online()
2system.log_debug("Sent to singleplayer mode.")
session_manager(id
)
Sends the player to the specified session.
Parameters:
id
(eSessionType
) – The session to send the player toRead more about eSessionType here – eSessionType
Returns:
None
Example:
1scripting.network.session_manager(0)
2system.log_debug("Sent to the open public session.")
Spawn namespace
This namespace contains functions that are related to spawn and are used to execute built-in menu features.
spawn_vehicle(hash
, position
, heading
)
Spawns a vehicle in a given position and heading.
Parameters:
hash
(Hash
) – Vehicle hashposition
(Vector3
) – Vehicle coordinatesheading
(float
) – Vehicle heading
Returns:
Vehicle
– The spawned vehicle handle.
Example:
1uZentornoHash = rage.gameplay.get_hash_key("ZENTORNO")
2v3CurrentCoords = player.get_coords()
3
4scripting.spawn.spawn_vehicle(uZentornoHash, v3CurrentCoords, 1)
spawn_vehicle_personal(hash
)
Spawns a personal vehicle.
Parameters:
hash
(Hash
) – Vehicle hash
Returns:
Vehicle
– The spawned vehicle handle.
Example:
1uZentornoHash = rage.gameplay.get_hash_key("ZENTORNO")
2scripting.spawn.spawn_vehicle_personal(uZentornoHash)
Weapon namespace
This namespace contains functions that are related to weapons and are used to execute built-in menu features.
give_all_weapons(ped
, maxAmmo
= true
, maxComponents
= true
)
Give all weapons to a ped with toggable max ammo and max components.
Parameters:
ped
(Ped
) – The ped to give all weapons to.maxAmmo
(bool
) – Toggle Max Ammotrue
– Weapons will be given with max ammo (default)false
– Weapons will be given without max ammo
maxComponents
– Toggles Max Componentstrue
– Weapons will be given fully upgraded in components (default)false
– Weapons will be given in their default form
Returns:
None
Example:
1pSelfPed = player.get_ped()
2
3scripting.weapon.give_all_weapons(pSelfPed, true, true) -- Gives all maxed and upgraded weapons.
remove_all_weapons_from_ped(ped
)
Removes all weapons from a ped.
Parameters:
ped
(Ped
) – The ped to remove all weapons from.
Returns:
None
Example:
1pSelfPed = player.get_ped()
2
3scripting.weapon.remove_all_weapons_from_ped(pSelfPed) -- Removes all weapons
give_weapon_self(weaponHash
)
Gives weapon to the player (self).
Parameters:
weaponHash
(Hash
) – Weapon Whash to give to self.
Returns:
None
Example:
1uWeaponHash = rage.gameplay.get_hash_key("weapon_microsmg")
2
3scripting.weapon.give_weapon_self(uWeaponHash) -- Gives self the MicroSMG
give_weapon(ped
, weaponHash
, maxAmmo
= true
, maxComponents
= true
)
Gives a weapon to ped with toggable max ammo and max components.
Parameters:
ped
(Ped
) – The ped to give the weapon to.weaponHash
(Hash
) – Weapon Whash to give to the player.maxAmmo
(bool
) – Toggles Max Ammotrue
– Weapon will be given with max ammo (default)false
– Weapon will be given without max ammo
maxComponents
– Toggles Max Componentstrue
– Weapon will be given fully upgraded in components (default)false
– Weapon will be given in its default form
Returns:
None
Example:
1uWeaponHash = rage.gameplay.get_hash_key("weapon_microsmg")
2
3pSelfPed = player.get_ped()
4
5scripting.weapon.give_weapon(pSelfPed, uWeaponHash, true, true) -- Gives session host a fully loaded and upgraded MicroSMG
give_ammo(ped
)
Gives ammo to a ped.
Parameters:
ped
(Ped
) – The ped to ammo to.
Returns:
None
Example:
1pSelfPed = player.get_ped()
2
3scripting.weapon.give_ammo(pSelfPed) -- Gives ammo to all your weapons
give_ammo_for_weapon(ped
, weaponHash
)
Gives ammo for a precise weapon to a ped.
Parameters:
ped
(Ped
) – The targeted ped.weaponHash
(Hash
) – Ped’s weapon Whash to give ammo to.
Returns:
None
Example:
1pSelfPed = player.get_ped()
2
3uWeaponHash = rage.gameplay.get_hash_key("weapon_microsmg")
4
5scripting.weapon.give_ammo_for_weapon(pSelfPed, uWeaponHash) -- Gives ammo to your MicroSMG
ammo_infinite(ped
)
Gives infinite ammo to a ped.
Parameters:
ped
(Ped
) – The targeted ped.
Returns:
None
Example:
1pSelfPed = player.get_ped()
2scripting.weapon.ammo_infinite(pSelfPed) -- Gives infinite ammo
ammo_enhanced(ped
, explosionId
)
Gives enhanced ammo (ammo that generates a particular explosion) to a ped.
Parameters:
ped
(Ped
) – The targeted ped.explosionId
(int
) – The explosion ID determinates the type of explosion to assign to the ammo.You can read more about explosion IDs here: Explosion types
Returns:
None
Example:
1pSelfPed = player.get_ped()
2scripting.weapon.ammo_enhanced(pSelfPed, 7) -- Sets EXPLOSION_CAR explosion type for ammo
ammo_mega_damage(ped
)
Gives mega damage ammo to a ped.
Parameters:
ped
(Ped
) – The targeted ped.
Returns:
None
Example:
1pSelfPed = player.get_ped()
2
3scripting.weapon.ammo_mega_damage(pSelfPed) -- Gives mega damage ammo
Teleport namespace
This namespace contains functions that are related to teleport and are used to execute built-in menu features.
to_blip(sprite
, color
= -1
)
Teleport to blip.
Parameters:
sprite
(int
) – The blip sprite ID to use.color
(int
) – The blip color ID to use.-1
to use the default color
Returns:
bool
true
– Teleportation successfulfalse
– Teleportation failed
Example:
1scripting.teleport.to_blip(1, 1) -- red circle blip
to_entity(ent
)
Teleport to entity.
Parameters:
ent
(Entity
) – Targeted entity to teleport to.
Returns:
bool
true
– Teleportation successfulfalse
– Teleportation failed
Example:
1scripting.teleport.to_entity("prop_storagetank_02b") -- Teleport to the nearest fuel storage tank entity.
to_player(player
)
Teleport to player.
Parameters:
player
(Player
) – Targeted player to teleport to.
Returns:
bool
true
– Teleportation successfulfalse
– Teleportation failed
Example:
1scripting.teleport.to_player(lobby.get_host()) -- Teleport to the host player.
to_position(coords
)
Teleport to position (through coordinates).
Parameters:
coords
(Vector3
) – Targeted coordinates (Vector3) to teleport to.
Returns:
bool
true
– Teleportation successfulfalse
– Teleportation failed
Example:
1scripting.teleport.to_position(lobby.get_player_coords(lobby.get_host())) -- Teleport to the host player's coordinates.
to_waypoint()
Teleport to waypoint.
Parameters:
None
Returns:
bool
true
– Teleportation successfulfalse
– Teleportation failed
Example:
1scripting.teleport.to_waypoint()
to_objective()
Teleport to objective.
Parameters:
None
Returns:
bool
true
– Teleportation successfulfalse
– Teleportation failed
Example:
1scripting.teleport.to_objective()
to_nearest_vehicle()
Teleport to the nearest vehicle.
Parameters:
None
Returns:
bool
true
– Teleportation successfulfalse
– Teleportation failed
Example:
1scripting.teleport.to_nearest_vehicle()
to_personal_vehicle()
Teleport to personal vehicle.
Parameters:
None
Returns:
None
Example:
1scripting.teleport.to_personal_vehicle()
ipl_to_yankton()
Teleport to North Yankton (IPL location).
Parameters:
None
Returns:
None
Example:
1scripting.teleport.ipl_to_yankton()
ipl_to_cargo_ship()
Teleport to Cargo Ship (IPL location).
Parameters:
None
Returns:
None
Example:
1scripting.teleport.ipl_to_cargo_ship()
ipl_to_hospital()
Teleport to Hospital (IPL location).
Parameters:
None
Returns:
None
Example:
1scripting.teleport.ipl_to_hospital()
ipl_to_yacht_sp()
Teleport to SinglePlayer Yacht (IPL location).
Parameters:
None
Returns:
None
Example:
1scripting.teleport.ipl_to_yacht_sp()
ipl_to_yacht_online()
Teleport to Online Yacht (IPL location).
Parameters:
None
Returns:
None
Example:
1scripting.teleport.ipl_to_yacht_online()
ipl_to_morgue()
Teleport to Morgue (IPL location).
Parameters:
None
Returns:
None
Example:
1scripting.teleport.ipl_to_morgue()
ipl_to_ranch()
Teleport to Ranch (IPL location).
Parameters:
None
Returns:
None
Example:
1scripting.teleport.ipl_to_ranch()
ipl_to_jewelry()
Teleport to Jewelry (IPL location).
Parameters:
None
Returns:
None
Example:
1scripting.teleport.ipl_to_jewelry()
ipl_to_life_invader()
Teleport to Life Invader (IPL location).
Parameters:
None
Returns:
None
Example:
1scripting.teleport.ipl_to_life_invader()
ipl_to_fib()
Teleport to FIB building (IPL location).
Parameters:
None
Returns:
None
Example:
1scripting.teleport.ipl_to_fib()
World namespace
This namespace contains functions that are related to world and are used to execute built-in menu features.
set_weather(weatherType
)
Set weather type.
Parameters:
weatherType
(string
) – The weather typeFor weather types, see this: Weather Types
Returns:
None
Example:
1scripting.world.set_weather("RAIN") -- make it rain
set_clouds(cloudsType
, transitionTime
)
Set clouds type and their transition time.
Parameters:
cloudsType
(string
) – The clouds typeFor weather types, see this: Weather Types
transitionTime
(float
) – The speed of clouds
Returns:
None
Example:
1scripting.world.set_clouds("RAIN")
set_rain_intensity(value
)
Set the rain intensity.
Parameters:
value
(float
) – Rain intensity value.
Returns:
None
Example:
1scripting.world.set_rain_intensity(5.5)
set_wind_speed(value
)
Set the wind speed.
Parameters:
value
(float
) – Wind speed value.
Returns:
None
Example:
1scripting.world.set_wind_speed(3)
set_waves_height(value
)
Set the waves height.
Parameters:
value
(float
) – Waves height value.
Returns:
None
Example:
1scripting.world.set_waves_height(4)
set_time(hours
, minutes
, seconds
)
Set the in-game time.
Parameters:
hours
(int
) – Hoursminutes
(int
) – Minutesseconds
(int
) – Seconds
Returns:
None
Example:
1scripting.world.set_time(12, 30, 10) -- 12:30:10
blackout(toggle
)
Toggle blackout on/off.
Parameters:
toggle
(bool
) – Toggletrue
– Toggle blackout onfalse
– Toggle blackout off
Returns:
None
Example:
1scripting.world.blackout(true) -- Blackout is on.
angry_ufo()
Activates Angry Ufo feature.
Parameters:
None
Returns:
None
Example:
1scripting.world.angry_ufo()
disable_phone(toggle
)
Disable phone option
Parameters:
toggle
(bool
) – Toggletrue
– Toggle disable phone onfalse
– Toggle disable phone off
Returns:
None
Example:
1scripting.world.disable_phone(true) -- Disable phone option toggled on, phone is disabled.
disable_recording()
Disable GTA built-in recording feature.
Parameters:
None
Returns:
None
Example:
1scripting.world.disable_recording() -- Disable recording
disable_restricted_areas()
Disable GTA restricted areas.
Parameters:
None
Returns:
None
Example:
1scripting.world.disable_restricted_areas()
disable_stunt_cameras()
Disable GTA built-in stunt cameras.
Parameters:
None
Returns:
None
Example:
1scripting.world.disable_stunt_cameras()
RAGE Functions
This namespace contains native game functions. Use WIP New RAGE API for rage functions, as these are obsolete and only kept here just in case.
Player namespace
Functions here
This namespace contains player-related game functions.
get_player_group(player
)
Returns the group ID the player is member of. Used for AI namespace.
Parameters:
player
(Player
) – The player ID
Returns:
int
– Group ID
Example:
1plHandle = rage.player.player_id()
2iPlayerGroup = rage.player.get_player_group(plHandle)
3system.log_debug("Player is member of group: " .. tostring(iPlayerGroup))
get_player_name(player
)
Returns the player name.
Parameters:
player
(Player
) – The player ID
Returns:
string
– Player name
Example:
1plHandle = rage.player.player_id()
2sPlayerName = rage.player.get_player_name(plHandle)
3system.log_debug("Player name: " .. tostring(sPlayerName))
get_player_parachute_model_override(player
)
Returns the hash of the parachute model.
Parameters:
player
(Player
) – The player ID
Returns:
Hash
– Parachute model hash
Example:
1plHandle = rage.player.player_id()
2uPlayerParachuteModel = rage.player.get_player_parachute_model_override(plHandle)
3system.log_debug("Player parachute model hash: " .. tostring(uPlayerParachuteModel))
get_player_ped_script_index(player
)
Returns the Ped ID of the player’s character.
Parameters:
player
(Player
) – The player ID
Returns:
Ped
– Ped ID
Example:
1plHandle = rage.player.player_id()
2pSelfPed = rage.player.get_player_ped_script_index(plHandle)
3system.log_debug("Player ped: " .. tostring(pSelfPed))
get_player_team(player
)
Returns the team ID the player is member of. Almost like get_player_team(player).
Note
Doesn’t work in singleplayer.
Parameters:
player
(Player
) – The player ID
Returns:
int
– Team ID
Example:
1plHandle = rage.player.player_id()
2iPlayerTeam = rage.player.get_player_team(plHandle)
3system.log_debug("Player is member of team: " .. tostring(iPlayerTeam))
get_player_wanted_level(player
)
Returns the player’s wanted level.
Parameters:
player
(Player
) – The player ID
Returns:
int
– Wanted level
Example:
1plHandle = rage.player.player_id()
2iPlayerWantedLevel = rage.player.get_player_wanted_level1(plHandle)
3system.log_debug("Player wanted level: " .. tostring(iPlayerWantedLevel))
is_player_free_aiming(player
)
Returns whether the player is aiming.
Parameters:
player
(Player
) – The player ID
Returns:
bool
true
– the player is aimingfalse
– the player is not aiming
Example:
1plHandle = rage.player.player_id()
2if rage.player.is_player_free_aiming(plHandle) then
3 system.log_debug("Player is aiming")
4end
is_player_playing(player
)
Returns whether the wasted/busted screen is visible or not.
Parameters:
player
(Player
) – The player ID
Returns:
bool
true
– the wasted/busted screen is visiblefalse
– the wasted/busted screen is not visible
Example:
1plHandle = rage.player.player_id()
2if rage.player.is_player_playing(plHandle) then
3 system.log_debug("Player is playing")
4end
is_player_pressing_horn(player
)
Checks whether the player is pressing the horn.
Parameters:
player
(Player
) – The player ID
Returns:
bool
true
– Player is pressing the hornfalse
– Player is not pressing the horn
Example:
1plHandle = rage.player.player_id()<