Skip to content

Suggestion: Overencumbered Effect/notification #5

@alberttheprince

Description

@alberttheprince

So this is my variation on the effect, if you want to use it as an option or not but I figured I'd let you see what I did. I also set it to 1 weight level in the config.

So for example, on my server, 50000 is where you get encumbered, and 75000 is the total inventory capacity.

   weight_effects = {
        {weight = 50000, slow_percent = 80},
    },
}

Add this to the fxmanifest for ox notifications:

shared_scripts {
    '@ox_lib/init.lua'
}

Replaced local function MakePlayerMoveSlower(speed) code with:

local function MakePlayerMoveSlower(speed)
    if last_modified_speed == speed then return end
    last_modified_speed = speed
    CreateThread(function()
        while modified_speed == speed do
            if Config.effect_sprint_only == true and (IsPedJumping(PlayerPedId()) or IsPedSprinting(PlayerPedId()) or IsPedRunning(PlayerPedId())) or Config.effect_sprint_only == false then
                lib.notify({
                    title = 'You\'re carrying too much! 😰',
                    description = 'Lose some weight so you can run again',
                    position = 'center-left',
                    duration = 5000,
                    type = 'warning',
                    icon = 'ban',
                    iconColor = '#C53030'
                })    
                SetPedMoveRateOverride(PlayerPedId(), modified_speed) 
                    Wait(100)
                    SetPlayerControl(PlayerId(), 0, 0)
                    RequestAnimDict("re@construction")
				    while not HasAnimDictLoaded("re@construction") do
				    Wait(100)
				    end			
				    TaskPlayAnim(PlayerPedId(), "re@construction", "out_of_breath", 8.0, 8.0,-1, 32, 0, false, false, false)
                    Wait(5000)
                    SetPlayerControl(PlayerId(), 1, 1)
            end
            Wait(0)
        end
    end)
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions