⚠️Common Errors

In this section, you will find answers to commonly encountered issues. Remember that most errors stem from incorrect configuration, lack of required resources, or insufficient modification.

Bear in mind that troubleshooting requires patience and precision. Try to carefully analyze the errors and systematically review possible solutions.

If the issue persists after verifying the configuration and available resources, please contact the support on the VMS Discord.


ESX license invalidation, requires script restart to refresh player licenses in menu

To refresh the player's licenses, you need to execute an event to him to update the list of licenses, the following code shows the modified esx_license code

esx_license/server/main.lua

RegisterNetEvent('esx_license:removeLicense')
AddEventHandler('esx_license:removeLicense', function(target, licenseType, cb)
    local xPlayer = ESX.GetPlayerFromId(source)
    if xPlayer then 
        if Config.allowedJobs[xPlayer.getJob().name] then
            local xTarget = ESX.GetPlayerFromId(target)
            if xTarget then
                RemoveLicense(xTarget.getIdentifier(), licenseType, cb)
                --# Start of modified code
                Citizen.CreateThread(function()
                    Citizen.Wait(1000)
                    TriggerEvent('esx_license:getLicenses', target, function(licenses)
                        TriggerClientEvent('vms_driveschoolv2:cl:getLicenses', target, licenses)
                        TriggerClientEvent('vms_flightschoolv2:cl:getLicenses', target, license)
                        TriggerClientEvent('vms_boatschoolv2:cl:getLicenses', target, license)
                    end)
                end)
                --# End of modifications
            end
        else
            xPlayer.showNotification('Your job is not allowed to remove the license', 'error', 3000)
        end
    end
end)

Last updated