qbcore-framework / qb-core

FiveM RP Framework Core :muscle:
GNU General Public License v3.0
582 stars 962 forks source link

[BUG] Smoking joint - No stress relief - No animation played #1088

Closed MattyBruz closed 4 months ago

MattyBruz commented 7 months ago

Summary

[BUG] Smoking joint - No stress relief - No animation played

Reproduction

Smoke a joint - No stress relief - No animation played

Expected behavior

Smoke a joint - stress relief - animation played

Actual behavior

Smoke a joint - No stress relief - No animation played

Additional context

nil

Last Updated

a few days ago

Custom Resources

nil

Resource Rename

false

gab3mioni commented 6 months ago

Hey, I changed some lines in the original code. The animation isn't the best, but you can try other props and animations. If you have any questions, send me a message on discord. User: hatelyzz


RegisterNetEvent('consumables:client:UseJoint', function()
    TriggerEvent('animations:client:EmoteCommandStart', {"joint"})
    QBCore.Functions.Progressbar("smoke_joint", "Apertando um..", 2600, false, true, {
        disableMovement = false,
        disableCarMovement = false,
        disableMouse = false,
        disableCombat = true,
    }, {
        animDict = "amb@world_human_smoking@male@male_a@enter",
        anim = "enter",
        flags = 49,
    }, {
        model = 'p_cs_joint_02',
        bone = 47419,
        coords = vec3(0.015, -0.009, 0.003),
        rotation = vec3(55.0, 0.0, 110.0),  
    }, {}, function()
        TriggerEvent("inventory:client:ItemBox", QBCore.Shared.Items["joint"], "remove")
        TriggerEvent('animations:client:EmoteCommandStart', {"c"})
        TriggerEvent("evidence:client:SetStatus", "weedsmell", 300)
        TriggerServerEvent('hud:server:RelieveStress', math.random(10, 15))
    end)
end)
MattyBruz commented 5 months ago

@gab3mioni

very good

RegisterNetEvent('consumables:client:UseJoint', function()
    TriggerEvent('animations:client:EmoteCommandStart', {"SmokeWeed"})
    QBCore.Functions.Progressbar("smoke_joint", "420..", 15000, false, true, {
        disableMovement = false,
        disableCarMovement = false,
        disableMouse = false,
        disableCombat = true,
    }, {
        animDict = "amb@world_human_smoking@male@male_a@enter",
        anim = "enter",
        flags = 49,
    }, {
        model = 'p_cs_joint_02',
        bone = 47419,
        coords = vec3(0.015, -0.009, 0.003),
        rotation = vec3(55.0, 0.0, 110.0),  
    }, {}, function()
        TriggerEvent("inventory:client:ItemBox", QBCore.Shared.Items["joint"], "remove")
        TriggerEvent('animations:client:EmoteCommandStart', {"c"})
        TriggerEvent("evidence:client:SetStatus", "weedsmell", 300)
        TriggerServerEvent('hud:server:RelieveStress', math.random(25, 50))
    end)
end)
MattyBruz commented 5 months ago

I think there may be code in there not needed but im just a noob.

GhzGarage commented 4 months ago

https://github.com/qbcore-framework/qb-smallresources/compare/d06d5c104552...71fd3eac5f12

MattyBruz commented 4 months ago

thanks @GhzGarage