[Standalone] Crutches

No, all fine, don’t apologize!

I’m unsure of what framework you use, but I’ll give you two examples, one for ESX and one for QBCore.

Since there is not an event to trigger by default you’ll have to add this in client.lua at the bottom of the crutches script:

RegisterNetEvent('crutches:toggleCrutch')
AddEventHandler('crutches:toggleCrutch', function()
    ToggleCrutch()
end)

If you wish to only use the item and not any command you’ll have to comment it out or add checks to see if you have the item in your inventory. But to keep it simple just add one of the following to a server-sided file:

ESX:

ESX.RegisterUsableItem('crutch', function(source)
    TriggerClientEvent("crutches:toggleCrutch", source)
end)

QBCore:

QBCore.Functions.CreateUseableItem("crutch", function(source, item)
    local src = source
    local Player = QBCore.Functions.GetPlayer(src)

    if Player.Functions.GetItemByName(item.name) ~= nil then
        TriggerClientEvent("crutches:toggleCrutch", src)
    end
end)

I don’t use ESX or QBCore, so this is untested code. You’ll also have to add some database stuff for ESX at least, but you’ll have to figure that out yourself.

I hope this helps.