[FiveM] GR4CKA - Drug Addiction convert to ESX

posted 11-08-2025 18:22 1.035 views 5 replies
nopixeliloveyou
0 Posts
498 Credits
N/A Since
#1 1.035 views 5 replies
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)




  • [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]Database persistence: addiction state stored as JSON via oxmysql[/LEFT]

    • [LEFT]column users.addiction (LONGTEXT),[/LEFT]
    • [LEFT]loads on player join, minute tick to decrement addiction and sync the HUD.[/LEFT]

  • [LEFT]Inventory: ox_inventory support with ESX fallback[/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]NUI/HUD: proper ui_page and files setup so the interface displays correctly.[/LEFT]
  • [LEFT]Locales (FR/EN):[/LEFT]

    • [LEFT]added locales/ + shared/locales.lua loader,[/LEFT]
    • [LEFT]Config.Locale = 'fr' by default (switch to 'en' if you prefer).[/LEFT]

  • [LEFT]okok integrations (optional):[/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]Safety & robustness:[/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]OX pack ready-to-paste (items + images):[/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]

    Dependencies



    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...
  • replies (5)
    barzorany
    23 Posts
    7,254 Credits
    Apr 2025 Since
    #1
    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
    168 Posts
    498 Credits
    Aug 2025 Since
    #2

    barzorany,
    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 :-)
    Edward-Dev
    15 Posts
    302 Credits
    Sep 2025 Since
    #3
    good
    kainstifler
    35 Posts
    92 Credits
    Jul 2025 Since
    #4
    +1
    morllaines
    98 Posts
    75,215 Credits
    Sep 2025 Since
    #5
    Thank you for the esx conversion.
    This make ease ro fix all problems.

    You must be logged in to reply

    Login Register