ESX [FiveM] GR4CKA - Drug Addiction convert to ESX (1 Viewer)

nopixeliloveyou

Member
God VIP
Aug 7, 2025
13
2
3
Credits
95
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

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! 🙌
 

barzorany

Member
Apr 28, 2025
29
13
3
Credits
4,895
There is no animation for the smoking and im not getting any overdose alert , add me on discord to share screen in case needed : penguinslords
 

nopixeliloveyou

Member
God VIP
Aug 7, 2025
13
2
3
Credits
95
There is no animation for the smoking and im not getting any overdose alert , add me on discord to share screen in case needed : penguinslords
First of all, a big thank you for your feedback because I'm trying to improve my skills in writing esx/BB scripts... so I'll take note of the information and try to fix it as soon as possible... do you see any other problems in the console? Yes, can you copy them to me please :)
 

Users who are viewing this thread

Top