[Free] ox_lib - UI and common code

it’s on the docs

read the docs

can anyone tell me how to get ox_bridge i need it in order to run these props supposedly

I for some reason can not send chat messages in your discord server. I was wondering if in the input menu if I could make it so options are disabled essentially if say a player already has a drivers license or weapon license. I wanna make a license shop or really convert esx license shop to use your input menu it’s cleaner than default esx.

image
How can I lower this notification further from the edge of the screen so that it doesn’t collide with the text? thank you

1 Like

how do i download and install progress bar and context menu?

just download oxlib resource and then do this in your code

        local success = lib.progressBar({
            duration = 2000,
            label = "HELLO",
            useWhileDead = false,
            canCancel = false,
            disable = {
                car = true,
                move = true
            },
            anim = {
                dict = 'mini@repair',
                clip = 'fixing_a_ped' 
            },
        })

How fix: Replacing existing target option ‘task2’. api.lua:131

RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function()
	local job = QBCore.Functions.GetPlayerData().job.name
	if job == "police" then
		exports.ox_target:addGlobalPlayer({
			{
				name = 'task1',
				icon = 'fas fa-user-group',
				label = 'Task Police',
				distance = 2.0,
				onSelect = function()
					TriggerEvent('some_event')
				end
			}
		})
	else
		exports.ox_target:addGlobalPlayer({
			{
				name = 'task2',
				icon = 'fas fa-user-group',
				label = 'Task Civil',
				distance = 2.0,
				onSelect = function()
					TriggerEvent('some_event')
				end
			}
		})
	end
end)

I’m using ox_lib callbacks to get which seats are free in a vehicle. However, there’s a weird problem where the server doesn’t get the actual return value. Let me show you

client

lib.callback.register('cb_name', function (_veh)
    print("_veh",_veh)
    local veh = NetworkGetEntityFromNetworkId(_veh)
    print("veh",veh)
    if veh ~= nil then
        local seats = GetVehicleMaxNumberOfPassengers(veh)
        for i = -1, seats do
            if IsVehicleSeatFree(veh, i) then
                print("returning",i)
                return i
            end
        end
        print("returning nofree")
        return "nofree"
    else
        print("returning noveh")
        return "noveh"
    end
end)

Server

local veh,coords = lib.getClosestVehicle(GetEntityCoords(GetPlayerPed(_source)), 35.0, false)
print("veh",veh)
if veh and veh ~= 0 then
    lib.callback('cb_name', _source, function (seatId)
        print("server seatid",seatId)
        ...
    end, NetworkGetNetworkIdFromEntity(veh))
...

And here are the results
Imgur
Imgur
Does anyone have any idea what might be causing this?

When registering a callback, first argument is always the player source. :slight_smile:

Not when registering the callback on the client, at least according to the docs.

Ah yes, I didn’t see tbh… Just looked at the first line :expressionless:

hey, I have a question: can I incorporate the progress bar from ox_lib into a script? That somehow doesn’t work for me

can this work with QBOX?

QBox uses ox scripts as default…

I want to use this to change my UI color and I don’t know why setr ox:primaryColor red
setr ox:primaryShade 8

Good morning/evening, i would like to know if its possible to add custom icons to the notifications?

for example i made a script for clearing the vehicles from the map and to return the owned vehicles to the garage, so i would like to use the garage icon or something similar.

thats how i made the code

exports['ox_lib']:notify({
        title = 'Information',
        description = 'The vehicle returned to the garage',
        type = 'info', 
        color = '#FF0000', 
        icon = 'garage', 
        position = 'center-right'
    })

i have an issue where it wont work it says no such export in getlib in rescousrse ox_lib any ideas?

Can I Suggest A Pesistent Mode For lib.notify?