okokGarage

// sv_utils.lua

add this at the end of the file

lib.callback.register('okokGarage:server:check-persistence-takeout', function(source, plate)
    if plate then
        local result = MySQL.query.await('SELECT persist FROM rx56_permvehicles WHERE plate = ?', {plate})
        if result and result[1] and result[1].persist == 1 then
            TriggerClientEvent('garage:client:showNotification', source, {
                title = 'error',
                description = 'This vehicle cannot be removed because it is still somewhere',
                type = 'error'
            })
            return false
        end
    end
    return true
end)

lib.callback.register('okokGarage:server:check-persistence-transfer', function(source, plate)
    if plate then
        local result = MySQL.query.await('SELECT persist FROM rx56_permvehicles WHERE plate = ?', {plate})
        if result and result[1] and result[1].persist == 1 then
            TriggerClientEvent('garage:client:showNotification', source, {
                title = 'error',
                description = 'This vehicle cannot be transferred because it is still somewhere',
                type = 'error'
            })
            return false
        end
    end
    return true
end)

Last updated