A collection of wrapper functions to handle asset requests in GTA. It simplifies the process of loading models, animations, interiors, textures, and more, ensuring resources are available before use.
Functions
request_model
Load and wait for a specified model to be available.
Function
Copy local function model ( model )
if HasModelLoaded (model) then return end
RequestModel (model)
while not HasModelLoaded (model) do
Wait ( 0 )
end
end
exports ( 'request_model' , model)
utils.requests.model = mode
Example
Copy --- Specify model
local model_hash = GetHashKey ( 'a_m_m_business_01' )
--- Utils object
utils.requests. model (model_hash)
--- Direct export
exports.boii_utils: request_model (model_hash)
request_interior
Request an interior and wait until its ready.
Function
Copy local function interior ( interior )
if IsInteriorReady (interior) then return end
if IsValidInterior (interior) then
LoadInterior (interior)
while not IsInteriorReady (interior) do
Wait ( 0 )
end
end
end
exports ( 'request_interior' , interior)
utils.requests.interior = interior
Example
Copy --- Get interior id
local interior_id = GetInteriorAtCoords ( 440.84 , - 983.14 , 30.69 )
--- Utils object
utils.requests. interior (interior_id)
--- Direct export
exports.boii_utils: request_interior (interior_id)
request_texture
Requests a texture and waits until loaded.
Function
Copy local function texture ( texture , boolean )
if HasStreamedTextureDictLoaded (texture) then return end
RequestStreamedTextureDict (texture, boolean)
if boolean and not HasStreamedTextureDictLoaded (texture) then
Wait ( 150 )
end
end
exports ( 'request_texture' , texture)
utils.requests.texture = texture
Example
Copy --- Specify texture
local texture_dict = 'mpweaponscommon'
--- Utils object
utils.requests. texture (texture_dict, true )
--- Direct export
exports.boii_utils: request_texture (texture_dict, true )
request_collision
Request collision at a location and wait until its loaded.
Function
Copy local function collision ( x , y , z )
if HasCollisionLoadedAroundEntity ( PlayerPedId ()) then return end
RequestCollisionAtCoord (x, y, z)
while not HasCollisionLoadedAroundEntity ( PlayerPedId ()) do
Wait ( 0 )
end
end
exports ( 'request_collision' , collision)
utils.requests.collision = collision
Example
Copy --- Define location
local x, y, z = 440.84 , - 983.14 , 30.69
--- Utils object
utils.requests. collision (x, y, z)
--- Direct export
exports.boii_utils: request_collision (x, y, z)
request_anim
Request animation dictionary and wait until its loaded.
Function
Copy local function request_anim ( dict )
if HasAnimDictLoaded (dict) then return end
RequestAnimDict (dict)
while not HasAnimDictLoaded (dict) do
Wait ( 0 )
end
end
exports ( 'request_anim' , request_anim)
utils.requests.anim = request_anim
Example
Copy --- Specify anim dict
local anim_dict = 'amb@world_human_smoking@male@male_a@base'
--- Utils object
utils.requests. anim (anim_dict)
--- Direct export
exports.boii_utils: request_anim (anim_dict)
request_anim_set
Request animation set and wait until its loaded.
Function
Copy local function request_anim_set ( set )
RequestAnimSet (set)
while not HasAnimSetLoaded (set) do
Wait ( 100 )
end
end
exports ( 'request_anim_set' , request_anim_set)
utils.requests.anim_set = request_anim_set
Example
Copy --- Specify anim set
local anim_set_name = 'move_m@brave'
--- Utils object
utils.requests. anim_set (anim_set_name)
--- Direct export
exports.boii_utils: request_anim_set (anim_set_name)
request_clip_set
Request animation clip set and wait until its loaded.
Function
Copy local function request_clip_set ( clip )
if HasClipSetLoaded (clip) then return end
RequestClipSet (clip)
while not HasClipSetLoaded (clip) do
Wait ( 0 )
end
end
exports ( 'request_clip_set' , request_clip_set)
utils.requests.clip_set = request_clip_set
Example
Copy --- Specify clip set
local anim_clip_set = 'move_m@confident'
--- Utils object
utils.requests. clip_set (clip_set)
--- Direct export
exports.boii_utils: request_clip_set (clip_set)
request_audio_bank
Requests a script audio bank and waits until loaded.
Function
Copy local function request_audio_bank ( audio )
if HasScriptAudioBankLoaded (audio) then return end
RequestScriptAudioBank (audio, false )
while not HasScriptAudioBankLoaded (audio) do
Wait ( 0 )
end
end
exports ( 'request_audio_bank' , request_audio_bank)
utils.requests.audio_bank = request_audio_bank
Example
Copy --- Specify audio bank
local audio_bank = 'DLC_HEIST_HACKING_SNAKE'
--- Utils object
utils.requests. audio_bank (audio_bank)
--- Direct export
exports.boii_utils: request_audio_bank (audio_bank)
request_scaleform_movie
Requests a scaleform movie and waits until loaded.
Function
Copy local function request_scaleform_movie ( scaleform )
if HasScaleformMovieLoaded (scaleform) then return end
local handle = RequestScaleformMovie (scaleform)
while not HasScaleformMovieLoaded (handle) do
Wait ( 0 )
end
return handle
end
exports ( 'request_scaleform_movie' , request_scaleform_movie)
utils.requests.scaleform_movie = request_scaleform_movie
Example
Copy --- Specify scaleform movie
local scaleform = 'instructional_buttons'
--- Utils object
utils.requests. scaleform_movie (scaleform)
--- Direct export
exports.boii_utils: request_scaleform_movie (scaleform)
request_cutscene
Request a cutscene and play once loaded.
Function
Copy local function request_cutscene ( scene )
if HasCutsceneLoaded () then return end
RequestCutscene (scene, 8 )
while not HasCutsceneLoaded () do
Wait ( 0 )
end
end
exports ( 'request_cutscene' , request_cutscene)
utils.requests.cutscene = request_cutscene
Example
Copy --- Specify cutscene
local cutscene_name = 'mp_intro'
--- Utils object
utils.requests. cutscene (cutscene_name)
--- Direct export
exports.boii_utils: request_cutscene (cutscene_name)
request_ipl
Request an IPL and activate it.
Function
Copy local function request_ipl ( str )
if IsIplActive (str) then return end
RequestIpl (str)
while not IsIplActive (str) do
Wait ( 0 )
end
end
exports ( 'request_ipl' , request_ipl)
utils.requests.ipl = request_ipl
Example
Copy --- Specify IPL name
local ipl_name = 'hei_dlc_heist_police_station'
--- utils object
utils.requests. ipl (ipl_name)
--- Direct export
exports.boii_utils: request_ipl (ipl_name)