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 objectlocal direction = utils.player.get_cardinal_direction(PlayerPedId())print("Player is facing:", direction)--- Direct exportlocal direction = exports.boii_utils:get_cardinal_direction(PlayerPedId())
get_street_name
Retrieves the street name and area the player is currently located.
--- Utils objectlocal street_name = utils.player.get_street_name(PlayerPedId())print("Player is on:", street_name)--- Direct exportexports.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)
Check if player is targeting an entity and retrieve its ID.
--- Utils objectlocal target = utils.player.get_target_entity(PlayerPedId())if target >0thenprint("Player is targeting entity ID:", target)elseprint("Player is not targeting any entity.")end--- Direct exportlocal target = exports.boii_utils:get_target_entity(PlayerPedId())
get_distance_to_entity
Calculate distance between a player and a specified entity.
--- Specify entitylocal entity =--[[ some entity ID ]]--- Utils objectlocal distance = utils.player.get_distance_to_entity(PlayerPedId(), entity)print("Distance to entity:", distance)--- Direct exportlocal distance = exports.boii_utils:get_distance_to_entity(PlayerPedId(), entity)
play_animation
Runs an animation on the player with detailed customisation options.
--- Utils objectutils.player.play_animation(player_ped, { dict ='missheistdockssetup1clipboard@base', anim ='base', flags =49, duration =5000, freeze =true, continuous =false, --- Do not use props or callbacks with continuous props = { { model ='prop_cs_burger_01', bone =57005, coords =vector3(0.13, 0.05, 0.02), rotation =vector3(-50.0, 16.0, 60.0), soft_pin =false, collision =false, is_ped =true, rot_order =1, sync_rot =true }, { model ='ba_prop_club_water_bottle', bone =60309, coords =vector3(0.0, 0.0, 0.05), rotation =vector3(0.0, 0.0, 0.0), soft_pin =false, collision =false, is_ped =true, rot_order =1, sync_rot =true } }}, function()print('animation finished')end)--- Direct exportexports.boii_utils:play_animation(...)