Configuration
This is the configuration that you can give to this script to modify it to your liking
The framework is autodetected but you can change it to a custom one in the shared editable.
Config File
Config = {}
Config.Debug = false -- [
-- When you have a problem or error with the script, activate it and send us a video
-- at the support you are being attended to so that we can get to the problem as
-- quickly as possible.
-- ]
Config.DrawMarker = 10.0
Config.MarkerLobbyColor = { r = 0, g = 255, b = 0, a = 255}
Config.MarkSize = { x = 0.3, y = 0.3, z = 0.3 }
Config.MarkerType = 2
Config.DrawDistance = 3.0
Config.DefaultRoutingBucket = 0 -- Don't touch this if you don't know what it is
Config.LobbyAnimTablet = true
Config.LeavePaintballCmd = 'leavepaintball'
Config.FixExitLobby = true -- [
-- After finishing the game to prevent the character from spawning in the lobby (0, 0, 0, 0)
-- for some reason it happens with QBCore Ambulance, it is advisable to activate it
-- (This will make the character return to the lobby after 5 seconds).
-- ]
Config.UseNameIC = true -- [
----------------------------------------------------------------------------------------
-- [HIGHLY RECOMMENDED TO SET IT TO "true" IF YOU USE ANY KIND OF COMMAND TO LOGOUT.]
----------------------------------------------------------------------------------------
-- Choose what kind of names you want to be saved in the statistics and displayed
-- in the game, it is important to change it only once, otherwise there could be
-- conflicts (if you change it clean the database).
-- ]
-------------------------------------------------------------------------
-- /$$ /$$$$$$ /$$$$$$$ /$$$$$$$ /$$ /$$
-- | $$ /$$__ $$| $$__ $$| $$__ $$| $$ /$$/
-- | $$ | $$ \ $$| $$ \ $$| $$ \ $$ \ $$ /$$/
-- | $$ | $$ | $$| $$$$$$$ | $$$$$$$ \ $$$$/
-- | $$ | $$ | $$| $$__ $$| $$__ $$ \ $$/
-- | $$ | $$ | $$| $$ \ $$| $$ \ $$ | $$
-- | $$$$$$$$| $$$$$$/| $$$$$$$/| $$$$$$$/ | $$
-- |________/ \______/ |_______/ |_______/ |__/
-------------------------------------------------------------------------
-- Configure and add lobbies in as many parts of the map as you need, remember that all lobbies are synchronized into one.
Config.LobbyLocations = {
{ --- Template for different lobbies
pos = vector3(-269.9229, -2030.7517, 30.1456), -- Location Lobby
blip = {
label = 'Paintball Lobby #1',
sprite = 1,
colour = 2,
scale = 1.0,
},
marked = {
enabled = true, -- Enable Marker
},
ped = {
enabled = true, -- Enable Ped
model = 'csb_ramp_marine', -- Ped Model, you can search here (https://docs.fivem.net/docs/game-references/ped-models/)
heading = 337.4171 -- Headind ped
}
},
-- {
-- pos = vector3(-263.8758, -2031.6617, 30.1456),
-- marked = {
-- enabled = true
-- },
-- blip = {
-- label = 'Paintball Lobby #2',
-- sprite = 1,
-- colour = 2,
-- scale = 1.0,
-- },
-- ped = {
-- enabled = true,
-- model = 'csb_ramp_marine',
-- heading = 101.6388
-- }
-- }
}
-------------------------------------------------------------------------
-- /$$ /$$ /$$$$$$ /$$$$$$$ /$$$$$$
-- | $$$ /$$$ /$$__ $$| $$__ $$ /$$__ $$
-- | $$$$ /$$$$| $$ \ $$| $$ \ $$| $$ \__/
-- | $$ $$/$$ $$| $$$$$$$$| $$$$$$$/| $$$$$$
-- | $$ $$$| $$| $$__ $$| $$____/ \____ $$
-- | $$\ $ | $$| $$ | $$| $$ /$$ \ $$
-- | $$ \/ | $$| $$ | $$| $$ | $$$$$$/
-- |__/ |__/|__/ |__/|__/ \______/
-------------------------------------------------------------------------
-- Configure and add maps if desired, to enhance and add to the gaming experience.
Config.MapsLocation = {
[1] = {
identifier = 'miningyard',
label = 'Mining Yard',
location = vector3(837.7547, -3237.563, -98.69907),
timer = 3.0,
teamspawn = {
blue = {
[1] = vector4(837.7547, -3237.563, -98.69907, 261.7256),
[2] = vector4(838.248, -3233.667, -98.2677, 261.7256),
[3] = vector4(839.9142, -3242.688, -98.2677, 261.7256),
[4] = vector4(843.363, -3238.762, -98.2677, 261.7256),
[5] = vector4(843.8671, -3235.073, -98.2677, 261.7256),
[6] = vector4(841.0626, -3235.8845, -98.6992, 282.2873),
[7] = vector4(843.0455, -3237.1731, -98.6992, 275.1870),
[8] = vector4(844.7842, -3241.4214, -98.6992, 276.4190),
[9] = vector4(846.4545, -3245.1321, -98.6992, 269.8734),
[10] = vector4(849.7571, -3239.1995, -98.6992, 292.5247),
},
red = {
[1] = vector4(943.3898, -3202.1, -98.2677, 182.0932),
[2] = vector4(941.5729, -3199.873, -98.2677, 182.0932),
[3] = vector4(940.0148, -3197.435, -98.2677, 182.0932),
[4] = vector4(946.84, -3200.915, -98.2677, 182.0932),
[5] = vector4(946.439, -3204.836, -98.2677, 182.0932),
[6] = vector4(942.8236, -3203.4043, -98.2687, 165.0064),
[7] = vector4(946.0306, -3204.8420, -98.2723, 179.2486),
[8] = vector4(940.2747, -3204.8574, -98.2688, 169.3481),
[9] = vector4(937.3462, -3203.9609, -98.2657, 143.4347),
[10] = vector4(946.6067, -3201.3655, -98.2679, 183.0146),
}
},
loadout = {
[1] = { type = 'weapon', name = 'weapon_carbinerifle', count = 1, ammo = 500},
[2] = { type = 'item', name = 'armor', count = 1}
}
},
[2] = {
identifier = 'officeroom',
label = 'Officie Room',
timer = 3.0,
location = vector3(366.3301, 4846.624, -62.59954),
teamspawn = {
blue = {
[1] = vector4(414.5289, 4842.817, -62.59937, 93.2024),
[2] = vector4(414.8484, 4840.498, -62.59937, 93.2024),
[3] = vector4(414.4725, 4838.005, -62.59937, 93.2024),
[4] = vector4(413.9238, 4835.75, -62.59937, 93.2024),
[5] = vector4(414.5091, 4846.365, -62.59937, 93.2024),
[6] = vector4(408.0649, 4838.5981, -62.5994, 93.2024),
[7] = vector4(407.5100, 4841.9248, -62.5994, 94.7626),
[8] = vector4(407.4342, 4845.0503, -62.5994, 69.4861),
[9] = vector4(409.0217, 4843.3696, -62.5994, 111.2999),
[10] = vector4(408.5268, 4838.3418, -62.5994, 88.0551)
},
red = {
[1] = vector4(323.0623, 4878.644, -62.59945, 224.1086),
[2] = vector4(325.7256, 4881.005, -62.59945, 224.1086),
[3] = vector4(319.4958, 4877.771, -62.59945, 224.1086),
[4] = vector4(321.718, 4874.785, -62.59945, 224.1086),
[5] = vector4(319.099, 4872.184, -62.59945, 224.1086),
[6] = vector4(323.6065, 4876.3867, -62.5995, 214.6182),
[7] = vector4(322.7737, 4873.8232, -62.5994, 201.2718),
[8] = vector4(323.2453, 4868.9224, -62.5994, 215.7558),
[9] = vector4(326.0453, 4870.2310, -62.5994, 241.3321),
[10] = vector4(328.7314, 4872.0176, -62.5994, 251.2598),
}
},
loadout = {
[1] = { type = 'weapon', name = 'weapon_carbinerifle', count = 1, ammo = 500},
[2] = { type = 'item', name = 'armor', count = 1}
}
},
}
-------------------------------------------------------------------------
-- /$$$$$$ /$$ /$$ /$$$$$$$$ /$$$$$$$$ /$$$$$$ /$$$$$$$$ /$$$$$$
-- /$$__ $$| $$ | $$|__ $$__/| $$_____/|_ $$_/|__ $$__//$$__ $$
-- | $$ \ $$| $$ | $$ | $$ | $$ | $$ | $$ | $$ \__/
-- | $$ | $$| $$ | $$ | $$ | $$$$$ | $$ | $$ | $$$$$$
-- | $$ | $$| $$ | $$ | $$ | $$__/ | $$ | $$ \____ $$
-- | $$ | $$| $$ | $$ | $$ | $$ | $$ | $$ /$$ \ $$
-- | $$$$$$/| $$$$$$/ | $$ | $$ /$$$$$$ | $$ | $$$$$$/
-- \______/ \______/ |__/ |__/ |______/ |__/ \______/
-------------------------------------------------------------------------
-- Configure the sets of each equipment so that they can be differentiated from each other.
Config.Outfit = {
man = {
red = {
mask = 33,
maskTexture = 4,
pants = 3,
pantsTexture = 5,
torso = 1,
torsoTexture = 4,
tshirt = 15,
tshirtTexture = 0,
arms = 0,
armsTexture = 0,
shoes = 1,
shoesTexture = 0
},
blue = {
mask = 33,
maskTexture = 3,
pants = 3,
pantsTexture = 3,
torso = 1,
torsoTexture = 5,
tshirt = 15,
tshirtTexture = 0,
arms = 0,
armsTexture = 0,
shoes = 1,
shoesTexture = 0
}
},
women = {
red = {
mask = 33,
maskTexture = 4,
pants = 0,
pantsTexture = 9,
torso = 0,
torsoTexture = 4,
tshirt = 15,
tshirtTexture = 0,
arms = 0,
armsTexture = 0,
shoes = 1,
shoesTexture = 0
},
blue = {
mask = 33,
maskTexture = 3,
pants = 0,
pantsTexture = 4,
torso = 0,
torsoTexture = 6,
tshirt = 15,
tshirtTexture = 0,
arms = 0,
armsTexture = 0,
shoes = 1,
shoesTexture = 0
}
}
}
-------------------------------------------------------------------------
-- /$$$$$$ /$$$$$$ /$$ /$$ /$$ /$$ /$$$$$$$
-- /$$__ $$ /$$__ $$| $$ | $$| $$$ | $$| $$__ $$
-- | $$ \__/| $$ \ $$| $$ | $$| $$$$| $$| $$ \ $$
-- | $$$$$$ | $$ | $$| $$ | $$| $$ $$ $$| $$ | $$
-- \____ $$| $$ | $$| $$ | $$| $$ $$$$| $$ | $$
-- /$$ \ $$| $$ | $$| $$ | $$| $$\ $$$| $$ | $$
-- | $$$$$$/| $$$$$$/| $$$$$$/| $$ \ $$| $$$$$$$/
-- \______/ \______/ \______/ |__/ \__/|_______/
-------------------------------------------------------------------------
-- Configure sound system
Config.SoundResource = 'xsound'
Config.EnabledBackgroundSound = true
Config.SoundUrl = {
Lobby = {
url = 'https://dl.sndup.net/wdf8/lobby_bg.mp3',
vol = 0.02
},
Win = {
url = 'https://dl.sndup.net/t3zd/go.mp3',
vol = 1.0
}
}
Client Side Editable
/shared/cl_editable.lua
-- Don't touch this
ESX = nil
QBCore = nil
isLoaded = false
isDeadPlayer = false
----------------------
if GetResourceState('es_extended') == 'started' then
debugprint('Framework Detected: ^2ESX ^0| Resource: ^2es_extended')
ESX = exports['es_extended']:getSharedObject()
end
if GetResourceState('qb-core') == 'started' then
debugprint('Framework Detected: ^2QBCore ^0| Resource: ^2qb-core')
QBCore = exports['qb-core']:GetCoreObject()
end
-- Load Player
if ESX then
AddEventHandler('esx:onPlayerSpawn', function()
ESX.PlayerData = ESX.GetPlayerData()
if not isLoaded then
isLoaded = true
StartLoaded()
end
TriggerServerEvent('biyei_hpaintball:server:checkLastDisconnect')
end)
RegisterNetEvent('esx:onPlayerLogout')
AddEventHandler('esx:onPlayerLogout', function()
StopGame(true, true)
end)
elseif QBCore then
AddEventHandler('QBCore:Client:OnPlayerLoaded', function()
QBCore.PlayerData = QBCore.Functions.GetPlayerData()
if not isLoaded then
isLoaded = true
StartLoaded()
end
TriggerServerEvent('biyei_hpaintball:server:checkLastDisconnect')
end)
RegisterNetEvent('QBCore:Client:OnPlayerUnload')
AddEventHandler('QBCore:Client:OnPlayerUnload', function()
StopGame(true, true)
end)
end
-- Notifications
Notify = function(text, type)
if ESX ~= nil then
TriggerEvent('esx:showNotification', text)
elseif QBCore ~= nil then
TriggerEvent('QBCore:Notify', text, type)
end
end
HaveItems = function()
if ESX ~= nil then
ESX.PlayerData = ESX.GetPlayerData()
if json.encode(ESX.GetPlayerData().inventory) == '[]' then
return false
else
return true
end
elseif QBCore ~= nil then
QBCore.PlayerData = QBCore.Functions.GetPlayerData()
if json.encode(QBCore.PlayerData.items) == '[]' then
return false
else
return true
end
end
return false
end
-- Get Names
GetName = function()
if Config.UseNameIC then
if QBCore ~= nil then
return QBCore.PlayerData.charinfo.firstname .. ' '.. QBCore.PlayerData.charinfo.lastname
elseif ESX ~= nil then
return ESX.GetPlayerData().firstName .. ' ' .. ESX.GetPlayerData().lastName
end
else
return GetPlayerName(PlayerId())
end
end
-- Detect Dead
DetectDead = function(map, team, slot)
if ESX ~= nil then
if IsEntityDead(PlayerPedId()) then
SetPlayerInvincible(PlayerId(), true)
Citizen.Wait(1000)
if not isDeadPlayer then
RespawnTimer(map, team, slot)
UpdateDeath()
isDeadPlayer = true
end
end
elseif QBCore ~= nil then
QBCore.Functions.GetPlayerData(function(PlayerData)
if PlayerData.metadata["isdead"] or PlayerData.metadata["inlaststand"] then
SetPlayerInvincible(PlayerId(), true)
Citizen.Wait(1000)
if not isDeadPlayer then
RespawnTimer(map, team, slot)
UpdateDeath()
isDeadPlayer = true
end
end
end)
end
end
-- Revive Player
RevivePlayer = function()
if ESX ~= nil then
TriggerEvent('esx_ambulancejob:revive')
elseif QBCore ~= nil then
TriggerEvent('hospital:client:Revive')
end
SetPlayerInvincible(PlayerId(), false)
Wait(1000)
isDeadPlayer = false
end
-- Reset Outfit
if GetResourceState('qb-clothing') == 'started' then clothing = 'qb-clothing' end
if GetResourceState('illenium-appearance') == 'started' then clothing = 'illenium-appearance' end
if GetResourceState('esx_skin') == 'started' then clothing = 'esx_skin' end
ResetOutfit = function()
if clothing == 'qb-clothing' then
TriggerServerEvent("qb-clothes:loadPlayerSkin")
elseif clothing == 'illenium-appearance' then
TriggerEvent('illenium-appearance:client:reloadSkin', true)
elseif clothing == 'esx_skin' then
local fullskin
TriggerEvent('skinchanger:getSkin', function(skin) sex = skin.sex fullSkin = skin end)
TriggerEvent('skinchanger:loadSkin', fullSkin)
end
end
-- Check Inventory
if GetResourceState('ox_inventory') == 'started' then inventory = 'ox_inventory' end
if GetResourceState('qb-inventory') == 'started' then inventory = 'qb-inventory' end
if GetResourceState('origen_inventory') == 'started' then inventory = 'origen_inventory' end
if GetResourceState('chezza_inventory') == 'started' then inventory = 'chezza_inventory' end
-- Open Stash
OpenStash = function()
if ESX ~= nil then
owner = ESX.PlayerData.identifier
stashId = 'xpaintball' .. owner
elseif QBCore ~= nil then
QBCore.PlayerData = QBCore.Functions.GetPlayerData()
owner = QBCore.PlayerData.citizenid
stashId = 'xpaintball' .. owner
end
debugprint('Opening Stash ^3' .. stashId)
StashSlots = 40
StashCapacity = 40000
if inventory == 'ox_inventory' then
TriggerServerEvent('biyei_hpaintball:server:registerOXStash', stashId, StashSlots, StashCapacity, owner)
exports.ox_inventory:openInventory('stash', {
id = stashId,
owner = owner
})
elseif inventory == 'qb-inventory' then
TriggerServerEvent('inventory:server:OpenInventory', 'stash', stashId, { maxweight = StashCapacity * 1000, slots = StashSlots })
TriggerEvent('inventory:client:SetCurrentStash', stashId)
elseif inventory == 'origen_inventory' then
TriggerServerEvent('inventory:server:OpenInventory', 'stash', stashId, { maxweight = StashCapacity * 1000, slots = StashSlots })
TriggerEvent('inventory:client:SetCurrentStash', stashId)
elseif inventory == 'chezza_inventory' then
TriggerEvent('inventory:openInventory', {
type = 'stash',
id = tostring(stashId),
title = 'Paintball Stash',
weight = StashCapacity,
delay = 0,
save = true,
})
end
debugprint('Inventory Detected ^3' .. inventory)
end
Server Side Editable
/shared/sv_editable.lua
BotToken = '' -- It is important to put a discord token to show the pictures.
local Framework
local ESX, QBCore
if GetResourceState('es_extended') == 'started' then
debugprint('Framework Detected: ^2ESX ^0| Resource: ^2es_extended')
ESX = exports['es_extended']:getSharedObject()
Framework = 'ESX'
end
if GetResourceState('qb-core') == 'started' then
debugprint('Framework Detected: ^2QBCore ^0| Resource: ^2qb-core')
QBCore = exports['qb-core']:GetCoreObject()
Framework = 'QBCore'
end
-- Get Player Name
GetName = function(source)
if Config.UseNameIC then
if ESX ~= nil then
local xPlayer = ESX.GetPlayerFromId(source)
if xPlayer ~= nil then
return xPlayer.getName()
end
elseif QBCore ~= nil then
local player = QBCore.Functions.GetPlayer(source)
if player ~= nil then
return player.PlayerData.charinfo.firstname .. " " .. player.PlayerData.charinfo.lastname
end
end
else
return GetPlayerName(source)
end
end
-- Get Player Identifier
GetIdentifier = function(source)
local src = source
if ESX ~= nil then
local xPlayer = ESX.GetPlayerFromId(src)
if xPlayer ~= nil then
debugprint('Identifier Player: ^2'..xPlayer.identifier)
return xPlayer.identifier
end
elseif QBCore ~= nil then
local player = QBCore.Functions.GetPlayer(src)
if player ~= nil then
debugprint('Identifier Player: ^2'..player.PlayerData.citizenid)
return player.PlayerData.citizenid
end
end
end
-- Check Inventory
if GetResourceState('ox_inventory') == 'started' then inventory = 'ox_inventory' end
if GetResourceState('qb-inventory') == 'started' then inventory = 'qb-inventory' end
if GetResourceState('origen_inventory') == 'started' then inventory = 'origen_inventory' end
if GetResourceState('chezza_inventory') == 'started' then inventory = 'chezza_inventory' end
-- Give Item
GiveItem = function(source, type, item, count, ammo)
if ESX ~= nil then
local xPlayer = ESX.GetPlayerFromId(source)
if type == 'item' then
xPlayer.addInventoryItem(item, count)
elseif type == 'weapon' then
if inventory == 'ox_inventory' then
exports.ox_inventory:AddItem(source, item, count, {ammo = ammo})
else
xPlayer.addInventoryItem(item, count)
end
end
elseif QBCore ~= nil then
local player = QBCore.Functions.GetPlayer(source)
if type == 'item' then
player.Functions.AddItem(item, count)
elseif type == 'weapon' then
player.Functions.AddItem(item, count, false, {ammo = ammo})
end
end
end
-- Clear Inventory
ClearInventory = function(source)
if ESX ~= nil then
if inventory == 'ox_inventory' then
exports.ox_inventory:ClearInventory(source)
else
TriggerEvent('esx:playerInventoryCleared', source)
end
elseif QBCore ~= nil then
local player = QBCore.Functions.GetPlayer(source)
player.Functions.ClearInventory()
end
end
RegisterNetEvent('biyei_hpaintball:server:registerOXStash')
AddEventHandler('biyei_hpaintball:server:registerOXStash', function(stashId, slots, capacity, owner)
if not slots then
slots = 50
end
if not capacity then
capacity = 20000
end
exports.ox_inventory:RegisterStash(stashId, 'Locker', slots, capacity, owner)
end)
-- It adds you in the database that you are inside the paintball map.
RegisterNetEvent('biyei_hpaintball:server:setCoordsLastDisconnect')
AddEventHandler('biyei_hpaintball:server:setCoordsLastDisconnect', function(coords)
local src = source
if ESX then
local xPlayer = ESX.GetPlayerFromId(src)
MySQL.update('UPDATE users SET is_inPaintball = ? WHERE identifier = ?', { 1, GetIdentifier(src) })
MySQL.update('UPDATE users SET last_paintball_loc = ? WHERE identifier = ?', { json.encode(coords), GetIdentifier(src) })
elseif QBCore then
local xPlayer = QBCore.Functions.GetPlayer(src)
MySQL.update('UPDATE players SET is_inPaintball = ? WHERE citizenid = ?', { 1, GetIdentifier(src) })
MySQL.update('UPDATE players SET last_paintball_loc = ? WHERE citizenid = ?', { json.encode(coords), GetIdentifier(src) })
end
end)
-- It removes you from the database that you are not inside the paintball map.
RegisterNetEvent('biyei_hpaintball:server:removeCoordsLastDisconnect')
AddEventHandler('biyei_hpaintball:server:removeCoordsLastDisconnect', function()
local src = source
if ESX then
local xPlayer = ESX.GetPlayerFromId(src)
MySQL.update('UPDATE users SET is_inPaintball = ? WHERE identifier = ?', { 0, GetIdentifier(src) })
MySQL.update('UPDATE users SET last_paintball_loc = ? WHERE identifier = ?', { nil, GetIdentifier(src) })
elseif QBCore then
local xPlayer = QBCore.Functions.GetPlayer(src)
MySQL.update('UPDATE players SET is_inPaintball = ? WHERE citizenid = ?', { 0, GetIdentifier(src) })
MySQL.update('UPDATE players SET last_paintball_loc = ? WHERE citizenid = ?', { nil, GetIdentifier(src) })
end
end)
-- Check if you are disconnected inside the paintball map
RegisterNetEvent('biyei_hpaintball:server:checkLastDisconnect')
AddEventHandler('biyei_hpaintball:server:checkLastDisconnect', function()
local src = source
if ESX then
local xPlayer = ESX.GetPlayerFromId(src)
MySQL.scalar('SELECT is_inPaintball FROM users WHERE identifier = ?', {GetIdentifier(src)}, function(result)
if result == 1 then
ClearInventory(src)
MySQL.update('UPDATE users SET is_inPaintball = ? WHERE identifier = ?', { 0, GetIdentifier(src) })
MySQL.scalar('SELECT last_paintball_loc FROM users WHERE identifier = ?', {GetIdentifier(src)}, function(result)
if result then
SendToLobby(src, result)
MySQL.update('UPDATE users SET last_paintball_loc = ? WHERE identifier = ?', { nil, GetIdentifier(src) })
end
end)
end
end)
elseif QBCore then
local xPlayer = QBCore.Functions.GetPlayer(src)
MySQL.scalar('SELECT is_inPaintball FROM players WHERE citizenid = ?', {GetIdentifier(src)}, function(result)
if result == 1 then
ClearInventory(src)
MySQL.update('UPDATE players SET is_inPaintball = ? WHERE citizenid = ?', { 0, GetIdentifier(src) })
MySQL.scalar('SELECT last_paintball_loc FROM players WHERE citizenid = ?', {GetIdentifier(src)}, function(result)
if result then
SendToLobby(src, result)
MySQL.update('UPDATE players SET last_paintball_loc = ? WHERE citizenid = ?', { nil, GetIdentifier(src) })
end
end)
end
end)
end
end)
Last updated