RequestModel
DocsRequestModel(model)Description
Request a model (archetype) to be loaded for use by the current script. Use SET_MODEL_AS_NO_LONGER_NEEDED when done using the model in script.
Parameters
| Name | Type | Description |
|---|---|---|
model | Hash | The model to request. |
Quick Snippet: Load Model Hashmodel
modelModels must be loaded before use. This snippet handles requesting and releasing properly.
-- Properly load a model before spawning/using it
local modelName = "prop_barrel_01a" -- change to your model
local modelHash = GetHashKey(modelName)
RequestModel(modelHash)
while not HasModelLoaded(modelHash) do
Wait(0)
end
print("Model loaded: " .. modelName .. " (" .. modelHash .. ")")
-- Release when done:
-- SetModelAsNoLongerNeeded(modelHash)Returns
voidThis native does not return a value.
Examples
Official
local modelHash = `adder`
RequestModel(modelHash)
while not HasModelLoaded(modelHash) do
Wait(0)
end
-- omitted: creating a vehicle
-- when done using the model
SetModelAsNoLongerNeeded(modelHash)