Skip to content

Commit

Permalink
chore: removed the management of the second job
Browse files Browse the repository at this point in the history
The management of the second job has been removed, in this framework (server) the second job will be managed as illegal work and therefore unofficial
  • Loading branch information
bitpredator committed Jul 14, 2024
1 parent 8b8528d commit 7a952bc
Show file tree
Hide file tree
Showing 10 changed files with 1 addition and 290 deletions.
99 changes: 0 additions & 99 deletions server-data/resources/[bpt_addons]/bpt_menu/client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,6 @@ addPersonalMenuCategory("boss", TranslateCap("bossmanagement_title"), function()
return GetPlayerJob().isBoss
end)

if Config.DoubleJob then
addPersonalMenuCategory("boss2", TranslateCap("bossmanagement2_title"), function()
return GetPlayerJob2().isBoss
end)
end

addPersonalMenuCategory("admin", TranslateCap("admin_title"), function()
return adminGroups[PlayerVars.group] ~= nil
end)
Expand Down Expand Up @@ -439,99 +433,6 @@ getPersonalMenuCategory("boss").drawer = function()
end)
end

local societyMoney2 = {}
if Config.DoubleJob then
getPersonalMenuCategory("boss2").drawer = function()
if societyMoney ~= nil then
RageUI.Button(TranslateCap("bossmanagement2_chest_button"), nil, { RightLabel = ("$%s"):format(GroupDigits(societyMoney2)) }, true, nil)
end

RageUI.Button(TranslateCap("bossmanagement2_hire_button"), nil, nil, true, function(Hovered, Active, Selected)
if not Selected then
return
end

local playerJob = GetPlayerJob2()

if not playerJob.isBoss then
GameNotification(TranslateCap("missing_rights"))
return
end

local closestPlayer, closestDistance = GetClosestPlayer()
if closestPlayer == -1 or closestDistance > 3.0 then
GameNotification(TranslateCap("players_nearby"))
return
end

TriggerServerEvent("bpt_personalmenu:Boss_recruterplayer2", GetPlayerServerId(closestPlayer))
end)

RageUI.Button(TranslateCap("bossmanagement2_fire_button"), nil, nil, true, function(Hovered, Active, Selected)
if not Selected then
return
end

local playerJob = GetPlayerJob2()

if not playerJob.isBoss then
GameNotification(TranslateCap("missing_rights"))
return
end

local closestPlayer, closestDistance = GetClosestPlayer()
if closestPlayer == -1 or closestDistance > 3.0 then
GameNotification(TranslateCap("players_nearby"))
return
end

TriggerServerEvent("bpt_personalmenu:Boss_virerplayer2", GetPlayerServerId(closestPlayer))
end)

RageUI.Button(TranslateCap("bossmanagement2_promote_button"), nil, nil, true, function(Hovered, Active, Selected)
if not Selected then
return
end

local playerJob = GetPlayerJob2()

if not playerJob.isBoss then
GameNotification(TranslateCap("missing_rights"))
return
end

local closestPlayer, closestDistance = GetClosestPlayer()
if closestPlayer == -1 or closestDistance > 3.0 then
GameNotification(TranslateCap("players_nearby"))
return
end

TriggerServerEvent("bpt_personalmenu:Boss_promouvoirplayer2", GetPlayerServerId(closestPlayer))
end)

RageUI.Button(TranslateCap("bossmanagement2_demote_button"), nil, nil, true, function(Hovered, Active, Selected)
if not Selected then
return
end

local playerJob = GetPlayerJob2()

if not playerJob.isBoss then
GameNotification(TranslateCap("missing_rights"))
return
end

local closestPlayer, closestDistance = GetClosestPlayer()
if closestPlayer == -1 or closestDistance > 3.0 then
GameNotification(TranslateCap("players_nearby"))
return
end

TriggerServerEvent("bpt_personalmenu:Boss_destituerplayer2", GetPlayerServerId(closestPlayer))
end)
end
end

