Skip to content

Request

Reference for the request API.

WARNING

These options are blocking, it's recommended to call inside of a thread or job.

Functions

request.control

Requests control of an entity.

lua
---@param entity integer
---@param force_ownership? bool
function request.control(entity, force_ownership?): bool

request.model

Requests a model to be loaded.

lua
---@param model string|integer
function request.model(model): bool

request.weapon

Requests a weapon to be loaded.

lua
---@param model string|integer
function request.weapon(model): bool

request.dict

Requests a dictionary to be loaded.

lua
---@param dictionary string
function request.dict(dictionary): bool

request.anim

Requests an animation to be loaded.

lua
---@param animation string
function request.anim(animation): bool

request.particle

Requests a particle to be loaded.

lua
---@param particle string
function request.particle(particle): bool

Examples

lua
local natives = require('natives')

util.create_job(function()
  local hash = joaat('player_two')
  if request.model(hash) then
    natives.set_player_model(players.me().id, hash)
  end
end)