A set of functions to manage and retrieve detailed player-related information. These functions are designed to be modular and framework-independent, enabling developers to access cardinal directions, street names, targeting, animation handling, and more.
Functions
get_cardinal_direction
Retrieve the cardinal direction the player is facing
--- Utils object
local direction = utils.player.get_cardinal_direction(PlayerPedId())
print("Player is facing:", direction)
--- Direct export
local direction = exports.boii_utils:get_cardinal_direction(PlayerPedId())
get_street_name
Retrieves the street name and area the player is currently located.
--- Utils object
local street_name = utils.player.get_street_name(PlayerPedId())
print("Player is on:", street_name)
--- Direct export
exports.boii_utils:get_street_name(PlayerPedId())
get_region_name
Gets the region name where player is located.
local player = PlayerPedId()
local region_name = utils.player.get_region(player)
print("Player is in the region:", region_name)
get_player_details
Retrieve detailed information about the player.
--- Utils object
local details = utils.player.get_player_details(PlayerPedId())
print("Player details:", json.encode(details))
--- Direct export
local details = export.boii_utils:get_player_details(PlayerPedId())
get_targeted_entity
Check if player is targeting an entity and retrieve its ID.
--- Utils object
local target = utils.player.get_target_entity(PlayerPedId())
if target > 0 then
print("Player is targeting entity ID:", target)
else
print("Player is not targeting any entity.")
end
--- Direct export
local target = exports.boii_utils:get_target_entity(PlayerPedId())
get_distance_to_entity
Calculate distance between a player and a specified entity.
--- Specify entity
local entity = --[[ some entity ID ]]
--- Utils object
local distance = utils.player.get_distance_to_entity(PlayerPedId(), entity)
print("Distance to entity:", distance)
--- Direct export
local distance = exports.boii_utils:get_distance_to_entity(PlayerPedId(), entity)
play_animation
Runs an animation on the player with detailed customisation options.