Configuration
All Forever Development Scripts contain various editable and unobscured files containing, exports, client and server functions, configuration methods and more.
View Config
Shared = {}
Shared.vehicleItems = {
["security_card_01"] = "kuruma", -- Item name for vehicle 1
["stone"] = "jester", -- Item name for vehicle 2
-- Add new item names and vehicle names here
}
--█▀▀ █▀█ ▄▀█ █▀▄▀█ █▀▀ █░█░█ █▀█ █▀█ █▄▀
--█▀░ █▀▄ █▀█ █░▀░█ ██▄ ▀▄▀▄▀ █▄█ █▀▄ █░█
Shared.Framework = 'auto_detect' --[ 'auto_detect' / 'other' ] If you select 'auto_detect', only ESX and QBCore frameworks will be detected. Use 'other' for custom frameworks.
Shared.Notification = 'auto_detect' --[ 'auto_detect' / 'other' ] If you select 'auto_detect', only ESX, QBCore, okokNotify, ps-ui and ox_lib notifications will be detected. Use 'other' for custom notification resources.
Shared.SpawnVehicle = false -- Set this to false if you don't want to spawn the vehicle when using the item.
Shared.removeitem = true -- Set this to false if you don't want to remove the item from the inventory after it is used.
--█▀▄ █▀█ █▄░█ █▀█ ▀█▀ ▀█▀ █▀█ █░█ █▀▀ █░█ ▀█▀ █░█ █ █▀
--█▄▀ █▄█ █░▀█ █▄█ ░█░ ░█░ █▄█ █▄█ █▄▄ █▀█ ░█░ █▀█ █ ▄█
Shared.FrameworkTriggers = {
esx = { --If you have modified the default event names in the es_extended resource, change them here.
resource_name = 'es_extended',
main = 'esx:getSharedObject',
load = 'esx:playerLoaded',
job = 'esx:setJob'
},
qbcore = { --If you have modified the default event names in the qb-core resource, change them here.
resource_name = 'qb-core',
main = 'QBCore:GetObject',
load = 'QBCore:Client:OnPlayerLoaded',
job = 'QBCore:Client:OnJobUpdate',
gang = 'QBCore:Client:OnGangUpdate',
duty = 'QBCore:Client:SetDuty'
}
}
if Shared.Framework == 'auto_detect' then
if GetResourceState('es_extended') == 'started' then
Shared.Framework = 'esx'
elseif GetResourceState('qb-core') == 'started' then
Shared.Framework = 'qbcore'
end
if Shared.Framework == 'esx' or Shared.Framework == 'qbcore' then
for c, d in pairs(Shared.FrameworkTriggers[Shared.Framework]) do
Shared.FrameworkTriggers[c] = d
end
Shared.FrameworkTriggers.esx, Shared.FrameworkTriggers.qbcore = nil, nil
end
end
if Shared.Notification == 'auto_detect' then
if GetResourceState('okokNotify') == 'started' then
Shared.Notification = 'okokNotify'
elseif GetResourceState('ps-ui') == 'started' then
Shared.Notification = 'ps-ui'
elseif GetResourceState('ox_lib') == 'started' then
Shared.Notification = 'ox_lib'
else
Shared.Notification = Shared.Framework
if Shared.Notification == 'standalone' or Shared.Notification == 'vrp' then Config.Notification = 'chat' end
end
end
Notification
--███╗ ██╗ ██████╗ ████████╗██╗███████╗██╗ ██████╗ █████╗ ████████╗██╗ ██████╗ ███╗ ██╗███████╗
--████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██║██╔════╝██╔══██╗╚══██╔══╝██║██╔═══██╗████╗ ██║██╔════╝
--██╔██╗ ██║██║ ██║ ██║ ██║█████╗ ██║██║ ███████║ ██║ ██║██║ ██║██╔██╗ ██║███████╗
--██║╚██╗██║██║ ██║ ██║ ██║██╔══╝ ██║██║ ██╔══██║ ██║ ██║██║ ██║██║╚██╗██║╚════██║
--██║ ╚████║╚██████╔╝ ██║ ██║██║ ██║╚██████╗██║ ██║ ██║ ██║╚██████╔╝██║ ╚████║███████║
--╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝╚══════╝
RegisterNetEvent('fw-usableitem:notify')
AddEventHandler('fw-usableitem:notify', function(notif_type ,message)
Notification(notif_type ,message)
end)
function Notification(notif_type, message)
if notif_type and message then
if Shared.Notification == 'esx' then
ESX.ShowNotification(message)
elseif Shared.Notification == 'qbcore' then
if notif_type == 1 then
QBCore.Functions.Notify(message, 'success')
elseif notif_type == 2 then
QBCore.Functions.Notify(message, 'primary')
elseif notif_type == 3 then
QBCore.Functions.Notify(message, 'error')
end
elseif Shared.Notification == 'okokNotify' then
if notif_type == 1 then
exports['okokNotify']:Alert('Forever Script', message, 5000, 'success')
elseif notif_type == 2 then
exports['okokNotify']:Alert('Forever Script', message, 5000, 'info')
elseif notif_type == 3 then
exports['okokNotify']:Alert('Forever Script', message, 5000, 'error')
end
elseif Shared.Notification == 'ps-ui' then
if notif_type == 1 then
exports['ps-ui']:Notify(message, 'success', 5000)
elseif notif_type == 2 then
exports['ps-ui']:Notify(message, 'primary', 5000)
elseif notif_type == 3 then
exports['ps-ui']:Notify(message, 'error', 5000)
end
elseif Shared.Notification == 'ox_lib' then
if notif_type == 1 then
lib.notify({title = 'Forever Script', description = message, type = 'success'})
elseif notif_type == 2 then
lib.notify({title = 'Forever Script', description = message, type = 'inform'})
elseif notif_type == 3 then
lib.notify({title = 'Forever Script', description = message, type = 'error'})
end
elseif Shared.Notification == 'chat' then
TriggerEvent('chatMessage', message)
elseif Shared.Notification == 'other' then
--add your own notification.
end
end
end
Last updated