Skip to content

scripts


_set_player_bit_at_index

void native.scripts._set_player_bit_at_index(ptr int value, int bit_index)


_clear_player_bit_at_index

void native.scripts._clear_player_bit_at_index(ptr int value, int bit_index)


_0xe4abe20dce7c7cfe

void native.scripts._0xe4abe20dce7c7cfe(int p0, int p1, int p2)


_0xffddf802279be128

void native.scripts._0xffddf802279be128(int p0, int p1, int p2)


_0x64f765d9a1f8f02c

void native.scripts._0x64f765d9a1f8f02c(ptr int p0, ptr int p1, ptr int p2)


_set_all_player_bits

void native.scripts._set_all_player_bits(ptr int value)


_clear_all_player_bits

void native.scripts._clear_all_player_bits(ptr int value)


_is_player_bit_set_at_index

bool native.scripts._is_player_bit_set_at_index(ptr int value, int bit_index)


_is_any_player_bit_set

bool native.scripts._is_any_player_bit_set(ptr int player_bits)


get_block_of_player_bits

int native.scripts.get_block_of_player_bits(ptr int value, int p1)


set_block_of_player_bits

void native.scripts.set_block_of_player_bits(ptr int value, int p1, int p2)


count_player_bits

int native.scripts.count_player_bits(ptr int value)


_0x1bdb5a07307f6929

void native.scripts._0x1bdb5a07307f6929(int p0, int p1)


_0x1c5eb3c27f7508cb

void native.scripts._0x1c5eb3c27f7508cb(int p0, int p1)


_0x42a429cdfed6d99d

void native.scripts._0x42a429cdfed6d99d(int p0, int p1, int p2)


_0x5827be85a87b073d

void native.scripts._0x5827be85a87b073d(int p0)


_0x0a79c81c418f5d38

int native.scripts._0x0a79c81c418f5d38(int p0, int p1)


_0xa88e1d7fa1e20080

int native.scripts._0xa88e1d7fa1e20080(int p0)


count_participant_bits

int native.scripts.count_participant_bits(ptr int value)


request_script

void native.scripts.request_script(string script_name)


set_script_as_no_longer_needed

void native.scripts.set_script_as_no_longer_needed(string script_name)


has_script_loaded

bool native.scripts.has_script_loaded(string script_name)

Returns if a script has been loaded into the game. Used to see if a script was loaded after requesting.

does_script_exist

bool native.scripts.does_script_exist(string script_name)


request_script_with_name_hash

void native.scripts.request_script_with_name_hash(int script_hash)


set_script_with_name_hash_as_no_longer_needed

void native.scripts.set_script_with_name_hash_as_no_longer_needed(int script_hash)


has_script_with_name_hash_loaded

bool native.scripts.has_script_with_name_hash_loaded(int script_hash)


does_script_with_name_hash_exist

bool native.scripts.does_script_with_name_hash_exist(int script_hash)


terminate_thread

void native.scripts.terminate_thread(int thread_id)


is_thread_active

bool native.scripts.is_thread_active(int thread_id, bool ignore_killed_state)


does_thread_exist

bool native.scripts.does_thread_exist(int thread_id)


get_thread_existence_details

void native.scripts.get_thread_existence_details(int thread_id, ptr int thread_exists, ptr int has_script_handler)


_get_hash_of_thread

int native.scripts._get_hash_of_thread(int thread_id)


script_thread_iterator_reset

void native.scripts.script_thread_iterator_reset()

Starts a new iteration of the current threads.
Call this first, then SCRIPT_THREAD_ITERATOR_GET_NEXT_THREAD_ID (0x30B4FA1C82DD4B9F)

script_thread_iterator_get_next_thread_id

int native.scripts.script_thread_iterator_get_next_thread_id()

If the function returns 0, the end of the iteration has been reached.

_is_background_script

bool native.scripts._is_background_script(int thread_id)


get_id_of_this_thread

int native.scripts.get_id_of_this_thread()


terminate_this_thread

void native.scripts.terminate_this_thread()


get_number_of_threads_running_the_script_with_this_hash

int native.scripts.get_number_of_threads_running_the_script_with_this_hash(int script_hash)

Gets the number of instances of the specified script is currently running.

Actually returns numRefs - 1.
if (program)
    v3 = rage::scrProgram::GetNumRefs(program) - 1;
return v3;

Old name: _GET_NUMBER_OF_REFERENCES_OF_SCRIPT_WITH_NAME_HASH

_request_thread_exit

void native.scripts._request_thread_exit(int thread_id)


_request_thread_exit_for_all_threads_with_this_name

void native.scripts._request_thread_exit_for_all_threads_with_this_name(int name_hash)


is_thread_exit_requested

bool native.scripts.is_thread_exit_requested()


_is_thread_exit_requested_for_thread_with_this_id

