LOCKING SYSTEM [ESX]

CFG:

CodeUnity_LockingSystems_Cfg = {}

CodeUnity_LockingSystems_Cfg.Key = {
    Key = 'U',
    Description = 'Open/Close Vehicle'
}

CodeUnity_LockingSystems_Cfg.Lang = 'en'

CodeUnity_LockingSystems_Cfg.Translations = {
    ['en'] = {
        ['Notify_Close_Vehicle'] = 'You locked the vehicle!',
        ['Notify_Open_Vehicle'] = 'You have opened the vehicle!',
        ['Notify_Not_Owned_Vehicle'] = 'The vehicle is not yours or your company\'s',
        ['Notify_No_Vehicle_Nearby'] = 'No vehicles near you!'
    }
}

CodeUnity_LockingSystems_Cfg.Notify = function (Side, Msg)
    if Side == 'Client' then
        ESX.ShowNotification(Msg)
    end
end

CodeUnity_LockingSystems_Cfg.CheckJobs = function (Side, Job, Src)
    if Side == 'Client' then
        if ESX.GetPlayerData() and ESX.GetPlayerData().job and ESX.GetPlayerData().job.name == Job then
            return true 
        else
            return false
        end
    end
    return false
end


CodeUnity_LockingSystems_Cfg.CheckOwnedVehicles = function (xPlayer,plate)
    MySQL.Async.fetchAll('SELECT 1 FROM owned_vehicles WHERE owner = @owner AND plate = @plate', {
		['@owner'] = xPlayer.identifier,
		['@plate'] = plate
	}, function(result)
		return(result[1] ~= nil)
	end)
end

Last updated