getPersonalMenuCategory("admin").drawer = function()
for i = 1, #Config.AdminCommands do
local adminCommandCfg = Config.AdminCommands[i]
Expand Down
44 changes: 1 addition & 43 deletions server-data/resources/[bpt_addons]/bpt_menu/client/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,7 @@ if Config.Framework == "esx" then
job = {},
}

local societyMoney, societyMoney2 = nil, nil

if Config.DoubleJob then
playerData.job2 = {}
end
local societyMoney = nil

local function parsePlayerJob(job, xPlayerJob)
job.id = xPlayerJob.name
Expand All @@ -58,16 +54,6 @@ if Config.Framework == "esx" then
return societyMoney
end

if Config.DoubleJob then
function GetPlayerJob2()
return playerData.job2
end

function GetSocietyMoney2()
return societyMoney2
end
end

local function refreshMoney()
local playerJob = GetPlayerJob()

Expand All @@ -78,38 +64,16 @@ if Config.Framework == "esx" then
end
end

local function refreshMoney2()
local playerJob2 = GetPlayerJob2()

if playerJob2.isBoss then
ESX.TriggerServerCallback("esx_society:getSocietyMoney", function(money)
societyMoney2 = money
end, playerJob2.id)
end
end

RegisterNetEvent("esx:setJob", function(job)
parsePlayerJob(playerData.job, job)
refreshMoney()
end)

RegisterNetEvent("esx:setJob2", function(job)
parsePlayerJob(playerData.job2, job)
refreshMoney2()
end)

RegisterNetEvent("bpt_addonaccount:setMoney", function(societyId, money)
local playerJob = GetPlayerJob()
if playerJob.isBoss and ("society_%s"):format(playerJob.id) == societyId then
societyMoney = money
end

if Config.DoubleJob then
local playerJob = GetPlayerJob2()
if playerJob2.isBoss and ("society_%s"):format(playerJob2.id) == societyId then
societyMoney2 = money
end
end
end)

function GameNotification(msg)
Expand All @@ -134,11 +98,5 @@ if Config.Framework == "esx" then
while not ESX.GetPlayerData().job do
Wait(100)
end

if Config.DoubleJob then
while not ESX.GetPlayerData().job2 do
Wait(100)
end
end
end)
end
1 change: 0 additions & 1 deletion server-data/resources/[bpt_addons]/bpt_menu/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ Config.Locale = "it"

-- GENERAL --
Config.MenuTitle = "EmpireTown" -- change it to you're server name
Config.DoubleJob = false -- enable if you're using esx double job
Config.NoclipSpeed = 1.0 -- change it to change the speed in noclip
Config.JSFourIDCard = true -- enable if you're using jsfour-idcard

