GangWars
Configurables
All config & open sourced files included within this script.
Config Files
--[[
BY RX Scripts © rxscripts.xyz
--]]
Config = {}
Config.Locale = 'en'
Config.DiscordWebhook = ''
Config.UseItem = 'wartablet' -- If false then enables command to open the interface instead of an item
Config.UseMoney = 'bank' -- Money type used for all money transactions
Config.OpenInterfaceCommand = "wartablet" -- Command to open the interface (only if UseItem is false)
Config.EndWagerCommand = "endwar" -- Command to end a war
Config.DisplayEnemyDistance = 100.0 -- From how far the players in active wars sees the enemy visibilities
Config.DisplayEnemyTitle = true
Config.DisplayEnemyMarker = true
Config.KillsToWin = 2 -- How many kills to win the war
Config.WagerMinimum = 100000 -- Minimum wager amount
Config.WagerMaximum = 10000000 -- Maximum wager amount
Config.TabletAnim = { -- Tablet opening animation
dict = "amb@code_human_in_bus_passenger_idles@female@tablet@base",
anim = "base",
}
Config.Gangs = { -- Match the key names with the job/gang names from the Jobs table
["ballas"] = {
Label = "Ballas",
Image = "ballas.png",
RequiredGrades = { -- Minimum grades required to use the interface for each action
sendWar = 2,
revokeWar = 2,
acceptWar = 2,
declineWar = 2,
manageBalance = 2,
}
},
["bloods"] = {
Label = "Bloods",
Image = "bloods.png",
RequiredGrades = { -- Minimum grades required to use the interface for each action
sendWar = 2,
revokeWar = 2,
acceptWar = 2,
declineWar = 2,
manageBalance = 2,
}
},
["vagos"] = {
Label = "Vagos",
Image = "vagos.png",
RequiredGrades = { -- Minimum grades required to use the interface for each action
sendWar = 2,
revokeWar = 2,
acceptWar = 2,
declineWar = 2,
manageBalance = 2,
}
},
}
Config.GroupsToEndWagers = { -- Groups that can end wagers with /endwager {gang}
"superadmin",
"admin",
"mod",
}
--[[
ONLY CHANGE THIS PART IF YOU HAVE RENAMED SCRIPTS SUCH AS FRAMEWORK, TARGET, INVENTORY ETC
RENAME THE SCRIPT NAME TO THE NEW NAME
--]]
---@type table Only change these if you have changed the name of a resource
Resources = {
ESX = { name = 'es_extended', export = 'getSharedObject' },
QB = { name = 'qb-core', export = 'GetCoreObject' },
AK47GANGS = { name = 'ak47_gangs', export = 'all' },
RCOREGANGS = { name = 'rcore_gangs', export = 'all' },
T1GERGANGS = { name = 't1ger_gangsystem', export = 'all' },
ORIGENILEGAL = { name = 'origen_ilegal', export = 'all' },
AK47AMBU = { name = 'ak47_ambulancejob', export = false },
AK47AMBUQB = { name = 'ak47_qb_ambulancejob', export = false },
}
IgnoreScriptFoundLogs = false
AmbulanceIntegratedDeathEvent = false -- Set this to true if you have integrated the death event in your ambulance job to prevent things like double deaths
Opensource Files
All script-related open source code is contained within these files. Third-party components, including frameworks, inventory systems, and other external code, are separately maintained & open sourced in our fmLib repository.
--[[
BY RX Scripts © rxscripts.xyz
--]]
function Notify(msg, type)
if ESX then
ESX.ShowNotification(msg, type)
elseif QB then
QB.Functions.Notify(msg, type)
end
end
function IsPlayerLoaded()
if ESX then
return ESX.GetPlayerData() and ESX.GetPlayerData().job
elseif QB then
return QB.Functions.GetPlayerData() and QB.Functions.GetPlayerData().gang
end
end
function GetPlayerData()
if ESX then
return ESX.GetPlayerData()
elseif QB then
return QB.Functions.GetPlayerData()
end
end
function GetJob()
if ESX then
return ESX.GetPlayerData().job
elseif QB then
return QB.Functions.GetPlayerData().job
end
end
function GetIdentifier()
if ESX then
return ESX.GetPlayerData().identifier
elseif QB then
return QB.Functions.GetPlayerData().citizenid
end
end
function GetGang()
if AK47GANGS then
local gang = AK47GANGS:GetPlayerGang()
return {
name = gang.tag,
rankid = gang.rankid
}
elseif RCOREGANGS then
return RCOREGANGS:GetPlayerGang()
elseif T1GERGANGS or ORIGENILEGAL then
return lib.callback.await('gw:getGang', false)
elseif ESX then
return GetJob()
elseif QB then
return QB.Functions.GetPlayerData().gang
end
end
function GetGangGrade()
local gang = GetGang()
if AK47GANGS then
return gang.rankid
elseif RCOREGANGS then
local identifier = GetIdentifier()
return gang.identifier == identifier and 2 or 1
elseif T1GERGANGS or ORIGENILEGAL then
return lib.callback.await('gw:getGangGrade', false)
elseif ESX then
return gang.grade
elseif QB then
return gang.grade.level
end
end
if AK47AMBU then
RegisterNetEvent('ak47_ambulancejob:onPlayerDeath', function()
while not LastKillerId do Wait(300) end
TriggerServerEvent('gw:onDeath', LastKillerId)
LastKillerId = nil
end)
end
if AK47AMBUQB then
RegisterNetEvent('ak47_qb_ambulancejob:onPlayerDeath', function()
while not LastKillerId do Wait(300) end
TriggerServerEvent('gw:onDeath', LastKillerId)
LastKillerId = nil
end)
end
--[[
BY RX Scripts © rxscripts.xyz
--]]
function Notify(src, msg, type)
if ESX then
TriggerClientEvent('esx:showNotification', src, msg, type)
elseif QB then
TriggerClientEvent('QBCore:Notify', src, msg, type)
end
end
function HasGroup(src, group)
if ESX then
return ESX.GetPlayerFromId(src).getGroup() == group
elseif QB then
return QB.Functions.HasPermission(src, group)
end
end
function GetIdentifier(src)
if ESX then
return ESX.GetPlayerFromId(src).identifier
elseif QB then
return QB.Functions.GetPlayer(src).PlayerData.citizenid
end
end
function GetJob(src)
if ESX then
return ESX.GetPlayerFromId(src).job
elseif QB then
return QB.Functions.GetPlayer(src).job
end
end
function GetGang(src)
if AK47GANGS then
local gang = AK47GANGS:GetPlayerGang(src)
return {
name = gang.tag,
rankid = gang.rankid
}
elseif RCOREGANGS then
return RCOREGANGS:GetPlayerGang(src)
elseif T1GERGANGS then
return T1GERGANGS:GetPlayerGang(src)
elseif ORIGENILEGAL then
return {
name = ORIGENILEGAL:GetGangID(src),
}
elseif ESX then
return GetJob(src)
elseif QB then
return QB.Functions.GetPlayer(src).PlayerData.gang
end
end
-- Should return a number
function GetGangGrade(src)
local gang = GetGang(src)
if AK47GANGS then
return gang.rankid
elseif RCOREGANGS then
local identifier = GetIdentifier(src)
return gang.identifier == identifier and 2 or 1
elseif T1GERGANGS then
local rank, label = T1GERGANGS:GetPlayerGangRank(src)
return rank
elseif ORIGENILEGAL then
return 1
elseif ESX then
return gang.grade
elseif QB then
return gang.grade.level
end
end
lib.callback.register('gw:getGang', function(src)
return GetGang(src)
end)
lib.callback.register('gw:getGangGrade', function(src)
return GetGangGrade(src)
end)
---@return table sources
function GetOnlineGangMembers(gang)
local sources = {}
if ESX then
local players = ESX.GetExtendedPlayers()
for k, v in pairs(players) do
if GetGang(v.source).name == gang then
sources[#sources+1] = v.source
end
end
elseif QB then
local players = QB.Functions.GetPlayers()
for i = 1, #players do
local player = players[i]
local playerGang = GetGang(player).name
if playerGang == gang then
sources[#sources+1] = player
end
end
end
return sources
end
function GetMoney(src, type)
if ESX then
return ESX.GetPlayerFromId(src).getAccount(type).money
elseif QB then
return QB.Functions.GetPlayer(src).PlayerData.money[type]
end
end
function RemoveMoney(src, type, amount)
if ESX then
ESX.GetPlayerFromId(src).removeAccountMoney(type, amount)
elseif QB then
QB.Functions.GetPlayer(src).Functions.RemoveMoney(type, amount)
end
end
function AddMoney(src, type, amount)
if ESX then
ESX.GetPlayerFromId(src).addAccountMoney(type, amount)
elseif QB then
QB.Functions.GetPlayer(src).Functions.AddMoney(type, amount)
end
end