Hey everyone,
I’m a new developer and got a bit bored, so I tried converting this addiction script to ESX (esx_core) because I saw people asking for an ESX version. I’m not 100% sure it’s perfect, so please be kind 🙠and share feedback/bugs so I can fix them. It’s functional on my side.
Original source & credits:
Video preview (YouTube):
frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowfullscreen
loading="lazy">
Download on Google Drive
[HEADING=2]What I did (quick summary)[/HEADING]
[LEFT]Database persistence: addiction state stored as JSON via oxmysql[/LEFT]
[LEFT]Inventory: ox_inventory support with ESX fallback[/LEFT]
[LEFT]NUI/HUD: proper ui_page and files setup so the interface displays correctly.[/LEFT]
[LEFT]Locales (FR/EN):[/LEFT]
[LEFT]okok integrations (optional):[/LEFT]
[LEFT]Safety & robustness:[/LEFT]
[LEFT]OX pack ready-to-paste (items + images):[/LEFT]
[/LIST]
[HEADING=2]Dependencies[/HEADING]
Required
Optional
I’m a new developer and got a bit bored, so I tried converting this addiction script to ESX (esx_core) because I saw people asking for an ESX version. I’m not 100% sure it’s perfect, so please be kind 🙠and share feedback/bugs so I can fix them. It’s functional on my side.
Original source & credits:
- [LEFT]HighLeaks thread: https://highleaks.com/threads/fivem-gr4cka-drug-addiction-qb-esx-edited-by-me.28877/[/LEFT]
Video preview (YouTube):
frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowfullscreen
loading="lazy">
Download on Google Drive
[HEADING=2]What I did (quick summary)[/HEADING]
- [LEFT]Framework: full QBCore → ESX (esx_core) conversion[/LEFT]
[LIST]
- [LEFT]replaced events (playerLoaded, playerDropped, logout),[/LEFT]
- [LEFT]switched to ESX.RegisterUsableItem, ESX.GetPlayerFromId, etc.[/LEFT]
- [LEFT]column users.addiction (LONGTEXT),[/LEFT]
- [LEFT]loads on player join, minute tick to decrement addiction and sync the HUD.[/LEFT]
- [LEFT]registers usable items with ox_inventory:RegisterUsableItem if OX is running, otherwise ESX.RegisterUsableItem,[/LEFT]
- [LEFT]removes items via OX or ESX depending on what’s available.[/LEFT]
- [LEFT]added locales/ + shared/locales.lua loader,[/LEFT]
- [LEFT]Config.Locale = 'fr' by default (switch to 'en' if you prefer).[/LEFT]
- [LEFT]okokNotify (with ESX notification fallback),[/LEFT]
- [LEFT]okokTextUI (shows a message while “sufferingâ€Â),[/LEFT]
- [LEFT]okokBanking (bank charge/log if you enable a treatment cost).[/LEFT]
- [LEFT]resource-state checks (e.g., OX) before using exports,[/LEFT]
- [LEFT]server/client guards with IsDuplicityVersion,[/LEFT]
- [LEFT]save on stop (onResourceStop → g4_addiction:unload) + playerDropped,[/LEFT]
- [LEFT]client asks server for fresh data on (re)start (g4_addiction:requestData),[/LEFT]
- [LEFT]removed remaining QBCore traces.[/LEFT]
- [LEFT]snippet for ox_inventory/data/items.lua,[/LEFT]
- [LEFT].png icons for each item in ox_inventory/web/images/,[/LEFT]
- [LEFT](optional) “pharmacy†snippet for ox_inventory/data/shops.lua.[/LEFT]
[/LIST]
[HEADING=2]Dependencies[/HEADING]
Required
- [LEFT]es_extended (esx_core)[/LEFT]
- [LEFT]oxmysql[/LEFT]
Optional
- [LEFT]ox_inventory (recommended)[/LEFT]
- [LEFT]okokNotify[/LEFT]
- [LEFT]okokTextUI[/LEFT]
- [LEFT]okokBanking[/LEFT]
[LEFT]P.S.: I tried to keep it clean, but if you see any issue, please tell meâ€â€I’ll patch quickly. Thanks to anyone who...
Reactions are only available for posts