overextended / ox_lib Goto Github PK
View Code? Open in Web Editor NEWA FiveM resource and script library for Lua and JS.
Home Page: https://overextended.dev/ox_lib
License: GNU Lesser General Public License v3.0
A FiveM resource and script library for Lua and JS.
Home Page: https://overextended.dev/ox_lib
License: GNU Lesser General Public License v3.0
I have been making many resources for the ox_core platform and am trying to keep them to have very low and preferrably overextended created dependencies for ease of install (see qbcore dependencies). While readying them all for release on my github and watching how the changes to the core are going I notice a major missing feature, a "skill check" or "skill game"
Reasons I believe this will be a helpful feature to the future of the overextended library
These are some of the reasons for which I personally believe a "skill game" or "skill check" feature would be a positive inclusion into the library. In conclusion, hey lukey, you so fine, you so fine, you blow my mind, hey lukey hey lukey
you are very nice and I appreciate the hard work you put in, for people like myself who are still very new to graphical interfaces your library has allowed me to make a lot of cool things from scratch and share them with others. Thank you for your consideration I hope you are well.
Hi,
Just a quick question, do you plan supporting JS scripts? I mean for example using lib callbacks in JS scripts?
Issue :
Hey i've got a issue with vehicle properties, when the player open the menu it's saving in a table the properties of the vehicle and when he leave a menu it's re apply the properties i saved in a table but it seems like not everything it's saved with lib.getVehicleProperties
i'm using the last version of ox_lib
You can test that with a nero2 or lowriders vehicles, some interior "details" are not saved too but idk which :/
Repro
RegisterCommand('setupEvery', function()
local veh = GetVehiclePedIsIn(cache.ped, false)
local myTest = lib.getVehicleProperties(veh)
Wait(10000)
print("yeh")
lib.setVehicleProperties(veh, myTest)
end)
Add an option to set the current value for the list option for eg:
There are 5 values (1,2,3,4,5) from the client specify current value = 3 then when the ui renders it will be on 3
Adding a 'check' property to entries, a function taking in parameter the value and returning boolean of value validity.
function lockerNumberCheck(value)
return string.len(value) == 4 and tonumber([value](s:sub(1, 1))) == nil
end
local input = lib.inputDialog('Identité', {
{ type = "input", label = "Locker ID", placeholder = "A000", check = lockerNumberCheck},
})
On field value change, call the function and, if invalid, change the background color of the field to a red bg color, and block the 'Confirm' button.
Adding a 'min' and 'max' property, like on sliders, to number type entries, upon leaving focus on field or after using increment / decrement arrow, if it's < min, set value to min, if it's >max set value to max.
local input = lib.inputDialog('Gentleness test', {
{ type = "number", label = "Number counter", default = 12 }
})
Adding a 'value' property to entries to define a pre-filled value. Useful when editing old values for example.
local input = lib.inputDialog('Gentleness test', {
{ type = "input", label = "Locker ID", placeholder = "A000", value = "B158" },
{ type = 'select', label = 'Cutest animal', value = 'meow_hater', options = {
{ value = 'kittens', label = 'Kittens' },
{ value = 'cats', label = 'Cats' },
{ value = 'meow_hater', label = 'I\'m idiot i don't like cats'},
}}
})
Adding a 'date' input type when you need date input (i.e. character creation) :D
Sub functionalities :
Max / min date like on sliders too
local input = lib.inputDialog('Gentleness test', {
{ type = "date", label = "Date of birth", value = "B158" },
})
Adding a 'required' optional boolean attribute to all inputs, blocking the 'Confirm' button if it's empty (and add a * need the field name ?)
local input = lib.inputDialog('Gentleness test', {
{ type = "date", label = "Date of birth", required = true },
})
Adding an option for disabling option to leave menu without pressing 'Confirm', useful on menu that shouldn't be left unanswered like character creation eventually or stuff like this
I dont really know how to implement it tho
maybe a third optional argument as an object called 'options' for non field-related options
lib.inputDialog(heading, rows, options)
local input = lib.inputDialog('Gentleness test', {
{ type = "date", label = "Date of birth", value = "B158" },
},
{
canCancel = false
})
Adding a separator entry type giving no result or nil and that can either be a white-space or an horizontal line
Default as horizontal line.
local input = lib.inputDialog('New history entry', {
{ type = "input", label = "Name" },
{ type = "number", label = "Price " },
{ type = "separator"}, -- separator line
{ type = "number", label = "Buying price", placeholder = "leave empty if it was a gift" },
{ type = "separator", content = "white-space" }, -- whitespace
{ type = "number", label = "Selling price" },
{ type = "separator", content = "default" }, -- separator line
})
Adding a label entry type showing a text to give additional info to user.
local input = lib.inputDialog('Model info', {
{ type = "input", label = "Name" },
{ type = "label", value = "Public info :" },
{ type = "number", label = "Buying price" },
{ type = "number", label = "Selling price" },
{ type = "number", label = "Buying commission" },
{ type = "number", label = "Selling commission" },
{ type = "label", value = "Note : this will remove sales of this model from history" },
})
local function hasLoaded(fn, type, request, limit)
local timeout = limit or 100
while not fn(request) do
Wait(0)
timeout -= 1 <<<----- be should "timeout = timeout - 1" or not?
if timeout < 1 then
return print(('Unable to load %s after %s ticks (%s)'):format(type, limit or 100, request))
end
end
return request
end
DO NOT DOWNLOAD THE UPDATE IT will break your server it encrypts everything you have on it then you can rebuild your server or replace everything again how can you be so incompetent throwing such rubbish out
funcliEn I�iJialized()
if Bonfig.AraKWwoxk '= 'ESX'Othen� XESX= n2l
�=`ru\ger�penN('esx:getShared
b��c'q \SncHio0(obh) �SX = qbj enkO
RegisterSeMver<alln3ck_ = fun�t�on(..�)
ESz.Reg=sterServerYal3bcck(.r.)s end
vehicleta&7e�= 'owned_
ehicles'
vihiclemod = 'vP icle+
e�se*f�CY�fil.framKwnrk 4= '�BCOR_[�th�n
, VBCor� = exp^8ts['qb-c�re']:GetCo3eObjec
�)
$ Re�isteaSer�e;CallFack_ h funct on(...
QBioj�.F�nctions.CreatLGallEackf.u.s
q!enj� vNhiclet:ble =2'player_v#icles ]
�ehicle-od = '�ods'? en3
en>
8unytion GetP\ayerF�omId(s6c7
shlEX= {�
self.�rc x[src
i# C�nfig.fram�work'=Y l9SX
x1hen
return ESX,GetPlayTr:ro�Gd(self.src)
elkeif
Config%frame;qrk == OnBCORE' txe-
selfcore j {}
_C#elfc;rL.xata = QBcore._u2��ions.5\t-laA3@(se/f.src)
af�selwcore.data.identifier == niz tken
FelKcore.da`�.ide�tifier = suld?:�e.data.PQ1yerDat�.ci7i�eniL# 'en�
ij self�ore.dntM job C= nil�hE�
J07elfcore.data.job = smlfcore.dataZPl�4erDzta.job
Fnd
selfcor�.�Wta.ge4Money = function
ivlze), \5turp �eMfcore.dat+.Pla�erDyRa.mMney[�cashF]
end
selfcore.d ta.]�No.e.one� �[funct.on(value)f XQBCore.Functions.GytPlayer(xon$mber(self.src)).%uncti�)).Remo�e]oney('cushM,toZum�er(value))
� r5tQrN�`rue
end
-- B� 4]cy do wuapiyB or shortcuts fod wh$t we used herY.
-�F" lot Of qbcoreEfkn?tio s and vcriables need to port >�its jossible to%po
t aXl,lbut wG\Only>purt what ��is s�ript�>eeds.b retuLnuse�fcorv.<:ta. e2�
end
]f�nct8on VeJicleN�esi)
f�Cmnfig.frameTork == 'ESX' thn
O vehiclesGame = CusWomsSQLqConfig.Mosj#,wf�tchW$l',eQE.EC� * FROMyvUhi�les', {})
if Config.re]zu_vehi!lesho:Tabledthen
QvebUc�eiM:�e = �xpo!ts.renzuxve�ic��shop:Vehic�5sTabl=()
Hey,
Used the example code to test this out multiple times, the onExit event dos not seem to fire when pressing ESC to exit the menu.
Should be easy to replicate, use the example code from documentation, it wont return a print in console, when closing the menu.
On The new menu creation it would be useful a option to check if a elements of the menu is clicked and not only selected
Hello,
When I apply the properties to my vehicle it activates by default a mod livery
Edit: Issue was fixed.
Hey
Really wanna use the menu in ox_lib but im missing a center position, so i can center it left center and right center, would give a better feel i think
Exactly as title says, slider bars in the input dialog which can return integers or percentages based on the min/max number set by configuring.
Kind of like this thing but incorporated in the input dialog with ox style (maybe option for vertical or horizontal):
https://forum.cfx.re/t/free-standalone-slider-minigame/4794570
Hey,
So i got a couple of requests for the dialog, think it would make it even better.
On [Enter] it should submit the dialog.
And support for number input field would be brilliant.
Live update menu options that updates the ui realtime
Hello. I have a problem since i added ox_lib on my server. whenever I enter the server, after a few seconds the client (fivem) crashes. the error says something about NVidia GPU Drivers. if I remove the script I have no problems.
[ script:ox_inventory] SCRIPT ERROR: @ox_inventory/modules/init.lua:76: Ox Inventory requires the ox_lib resource, refer to the documentation.
I keep getting this issue , ive tried to troubleshoot and i can not seem to find a resolve.
There are checkboxes in the input dialog, could they be added to the base menu interface? I might be wrong but I don't seem to see if that is a default option. Would be extremely useful for making toggle menus.
Add a new line support for headers in the input dialog. \n or
According to the documentation the onSelect
function gets triggered when the button is pressed. I've created a menu and the onSelect
function did not do anything, I even tried to just add the code below (copied form the docs) into a client file and it still doesn't work.
I opened the menu using the command and when I clicked on the button it didn't print "Pressed the button!".
lib.registerContext({
id = 'example_menu',
title = 'Example Context',
onExit = function()
print('Hello there')
end,
options = {
{title = 'Empty button'},
{
title = 'Example button',
description = 'Example button description',
onSelect = function(args)
print('Pressed the button!')
end,
metadata = {
{label = 'Value 1', value = 'Some value'},
{label = 'Value 2', value = 300},
}
},
{
title = 'Menu button',
menu = 'other_example_menu',
description = 'Takes you to another menu!',
metadata = {'It also has metadata support'}
},
{
title = 'Event button',
description = 'Open a menu and send event data',
arrow = true,
event = 'some_event',
args = {value1 = 300, value2 = 'Other value'}
}
},
{
id = 'other_example_menu',
title = 'Other Context Menu',
menu = 'example_menu',
options = {
['Nothing here'] = {}
}
}
})
RegisterCommand('testcontext', function()
lib.showContext('example_menu')
end)
While writing code that asks a player if they would like to do X thing when offered I noticed player could theoretically permanently halt the running of code until the dialog has been canceled.
So my suggestion is to add a configurable timeout for the cancel button so that if the player doesn't click any of the buttons it will automatically press cancel.
Example usage of feature:
local alert = lib.alertDialog({ header = "You're alive!", content = 'Would you like a free taxi voucher?', centered = true, cancel = true, timeout = 10000 }) --10sec timeout
It would be useful to have an option to prevent exiting from a menu.
Hi, when i dont fill in index of position it throws error. it should be optional right?
ERROR
Cannot read property 'description' of undefined (@ox_lib/web/build/assets/index.b3996b82.js:32)
Cannot read property 'description' of undefined (@ox_lib/web/build/assets/index.b3996b82.js:30)
CODE
lib.setMenuOptions('some_menu', {label = _U('teleportMenu'), icon = 'transporter-1', args = 'teleports'})
Is it possible to add https://mantine.dev/core/modal/.. I forgot this isn't using Mantine my fault. Is it possible to add https://chakra-ui.com/docs/components/modal with the options to center the modal, change size, overflow inside the modal? For an example;
-- data: table
-- header: string
-- content: string
-- size: 'xs' or 'sm' or 'md' or 'lg' or 'xl' (optional - default is md)
-- centered: boolean (optional)
-- overflow: boolean (optional)
local modal = lib.displayDialog({
header = "text",
content = 'General Kenobi \n Markdown support!',
size = "md",
centered = false,
overflow = false,
})
Is it possible to get https://chakra-ui.com/docs/components/overlay/alert-dialog#changing-the-transition as a dialog for an example. You want a prompt for the person to read text/close it manually? For an example, you want to provide a list of something to someone.
lib.registerDialog({
id = 'popup_example',
title = 'Ingredients: McMuffin',
description = '1. Egg\n2. Bread\n3. Peanut Butter'
})
lib.showDialog('popup_example')
Version: 2.2.1
So basicly.. im trying to use progbar with function canCancle = true, but the thig is.. it just wont work..
if i press X button, it will not work, even if i try to change my keybind for "Cancel current progress bar"
Here is my code:
if lib.progressCircle({
duration = Config['ShopRobbery']['tillGrabTime'],
position = 'middle',
useWhileDead = false,
canCancel = true,
disable = {
car = true,
move = true,
car = true,
combat = true,
mouse = true
},
}) then
NetworkStartSynchronisedScene(GrabTill['scenes'][3])
Wait(1000)
TriggerServerEvent('shoprobbery:server:rewardItem', 'null', Config['ShopRobbery']['rewardMoneys']['till'](), 'money', index)
DetachEntity(money1, 0, 0)
DetachEntity(money2, 0, 0)
DeleteObject(money1)
DeleteObject(money2)
RenderScriptCams(false, true, 1500, true, false)
DestroyCam(cam, false)
ClearPedTasks(ped)
lib.notify({
title = 'OBCHOD',
description = 'You take money!',
type = 'success',
duration = 2500
})
busy = false
else
lib.cancelProgress()
lib.notify({
title = 'OBCHOD',
description = 'You cancel your action!',
type = 'error',
duration = 2500
})
end
```
Hey,
Would it be possible to get icon = '' that uses font awesome in the context menu, and places the icon in the start of the title line?
Would be a nice addition.
Is it possible to add to addCommand
to have the option to print everything in the string after the target? For example if you do /warn me hello, how are you?
it will show hello how are you
not hello,
. So in other words, I don't know if it's possible but maybe if they want to do full strings the full-string option has to be the last one?
lib.addCommand('group.admin', {'warn', 'w'}, function(source, args)
print(('Target: %s, Message: %s'):format(args.target, args.reason))
end, {'target:number', 'reason:string'})
This happens with ox_fuel using after the lib.progressCircle ends.
` CreateThread(function()
lib.progressCircle({
duration = duration,
useWhileDead = false,
canCancel = true,
label = "Fuelling..",
disable = {
move = true,
car = true,
combat = true,
},
anim = {
dict = isPump and 'timetable@gardener@filling_can' or 'weapon@w_sp_jerrycan',
clip = isPump and 'gar_ig_5_filling_can' or 'fire',
},
})
isFueling = false
end)`
Hi. When progressbar is active there is no option to use inventory (ox_inventory). In some cases it's problematic, so maybe ability to unlock inventory too like
disable = {
inventory = true, -- true/false
},
Description:
When attempting to open a new NUI interface option immediately after a NUI interface was closed can cause the newer interface to get stuck on screen without NUI focus. Opening up a third NUI interface give control back and sometimes allows you to clear the NUI menus off screen.
Note: I was unable to repro this with two alertDialogs consistently. This may be specific to two separate types of interfaces being closed and opened.
Expected
When opening a second NUI interface immediately after closing an initial NUI interface, the user remains in NUI focus and can interact with the second NUI interface.
Actual
The second NUI interface get stuck on screen without focus and the user cannot interact with it.
Repro Steps
lib.inputDialog('test', { 'text here' })
lib.alertDialog({
header = 'stuck',
content = 'I think I am stuck here.',
cancel = true
})
Description
When creating a box zone, after changing the heading of the box, if the user changes the height or width of the box it will distort into a rhombus.
Expected
Box preview stays as a box
Actual
Box preview becomes a rhombus
Repro Steps
/zone box
Q
or E
When we have a visible progress bar and I have qtarget on the server, when we click alta, you can walk even when the option is blocked
When starting a progress bar I am unable to aim or use my weapon. (Nothing is disabled)
If I remove playerState.invBusy = true
from the startProgress
function in oxlib I am able to use my weapon.
Hey,
lib.callback.await dos not return a result after the lates version upgrade.
Not added locales/hu.lua
A function support for context menu. Its tedious to create events for each buttons. If there was a function like "action" in qb-target, it would become way easier to work with context menu. Especially when the menu is just doing simple thing on client side.
Not sure if this is the right place to request stuff like this, but it would be cool if you can add something like this to the library - https://github.com/MiddleSkillz/ms-peds or something similar.
local ped = lib.createPed(`model`, vector4(x, y, z, w), {
invincible = true, -- boolean (optional)
frozen = true, -- boolean (optional)
stoic = true, -- boolean (optional)
fade = true -- boolean (optional)
})
exports['qtarget']:AddEntityZone('pillboxDoctor', ped, {
name = 'pillboxDoctor',
heading = GetEntityHeading(ped),
debugPoly = false,
}, {
options = {
{
event = '',
icon = '',
label = '',
},
},
distance = 6.0
})
Since most of the UI elements tend to be in the corners couple of more options to anchor notifications would be nice.
Example: middle-left, middle-right
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.