Common functions

Some of functions that will help you and i want them to be easy to find

Draw 3D texts

Options
{
    color = {
        r = 255,
        g = 255,
        b = 255,
        a = 255
    },
    size = 0.8
}
draw3DText(pos, text, options)

Vehicle driver

--Is ped in vehicle? return vehicle/false
rcore:isInVehicle(ped)
--Is ped driver of vehicle return true/fals
rcore:isDriver(ped,vehicle)
-- Get driver of vehicle return ped, false
rcore:getDriver(vehicle)

Closest ped

This function get closest ped that can be found, it does not mean closest but only ped in radius

rcore:getClosestPed(targetPed, distance)

How to use it? Simple target ped is ped around which we are looking for peds

local currentPed = PlayerPedId()
local findClosestPed = rcore:getClosestPed(currentPed,100.0)
if DoesEntityExists(findClosestPed) and GetPedType(findClosestPed) ~= 28 then
    print('find ped')
end

Check ped type because ped is also animals More info with native documentation GetPedType https://runtime.fivem.net/doc/natives/?_0xFF059E1E4C01E63C

You can use alternatively method that will return table of found peds and its working with same params but new params is add, that check how many peds it will check if they are near, can cause lags with lot of checks

rcore:getClosestPeds(targetPed, distance, limit)

Limit has default value 250

Last updated

Was this helpful?