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):
Download on Google Drive
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

Original source & credits:
Video preview (YouTube):
Download on Google Drive
What I did (quick summary)
- Framework: full QBCore → ESX (esx_core) conversion
- replaced events (playerLoaded, playerDropped, logout),
- switched to ESX.RegisterUsableItem, ESX.GetPlayerFromId, etc.
- Database persistence: addiction state stored as JSON via oxmysql
- column users.addiction (LONGTEXT),
- loads on player join, minute tick to decrement addiction and sync the HUD.
- Inventory: ox_inventory support with ESX fallback
- registers usable items with ox_inventory:RegisterUsableItem if OX is running, otherwise ESX.RegisterUsableItem,
- removes items via OX or ESX depending on what’s available.
- NUI/HUD: proper ui_page and files setup so the interface displays correctly.
- Locales (FR/EN):
- added locales/ + shared/locales.lua loader,
- Config.Locale = 'fr' by default (switch to 'en' if you prefer).
- okok integrations (optional):
- okokNotify (with ESX notification fallback),
- okokTextUI (shows a message while “suffering”),
- okokBanking (bank charge/log if you enable a treatment cost).
- Safety & robustness:
- resource-state checks (e.g., OX) before using exports,
- server/client guards with IsDuplicityVersion,
- save on stop (onResourceStop → g4_addiction:unload) + playerDropped,
- client asks server for fresh data on (re)start (g4_addiction:requestData),
- removed remaining QBCore traces.
- OX pack ready-to-paste (items + images):
- snippet for ox_inventory/data/items.lua,
- .png icons for each item in ox_inventory/web/images/,
- (optional) “pharmacy” snippet for ox_inventory/data/shops.lua.
Dependencies
Required
- es_extended (esx_core)
- oxmysql
Optional
- ox_inventory (recommended)
- okokNotify
- okokTextUI
- okokBanking
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 tests and shares feedback!