Open Files Preview
Here you can see the open files of the blipcreator
config.lua
--[[
_ _ _____ ___ ____ ____ ____ ___ ____ _____ ____
| \ | |/ _ \ \ / / \ / ___| / ___| _ \|_ _| _ \_ _/ ___|
| \| | | | \ \ / / _ \ \___ \| | | |_) || || |_) || | \___ \
| |\ | |_| |\ V / ___ \ ___) | |___| _ < | || __/ | | ___) |
|_| \_|\___/ \_/_/ \_\ |____/ \____|_| \_\___|_| |_| |____/
https://nova-scripting.tebex.io/
https://nova-scripting.gitbook.io/docs
]]
Config = {}
Locales = {}
Config.Framework = 'ESX' -- ESX / QBCORE / QBOX / CUSTOM
Config.Locale = 'en' -- en / nl
Config.Debug = false -- Enable/disable debug prints
Config.Groups = { -- Groups allowed to use the blip creator
"admin",
"superadmin"
}
-- UI Color Configuration
Config.DarkColors = {
mainColor = "#4b0082",
hoverColor = "#4b0082",
backgroundColor = "#2b243a",
borderColor = "#241d34",
textColor = "#ffffff",
}
Config.LightColors = {
mainColor = "#b899ff",
hoverColor = "#a78bfa",
backgroundColor = "#f0e3fa",
borderColor = "#b899ff",
textColor = "#222",
}
client-utils.lua
-- Helper function to get localized text
function _U(str, ...)
if Locales[Config.Locale] and Locales[Config.Locale][str] then
local args = {...}
if #args > 0 then
return string.format(Locales[Config.Locale][str], ...)
else
return Locales[Config.Locale][str]
end
else
return 'Translation [' .. Config.Locale .. '][' .. str .. '] does not exist'
end
end
-- Debug print function - only prints when Config.Debug is true
function DebugPrint(...)
if Config.Debug then
print('[nv-blipcreator]', ...)
end
end
function ShowNotification(title, text, time, type)
SetNotificationTextEntry("STRING")
AddTextComponentString(text)
DrawNotification(0,1)
-- Default ESX Notify:
--TriggerEvent('esx:showNotification', text)
-- Default QB Notify:
--TriggerEvent('QBCore:Notify', text, 'info', 5000)
-- OKOK Notify:
-- exports['okokNotify']:Alert(title, text, time, type, false)
end
server-utils.lua
-- Debug print function - only prints when Config.Debug is true
function DebugPrint(...)
if Config.Debug then
print('[nv-blipcreator]', ...)
end
end
framework/server-framework.lua
Framework = nil
if Config['Framework']:upper() == 'ESX' then
Framework = exports['es_extended']:getSharedObject()
RegisterServerCallback = Framework.RegisterServerCallback
GetPlayerFromId = Framework.GetPlayerFromId
RegisterUsableItem = Framework.RegisterUsableItem
function GetName(source)
local xPlayer = GetPlayerFromId(source)
return xPlayer.getName()
end
function isInGroup(source, groupList)
xPlayer = GetPlayerFromId(source)
playerGroup = xPlayer.getGroup()
for _, group in ipairs(groupList) do
if group == playerGroup then
return true
end
end
return false
end
function GetPlayersFunction()
return Framework.GetPlayers()
end
function GetPlayerJobFunction(source)
local xPlayer = GetPlayerFromId(source)
PlayerJob = xPlayer.job.name
return PlayerJob
end
function AddMoneyFunction(source, type, amount)
local xPlayer = GetPlayerFromId(source)
xPlayer.addAccountMoney(type, amount)
end
function RemoveMoneyFunction(source, type, amount)
local xPlayer = GetPlayerFromId(source)
xPlayer.removeAccountMoney(type, amount)
end
function GetMoneyFunction(source, type)
local xPlayer = GetPlayerFromId(source)
return xPlayer.getAccount(type).money
end
function GetIdentifierFunction(source)
local xPlayer = GetPlayerFromId(source)
return xPlayer.identifier
end
elseif Config['Framework']:upper() == 'QBCORE' then
Framework = exports['qb-core']:GetCoreObject()
RegisterServerCallback = Framework.Functions.CreateCallback
GetPlayerFromId = Framework.Functions.GetPlayer
RegisterUsableItem = Framework.Functions.CreateUseableItem
function GetName(source)
local xPlayer = Framework.Functions.GetPlayer(source)
return xPlayer.Functions.GetName()
end
function isInGroup(source, groupList)
for _, group in ipairs(groupList) do
if Framework.Functions.HasPermission(source, group) then
return true
end
end
return false
end
function GetPlayersFunction()
return Framework.Functions.GetPlayers()
end
function GetPlayerJobFunction(source)
local xPlayer = GetPlayerFromId(source)
PlayerJob = xPlayer.PlayerData.job.name
return PlayerJob
end
function AddMoneyFunction(source, type, amount)
local xPlayer = Framework.Functions.GetPlayer(source)
xPlayer.Functions.AddMoney(type, amount)
end
function RemoveMoneyFunction(source, type, amount)
local xPlayer = Framework.Functions.GetPlayer(source)
xPlayer.Functions.RemoveMoney(type, amount)
end
function GetMoneyFunction(source, type)
local xPlayer = Framework.Functions.GetPlayer(source)
return xPlayer.Functions.GetMoney(type)
end
function GetIdentifierFunction(source)
local xPlayer = GetPlayerFromId(source)
return xPlayer.PlayerData.citizenid
end
elseif Config['Framework']:upper() == 'QBOX' then
Framework = exports['qbox-core']:GetCoreObject()
RegisterServerCallback = Framework.Functions.CreateCallback
GetPlayerFromId = Framework.Functions.GetPlayer
RegisterUsableItem = Framework.Functions.CreateUseableItem
function GetName(src)
local xPlayer = Framework.Functions.GetPlayer(source)
return xPlayer.Functions.GetName()
end
function isInGroup(src, groupList)
for _, group in ipairs(groupList) do
if Framework.Functions.HasPermission(src, group) then
return true
end
end
return false
end
function GetPlayersFunction()
return Framework.Functions.GetPlayers()
end
function GetPlayerJobFunction(source)
local xPlayer = GetPlayerFromId(source)
PlayerJob = xPlayer.PlayerData.job.name
return PlayerJob
end
function AddMoneyFunction(source, type, amount)
local xPlayer = GetPlayerFromId(source)
xPlayer.Functions.AddMoney(type, amount)
end
function RemoveMoneyFunction(source, type, amount)
local xPlayer = Framework.Functions.GetPlayer(source)
xPlayer.Functions.RemoveMoney(type, amount)
end
function GetMoneyFunction(source, type)
local xPlayer = Framework.Functions.GetPlayer(source)
return xPlayer.Functions.GetMoney(type)
end
function GetIdentifierFunction(source)
local xPlayer = GetPlayerFromId(source)
return xPlayer.PlayerData.citizenid
end
elseif Config['Framework']:upper() == 'CUSTOM' then
-- Uncomment the following lines if you have a custom framework
--[[Framework = exports['custom-framework']:GetCoreObject()
RegisterServerCallback = Framework.Functions.CreateCallback
GetPlayerFromId = Framework.Functions.GetPlayer
RegisterUsableItem = Framework.Functions.CreateUseableItem
function GetName(src)
local xPlayer = Framework.Functions.GetPlayer(source)
return xPlayer.Functions.GetName()
end
function isInGroup(src, groupList)
for _, group in ipairs(groupList) do
if Framework.Functions.HasPermission(src, group) then
return true
end
end
return false
end
function GetPlayersFunction()
return Framework.Functions.GetPlayers()
end
function GetPlayerJobFunction(source)
local xPlayer = GetPlayerFromId(source)
PlayerJob = xPlayer.PlayerData.job.name
return PlayerJob
end
function AddMoneyFunction(source, type, amount)
local xPlayer = GetPlayerFromId(source)
xPlayer.Functions.AddMoney(type, amount)
end
function RemoveMoneyFunction(source, type, amount)
local xPlayer = Framework.Functions.GetPlayer(source)
xPlayer.Functions.RemoveMoney(type, amount)
end
function GetMoneyFunction(source, type)
local xPlayer = Framework.Functions.GetPlayer(source)
return xPlayer.Functions.GetMoney(type)
end
function GetIdentifierFunction(source)
local xPlayer = GetPlayerFromId(source)
return xPlayer.PlayerData.citizenid
end --]]
print('Custom framework support is not implemented yet. Please implement your custom framework logic.')
else
print('Invalid framework specified in Config.lua. Please check your configuration.')
end
framework/client-framework.lua
Framework = nil
if Config['Framework']:upper() == 'ESX' then
Framework = exports['es_extended']:getSharedObject()
TriggerServerCallback = Framework.TriggerServerCallback
-- //Functions\\ --
function GetPlayerData()
return Framework.GetPlayerData()
end
function GetIdentifierFunction()
local xPlayer = GetPlayerData()
return xPlayer.identifier
end
elseif Config['Framework']:upper() == 'QBCORE' then
Framework = exports['qb-core']:GetCoreObject()
TriggerServerCallback = Framework.Functions.TriggerCallback
-- //Functions\\ --
function GetPlayerData()
return Framework.Functions.GetPlayerData()
end
function GetIdentifierFunction()
local xPlayer = GetPlayerData()
return xPlayer.citizenid
end
elseif Config['Framework']:upper() == 'QBOX' then
Framework = exports['qbox-core']:GetCoreObject()
TriggerServerCallback = Framework.Functions.TriggerCallback
-- //Functions\\ --
function GetPlayerData()
return Framework.Functions.GetPlayerData()
end
function GetIdentifierFunction()
local xPlayer = GetPlayerData()
return xPlayer.citizenid
end
elseif Config['Framework']:upper() == 'CUSTOM' then
-- Uncomment the following lines if you have a custom framework
--[[ Framework = exports['custom-framework']:GetCoreObject()
TriggerServerCallback = Framework.Functions.TriggerCallback
-- //Functions\\ --
function GetPlayerData()
return Framework.Functions.GetPlayerData()
end
function GetIdentifierFunction()
local xPlayer = GetPlayerData()
return xPlayer.citizenid
end --]]
print('Custom framework support is not implemented yet. Please implement your custom framework logic.')
else
print('Invalid framework specified in Config.lua. Please check your configuration.')
end
Last updated