bool native.scripts._is_thread_exit_requested_for_thread_with_this_id(int thread_id)


_get_thread_exit_reason

int native.scripts._get_thread_exit_reason()

enum eThreadExitReason
{
    THREAD_EXIT_REASON_NONE,
    THREAD_EXIT_REASON_BACKGROUND_THREAD_STOPPED,
    THREAD_EXIT_REASON_SESSION_MERGE,
    THREAD_EXIT_REASON_SCENARIO_OUT_OF_SCOPE,
    THREAD_EXIT_REASON_REQUESTED_BY_SCRIPT
};

get_hash_of_this_script_name

int native.scripts.get_hash_of_this_script_name()


get_number_of_events

int native.scripts.get_number_of_events(int event_group)

eventGroup: 0 = SCRIPT_EVENT_QUEUE_AI (CEventGroupScriptAI), 1 = SCRIPT_EVENT_QUEUE_NETWORK (CEventGroupScriptNetwork), 2 = unk, 3 = unk, 4 = SCRIPT_EVENT_QUEUE_ERRORS (CEventGroupScriptErrors)

get_event_exists

bool native.scripts.get_event_exists(int event_group, int event_type)

eventGroup: 0 = SCRIPT_EVENT_QUEUE_AI (CEventGroupScriptAI), 1 = SCRIPT_EVENT_QUEUE_NETWORK (CEventGroupScriptNetwork), 2 = unk, 3 = unk, 4 = SCRIPT_EVENT_QUEUE_SCRIPT_ERRORS (CEventGroupScriptErrors)

get_event_at_index

int native.scripts.get_event_at_index(int event_group, int event_index)

eventGroup: 0 = SCRIPT_EVENT_QUEUE_AI (CEventGroupScriptAI), 1 = SCRIPT_EVENT_QUEUE_NETWORK (CEventGroupScriptNetwork), 2 = unk, 3 = unk, 4 = SCRIPT_EVENT_QUEUE_SCRIPT_ERRORS (CEventGroupScriptErrors)

Returns event name hash: https://alloc8or.re/rdr3/doc/enums/eEventType.txt

get_event_data

bool native.scripts.get_event_data(int event_group, int event_index, ptr int event_data, int event_data_size)

eventGroup: 0 = SCRIPT_EVENT_QUEUE_AI (CEventGroupScriptAI), 1 = SCRIPT_EVENT_QUEUE_NETWORK (CEventGroupScriptNetwork), 2 = unk, 3 = unk, 4 = SCRIPT_EVENT_QUEUE_SCRIPT_ERRORS (CEventGroupScriptErrors)

Note: eventDataSize is NOT the size in bytes, it is the size determined by the SIZE_OF operator (RAGE Script operator, not C/C++ sizeof). That is, the size in bytes divided by 8 (script variables are always 8-byte aligned!).

https://github.com/femga/rdr3_discoveries/tree/master/AI/EVENTS

set_event_flag_for_deletion

void native.scripts.set_event_flag_for_deletion(int event_group, int event_index, bool p2)


trigger_script_event

void native.scripts.trigger_script_event(int event_group, ptr int event_data, int event_data_size, int script_metadata_index, ptr int player_bits)

eventGroup: 0 = SCRIPT_EVENT_QUEUE_AI (CEventGroupScriptAI), 1 = SCRIPT_EVENT_QUEUE_NETWORK (CEventGroupScriptNetwork), 2 = unk, 3 = unk, 4 = SCRIPT_EVENT_QUEUE_SCRIPT_ERRORS (CEventGroupScriptErrors)

Note: eventDataSize is NOT the size in bytes, it is the size determined by the SIZE_OF operator (RAGE Script operator, not C/C++ sizeof). That is, the size in bytes divided by 8 (script variables are always 8-byte aligned!).

playerBits (also known as playersToBroadcastTo) is a bitset that indicates which players this event should be sent to. In order to send the event to specific players only, use (1 << playerIndex). Set all bits if it should be broadcast to all players.

_trigger_script_event_2

void native.scripts._trigger_script_event_2(ptr int event_data, int event_data_size, int script_metadata_index, int thread_id)


_0xe7282390542f570d

int native.scripts._0xe7282390542f570d(int p0)


_0x11b0a0b282fa9b10

void native.scripts._0x11b0a0b282fa9b10(bool p0)

Used in Script Function DISABLE_REGISTERED_WORLD_BRAINS

_0x6f700a4bf7c3331b

void native.scripts._0x6f700a4bf7c3331b(bool p0)


_0xf9e951a1e5517c06

void native.scripts._0xf9e951a1e5517c06()


_0x76cbcd9eadc00955

void native.scripts._0x76cbcd9eadc00955()


shutdown_loading_screen

void native.scripts.shutdown_loading_screen()


set_no_loading_screen