Expand Down
8 changes: 0 additions & 8 deletions server-data/resources/[bpt_addons]/bpt_menu/locales/br.lua
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,6 @@ Locales["br"] = {
["bossmanagement_promote_button"] = "Promover",
["bossmanagement_demote_button"] = "Remover",

-- Boss Management 2 Menu
["bossmanagement2_title"] = "Gestão Organização",
["bossmanagement2_chest_button"] = "Cofre da organização:",
["bossmanagement2_hire_button"] = "Recruta",
["bossmanagement2_fire_button"] = "Virer",
["bossmanagement2_promote_button"] = "Promouvoir",
["bossmanagement2_demote_button"] = "Destituer",

-- Admin Menu
["admin_title"] = "Administração",
["admin_noclip_button"] = "NoClip",
Expand Down
8 changes: 0 additions & 8 deletions server-data/resources/[bpt_addons]/bpt_menu/locales/de.lua
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,6 @@ Locales["de"] = {
["bossmanagement_promote_button"] = "Befördern",
["bossmanagement_demote_button"] = "Degradieren",

-- Boss Management 2 Menu
["bossmanagement2_title"] = "Organisation Management",
["bossmanagement2_chest_button"] = "Organisation Truhe:",
["bossmanagement2_hire_button"] = "Einstellen",
["bossmanagement2_fire_button"] = "Entlassen",
["bossmanagement2_promote_button"] = "Befördern",
["bossmanagement2_demote_button"] = "Degradieren",

-- Admin Menu
["admin_title"] = "Administration",
["admin_noclip_button"] = "NoClip",
Expand Down
8 changes: 0 additions & 8 deletions server-data/resources/[bpt_addons]/bpt_menu/locales/en.lua
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,6 @@ Locales["en"] = {
["bossmanagement_promote_button"] = "Promote",
["bossmanagement_demote_button"] = "Demote",

-- Boss Management 2 Menu
["bossmanagement2_title"] = "Organization Management",
["bossmanagement2_chest_button"] = "Organization Chest:",
["bossmanagement2_hire_button"] = "Recruit",
["bossmanagement2_fire_button"] = "Fire",
["bossmanagement2_promote_button"] = "Promote",
["bossmanagement2_demote_button"] = "Demote",

-- Admin Menu
["admin_title"] = "Administration",
["admin_noclip_button"] = "NoClip",
Expand Down
8 changes: 0 additions & 8 deletions server-data/resources/[bpt_addons]/bpt_menu/locales/es.lua
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,6 @@ Locales["es"] = {
["bossmanagement_promote_button"] = "Promocionar",
["bossmanagement_demote_button"] = "Degradar",

-- Boss Management 2 Menu
["bossmanagement2_title"] = "Organización",
["bossmanagement2_chest_button"] = "Organization Cofre:",
["bossmanagement2_hire_button"] = "Reclutar",
["bossmanagement2_fire_button"] = "Despedir",
["bossmanagement2_promote_button"] = "Promocionar",
["bossmanagement2_demote_button"] = "Degradar",

-- Admin Menu
["admin_title"] = "Administración",
["admin_noclip_button"] = "NoClip",
Expand Down
8 changes: 0 additions & 8 deletions server-data/resources/[bpt_addons]/bpt_menu/locales/fr.lua
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,6 @@ Locales["fr"] = {
["bossmanagement_promote_button"] = "Promouvoir",
["bossmanagement_demote_button"] = "Destituer",

-- Boss Management 2 Menu
["bossmanagement2_title"] = "Gestion Organisation",
["bossmanagement2_chest_button"] = "Coffre Organisation:",
["bossmanagement2_hire_button"] = "Recruter",
["bossmanagement2_fire_button"] = "Virer",
["bossmanagement2_promote_button"] = "Promouvoir",
["bossmanagement2_demote_button"] = "Destituer",

-- Admin Menu
["admin_title"] = "Administration",
["admin_noclip_button"] = "NoClip",
Expand Down
6 changes: 0 additions & 6 deletions server-data/resources/[bpt_addons]/bpt_menu/locales/it.lua
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,6 @@ Locales["it"] = {
["bossmanagement_fire_button"] = "Licenzia",
["bossmanagement_promote_button"] = "Promuovi",
["bossmanagement_demote_button"] = "Degrada",
["bossmanagement2_title"] = "Gestione azienda",
["bossmanagement2_chest_button"] = "Gestione conto aziendale:",
["bossmanagement2_hire_button"] = "Reclutamento aziendale",
["bossmanagement2_fire_button"] = "Licenzia dipendente",
["bossmanagement2_promote_button"] = "Promuovi dipendente",
["bossmanagement2_demote_button"] = "Degrada dipendente",
["mainmenu_gps_button"] = "GPS",
["gps"] = "GPS: ~b~%s",
["admin_title"] = "Amministrazione",
Expand Down
101 changes: 0 additions & 101 deletions server-data/resources/[bpt_addons]/bpt_menu/server/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -186,104 +186,3 @@ AddEventHandler(
end
end)
)

RegisterServerEvent("bpt_personalmenu:Boss_promoteplayer2")
AddEventHandler(
"bpt_personalmenu:Boss_promoteplayer2",
makeTargetedEventFunction(function(target)
local sourceXPlayer = ESX.GetPlayerFromId(source)
local sourceJob2 = sourceXPlayer.getJob2()

if sourceJob2.grade_name == "boss" then
local targetXPlayer = ESX.GetPlayerFromId(target)
local targetJob2 = targetXPlayer.getJob2()

if sourceJob2.name == targetJob2.name then
local newGrade = tonumber(targetJob2.grade) + 1

if newGrade ~= getMaximumGrade(targetJob2.name) then
targetXPlayer.setJob2(targetJob2.name, newGrade)
TriggerClientEvent("esx:showNotification", sourceXPlayer.source, TranslateCap("promoted"):format(targetXPlayer.name))
TriggerClientEvent("esx:showNotification", target, TranslateCap("you_promoted"):format(sourceXPlayer.name))
else
TriggerClientEvent("esx:showNotification", sourceXPlayer.source, TranslateCap("not_permission"))
end
else
TriggerClientEvent("esx:showNotification", sourceXPlayer.source, TranslateCap("player_not_your_company"))
end
else
TriggerClientEvent("esx:showNotification", sourceXPlayer.source, TranslateCap("not_permission"))
end
end)
)

RegisterServerEvent("bpt_personalmenu:Boss_dismissplayer2")
AddEventHandler(
"bpt_personalmenu:Boss_dismissplayer2",
makeTargetedEventFunction(function(target)
local sourceXPlayer = ESX.GetPlayerFromId(source)
local sourceJob2 = sourceXPlayer.getJob2()

if sourceJob2.grade_name == "boss" then
local targetXPlayer = ESX.GetPlayerFromId(target)
local targetJob2 = targetXPlayer.getJob2()

if sourceJob2.name == targetJob2.name then
local newGrade = tonumber(targetJob2.grade) - 1

if newGrade >= 0 then
targetXPlayer.setJob2(targetJob2.name, newGrade)
TriggerClientEvent("esx:showNotification", sourceXPlayer.source, _("you_been_relegated"):format(targetXPlayer.name))
TriggerClientEvent("esx:showNotification", target, TranslateCap("demoted_from"):format(sourceXPlayer.name))
else
TriggerClientEvent("esx:showNotification", sourceXPlayer.source, TranslateCap("not_downgrade"))
end
else
TriggerClientEvent("esx:showNotification", sourceXPlayer.source, TranslateCap("player_not_your_company"))
end
else
TriggerClientEvent("esx:showNotification", sourceXPlayer.source, TranslateCap("not_permission"))
end
end)
)

RegisterServerEvent("bpt_personalmenu:Boss_recruitplayer2")
AddEventHandler(
"bpt_personalmenu:Boss_recruitplayer2",
makeTargetedEventFunction(function(target)
local sourceXPlayer = ESX.GetPlayerFromId(source)
local sourceJob2 = sourceXPlayer.getJob2()

if sourceJob2.grade_name == "boss" then
local targetXPlayer = ESX.GetPlayerFromId(target)

targetXPlayer.setJob2(sourceJob2.name, 0)
TriggerClientEvent("esx:showNotification", sourceXPlayer.source, TranslateCap("you_hired"):format(targetXPlayer.name))
TriggerClientEvent("esx:showNotification", target, TranslateCap("you_hired_by"):format(sourceXPlayer.name))
end
end)
)

RegisterServerEvent("bpt_personalmenu:Boss_fireplayer2")
AddEventHandler(
"bpt_personalmenu:Boss_fireplayer2",
makeTargetedEventFunction(function(target)
local sourceXPlayer = ESX.GetPlayerFromId(source)
local sourceJob2 = sourceXPlayer.getJob2()

if sourceJob2.grade_name == "boss" then
local targetXPlayer = ESX.GetPlayerFromId(target)
local targetJob2 = targetXPlayer.getJob2()

if sourceJob2.name == targetJob2.name then
targetXPlayer.setJob2("unemployed2", 0)
TriggerClientEvent("esx:showNotification", sourceXPlayer.source, TranslateCap("you_fired"):format(targetXPlayer.name))
TriggerClientEvent("esx:showNotification", target, TranslateCap("you_were_fired"):format(sourceXPlayer.name))
else
TriggerClientEvent("esx:showNotification", sourceXPlayer.source, TranslateCap("player_not_your_company"))
end
else
TriggerClientEvent("esx:showNotification", sourceXPlayer.source, TranslateCap("not_permission"))
end
end)
)

0 comments on commit 7a952bc

Please sign in to comment.