void native.scripts.set_no_loading_screen(bool toggle)


get_no_loading_screen

bool native.scripts.get_no_loading_screen()


_display_loading_screens

void native.scripts._display_loading_screens(int p0, int p1, int p2, string gamemode_name, string title, string subtitle)


_0x29fb4ce89472c3cb

void native.scripts._0x29fb4ce89472c3cb(int p0, int p1, float p2, float p3, string p4, string p5, string p6, int p7)


stop_displaying_mp_transition_loading_screens

void native.scripts.stop_displaying_mp_transition_loading_screens(int p0)


is_loading_screen_visible

bool native.scripts.is_loading_screen_visible()

Same as GET_IS_LOADING_SCREEN_ACTIVE

bail_to_landing_page

void native.scripts.bail_to_landing_page(int bail_code)


bail_with_pass_through_params

void native.scripts.bail_with_pass_through_params(string params)


bg_is_exitflag_set

bool native.scripts.bg_is_exitflag_set()

Returns true if GtaThread+0x77C is equal to 1.

Old name: _BG_EXITED_BECAUSE_BACKGROUND_THREAD_STOPPED

bg_set_exitflag_response

void native.scripts.bg_set_exitflag_response()

Sets bit 0 in GtaThread+0x784

bg_start_context_hash

void native.scripts.bg_start_context_hash(int context_hash)

Hashed version of BG_START_CONTEXT

bg_end_context_hash

void native.scripts.bg_end_context_hash(int context_hash)

Hashed version of BG_END_CONTEXT

bg_start_context

void native.scripts.bg_start_context(string context_name)

Inserts the given context into the background scripts context map.

bg_end_context

void native.scripts.bg_end_context(string context_name)

Deletes the given context from the background scripts context map.

bg_does_launch_param_exist

bool native.scripts.bg_does_launch_param_exist(int script_index, string p1)


bg_get_launch_param_value

int native.scripts.bg_get_launch_param_value(int script_index, string p1)


bg_get_script_id_from_name_hash

int native.scripts.bg_get_script_id_from_name_hash(int p0)


_bg_reload_all_background_scripts

void native.scripts._bg_reload_all_background_scripts()


_activate_goal_context

void native.scripts._activate_goal_context(int goal_context)

goalContext: see <availableContexts> in common/data/stats_and_challenges/goals_*.meta

_deactivate_goal_context

void native.scripts._deactivate_goal_context(int goal_context)

goalContext: see _ACTIVATE_GOAL_CONTEXT

_is_goal_context_active

bool native.scripts._is_goal_context_active(int goal_context)

goalContext: see _ACTIVATE_GOAL_CONTEXT

_net_rpc_guid_to_string

string native.scripts._net_rpc_guid_to_string(ptr int net_rpc_guid)

Returns "INVALID_NET_RPC_GUID" if netRpcGuid is invalid.

awards_get_result_item

bool native.scripts.awards_get_result_item(ptr int rpc_guid, int award_hash, int item_index, ptr int out_result_item)


_awards_get_unlock_claim_data

bool native.scripts._awards_get_unlock_claim_data(ptr int rpc_guid, int award_hash, int data_index, ptr int out_unlock_data)


_loot_get_result_item

bool native.scripts._loot_get_result_item(ptr int rpc_guid, int item_index, ptr int out_result_item)


_loot_get_loot_claim_data

bool native.scripts._loot_get_loot_claim_data(ptr int rpc_guid, int data_index, ptr int out_loot_data)


_store_global_block

bool native.scripts._store_global_block(int index)


_restore_global_block

bool native.scripts._restore_global_block(int index)


_does_compressed_global_block_buffer_exist

bool native.scripts._does_compressed_global_block_buffer_exist(int index)


_set_global_block_can_be_accessed

void native.scripts._set_global_block_can_be_accessed(int index, bool toggle)


_get_global_block_can_be_accessed

bool native.scripts._get_global_block_can_be_accessed(int index)


_set_all_global_blocks_have_been_loaded

void native.scripts._set_all_global_blocks_have_been_loaded(bool toggle)


have_all_child_scripts_terminated

bool native.scripts.have_all_child_scripts_terminated(int p0)

Waiting for child scripts to terminate / waiting for collapse of child scripts

start_new_script

int native.scripts.start_new_script(string script_name, int stack_size)


start_new_script_with_args

int native.scripts.start_new_script_with_args(string script_name, ptr int args, int arg_count, int stack_size)

return : script thread id, 0 if failed
Pass pointer to struct of args in p1, size of struct goes into p2

start_new_script_with_name_hash

int native.scripts.start_new_script_with_name_hash(int script_hash, int stack_size)


start_new_script_with_name_hash_and_args

int native.scripts.start_new_script_with_name_hash_and_args(int script_hash, ptr int args, int arg_count, int stack_size)