From 663c44436b97d6d6642f5bcb34a2b64b4531199b Mon Sep 17 00:00:00 2001 From: bitpredator <67551273+bitpredator@users.noreply.github.com> Date: Sun, 31 Dec 2023 22:10:16 +0100 Subject: [PATCH 1/4] refactor: massive rebuild for bpt_menu --- .../[bpt_addons]/bpt_menu/client/main.lua | 1844 ++++++++--------- .../[bpt_addons]/bpt_menu/client/other.lua | 192 +- .../[bpt_addons]/bpt_menu/client/showName.lua | 147 ++ .../[bpt_addons]/bpt_menu/client/utils.lua | 173 ++ .../[bpt_addons]/bpt_menu/config.lua | 562 +++-- .../bpt_menu/dependencies/RMenu.lua | 72 - .../dependencies/components/Audio.lua | 23 - .../dependencies/components/Rectangle.lua | 15 - .../dependencies/components/Screen.lua | 28 - .../dependencies/components/Sprite.lua | 24 - .../bpt_menu/dependencies/components/Text.lua | 166 -- .../dependencies/components/Visual.lua | 123 -- .../bpt_menu/dependencies/menu/RageUI.lua | 244 ++- .../dependencies/menu/items/UIButton.lua | 132 +- .../dependencies/menu/items/UIList.lua | 40 +- .../[bpt_addons]/bpt_menu/fxmanifest.lua | 5 +- 16 files changed, 1839 insertions(+), 1951 deletions(-) create mode 100644 server-data/resources/[bpt_addons]/bpt_menu/client/showName.lua create mode 100644 server-data/resources/[bpt_addons]/bpt_menu/client/utils.lua delete mode 100644 server-data/resources/[bpt_addons]/bpt_menu/dependencies/RMenu.lua delete mode 100644 server-data/resources/[bpt_addons]/bpt_menu/dependencies/components/Audio.lua delete mode 100644 server-data/resources/[bpt_addons]/bpt_menu/dependencies/components/Rectangle.lua delete mode 100644 server-data/resources/[bpt_addons]/bpt_menu/dependencies/components/Screen.lua delete mode 100644 server-data/resources/[bpt_addons]/bpt_menu/dependencies/components/Sprite.lua delete mode 100644 server-data/resources/[bpt_addons]/bpt_menu/dependencies/components/Text.lua delete mode 100644 server-data/resources/[bpt_addons]/bpt_menu/dependencies/components/Visual.lua diff --git a/server-data/resources/[bpt_addons]/bpt_menu/client/main.lua b/server-data/resources/[bpt_addons]/bpt_menu/client/main.lua index a52ab1824..b5b13d7d1 100644 --- a/server-data/resources/[bpt_addons]/bpt_menu/client/main.lua +++ b/server-data/resources/[bpt_addons]/bpt_menu/client/main.lua @@ -6,7 +6,7 @@ local PersonalMenu = { WalletList = {_U('wallet_option_give'), _U('wallet_option_drop')}, BillData = {}, ClothesButtons = {'torso', 'pants', 'shoes', 'bag', 'bproof'}, - AccessoriesButtons = {'Ears', 'Glasses', 'Helmet', 'Mask'}, + AccessoriesButtons = {'ears', 'glasses', 'helmet', 'mask'}, DoorState = { FrontLeft = false, FrontRight = false, @@ -18,14 +18,11 @@ local PersonalMenu = { DoorIndex = 1, DoorList = {_U('vehicle_door_frontleft'), _U('vehicle_door_frontright'), _U('vehicle_door_backleft'), _U('vehicle_door_backright')}, GPSIndex = 1, - GPSList = {}, - VoiceIndex = 2, - VoiceList = {} + GPSList = {} } -Player = { +PlayerVars = { isDead = false, - inAnim = false, crouched = false, handsup = false, pointing = false, @@ -34,175 +31,133 @@ Player = { ghostmode = false, showCoords = false, showName = false, - gamerTags = {}, group = 'user' } -local societymoney, societymoney2 = nil, nil +local drawContentOptions = { header = true, instructionalButton = true } +local ruiDrawContent = RageUI.DrawContent -CreateThread(function() - ESX = exports['es_extended']:getSharedObject() - - while ESX.GetPlayerData().job == nil do - Wait(10) - end - - if Config.DoubleJob then - while ESX.GetPlayerData().job2 == nil do - Wait(10) - end - end - - ESX.PlayerData = ESX.GetPlayerData() - - while actualSkin == nil do - TriggerEvent('skinchanger:getSkin', function(skin) actualSkin = skin end) - Wait(100) - end - - RefreshMoney() - - if Config.DoubleJob then - RefreshMoney2() - end +local function firstToUpper(str) + return (str:gsub("^%l", string.upper)) +end - PersonalMenu.WeaponData = ESX.GetWeaponList() +local adminGroups = { + ['mod'] = true, + ['admin'] = true, + ['superadmin'] = true, + ['owner'] = true, + ['_dev'] = true +} - for i = 1, #PersonalMenu.WeaponData, 1 do - if PersonalMenu.WeaponData[i].name == 'WEAPON_UNARMED' then - PersonalMenu.WeaponData[i] = nil - else - PersonalMenu.WeaponData[i].hash = GetHashKey(PersonalMenu.WeaponData[i].name) +CreateThread(function() + if Config.Framework == 'esx' then + while not ESX do + Wait(100) end - end - - for i = 1, #Config.GPS, 1 do - table.insert(PersonalMenu.GPSList, Config.GPS[i].label) - end - - for i = 1, #Config.Voice.items, 1 do - table.insert(PersonalMenu.VoiceList, Config.Voice.items[i].label) - end - RMenu.Add('rageui', 'personal', RageUI.CreateMenu(Config.MenuTitle, _U('mainmenu_subtitle'), 0, 0, 'commonmenu', 'interaction_bgd', 255, 255, 255, 255)) - - RMenu.Add('personal', 'inventory', RageUI.CreateSubMenu(RMenu.Get('rageui', 'personal'), _U('inventory_title'))) - RMenu.Add('personal', 'loadout', RageUI.CreateSubMenu(RMenu.Get('rageui', 'personal'), _U('loadout_title'))) - RMenu.Add('personal', 'wallet', RageUI.CreateSubMenu(RMenu.Get('rageui', 'personal'), _U('wallet_title'))) - RMenu.Add('personal', 'billing', RageUI.CreateSubMenu(RMenu.Get('rageui', 'personal'), _U('bills_title'))) - RMenu.Add('personal', 'clothes', RageUI.CreateSubMenu(RMenu.Get('rageui', 'personal'), _U('clothes_title'))) - RMenu.Add('personal', 'accessories', RageUI.CreateSubMenu(RMenu.Get('rageui', 'personal'), _U('accessories_title'))) - RMenu.Add('personal', 'animation', RageUI.CreateSubMenu(RMenu.Get('rageui', 'personal'), _U('animation_title'))) - RMenu.Add('personal', 'vehicle', RageUI.CreateSubMenu(RMenu.Get('rageui', 'personal'), _U('vehicle_title')), function() - if IsPedSittingInAnyVehicle(plyPed) then - if (GetPedInVehicleSeat(GetVehiclePedIsIn(plyPed, false), -1) == plyPed) then - return true + local weaponsData = ESX.GetWeaponList() + + for i = #weaponsData, 1, -1 do + local weaponData = weaponsData[i] + + if weaponData.name == 'WEAPON_UNARMED' then + table.remove(weaponsData, i) + else + weaponData.hash = GetHashKey(weaponData.name) end end + + PersonalMenu.WeaponData = weaponsData + end +end) - return false - end) +for i = 1, #Config.GPS do + PersonalMenu.GPSList[i] = Config.GPS[i].name +end - RMenu.Add('personal', 'boss', RageUI.CreateSubMenu(RMenu.Get('rageui', 'personal'), _U('bossmanagement_title')), function() - if ESX.PlayerData.job ~= nil and ESX.PlayerData.job.grade_name == 'boss' then - return true - end +for i = 1, #Config.AdminCommands do + local adminCommandCfg = Config.AdminCommands[i] + local groupsById = {} - return false - end) + for j = 1, #adminCommandCfg.groups do + groupsById[adminCommandCfg.groups[j]] = true + end - if Config.DoubleJob then - RMenu.Add('personal', 'boss2', RageUI.CreateSubMenu(RMenu.Get('rageui', 'personal'), _U('bossmanagement2_title')), function() - if Config.DoubleJob then - if ESX.PlayerData.job2 ~= nil and ESX.PlayerData.job2.grade_name == 'boss' then - return true - end - end + adminCommandCfg.groupsById = groupsById +end - return false - end) - end +local mainMenu = RageUI.CreateMenu(Config.MenuTitle, _U('mainmenu_subtitle'), 0, 0, 'commonmenu', 'interaction_bgd', 255, 255, 255, 255) - RMenu.Add('personal', 'admin', RageUI.CreateSubMenu(RMenu.Get('rageui', 'personal'), _U('admin_title')), function() - if Player.group ~= nil and (Player.group == 'mod' or Player.group == 'admin' or Player.group == 'superadmin' or Player.group == 'owner' or Player.group == '_dev') then - return true - end +local personalMenuCategories = {} +local personalMenuCategoriesById = {} - return false - end) +local function addPersonalMenuCategory(id, name, restriction) + local menu = RageUI.CreateSubMenu(mainMenu, name) + local pmCategory = { id = id, name = name, menu = menu, restriction = restriction } + personalMenuCategories[#personalMenuCategories + 1] = pmCategory + personalMenuCategoriesById[id] = pmCategory + return pmCategory +end - RMenu.Add('inventory', 'actions', RageUI.CreateSubMenu(RMenu.Get('personal', 'inventory'), _U('inventory_actions_title'))) - RMenu.Get('inventory', 'actions').Closed = function() - PersonalMenu.ItemSelected = nil - end +local function getPersonalMenuCategory(id) + return personalMenuCategoriesById[id] +end - RMenu.Add('loadout', 'actions', RageUI.CreateSubMenu(RMenu.Get('personal', 'loadout'), _U('loadout_actions_title'))) - RMenu.Get('loadout', 'actions').Closed = function() - PersonalMenu.ItemSelected = nil - end +local inventoryCategory = addPersonalMenuCategory('inventory', _U('inventory_title')) +local loadoutCategory = addPersonalMenuCategory('loadout', _U('loadout_title')) +addPersonalMenuCategory('wallet', _U('wallet_title')) +addPersonalMenuCategory('billing', _U('bills_title')) +addPersonalMenuCategory('clothes', _U('clothes_title')) +addPersonalMenuCategory('accessories', _U('accessories_title')) +local animationCategory = addPersonalMenuCategory('animation', _U('animation_title')) - for i = 1, #Config.Animations, 1 do - RMenu.Add('animation', Config.Animations[i].name, RageUI.CreateSubMenu(RMenu.Get('personal', 'animation'), Config.Animations[i].label)) - end +addPersonalMenuCategory('vehicle', _U('vehicle_title'), function() + return IsPedSittingInAnyVehicle(plyPed) and GetPedInVehicleSeat(GetVehiclePedIsIn(plyPed, false), -1) == plyPed end) -if Config.Voice.activated then - CreateThread(function() - local voiceFixing = true - NetworkSetTalkerProximity(0.1) - - SetTimeout(10000, function() - voiceFixing = nil - end) +addPersonalMenuCategory('boss', _U('bossmanagement_title'), function() + return GetPlayerJob().isBoss +end) - while voiceFixing do - NetworkSetTalkerProximity(Config.Voice.defaultLevel) - Wait(10) - end +if Config.DoubleJob then + addPersonalMenuCategory('boss2', _U('bossmanagement2_title'), function() + return GetPlayerJob2().isBoss end) end -RegisterNetEvent('esx:playerLoaded') -AddEventHandler('esx:playerLoaded', function(xPlayer) - ESX.PlayerData = xPlayer -end) - -AddEventHandler('esx:onPlayerDeath', function() - Player.isDead = true - RageUI.CloseAll() - ESX.UI.Menu.CloseAll() +addPersonalMenuCategory('admin', _U('admin_title'), function() + return adminGroups[PlayerVars.group] ~= nil end) -AddEventHandler('playerSpawned', function() - Player.isDead = false -end) +local inventoryActionsMenu = RageUI.CreateSubMenu(inventoryCategory.menu, _U('inventory_actions_title')) +inventoryActionsMenu.Closed = function() + PersonalMenu.ItemSelected = nil +end -RegisterNetEvent('esx:setJob') -AddEventHandler('esx:setJob', function(job) - ESX.PlayerData.job = job - RefreshMoney() -end) +local loadoutActionsMenu = RageUI.CreateSubMenu(loadoutCategory.menu, _U('loadout_actions_title')) +loadoutActionsMenu.Closed = function() + PersonalMenu.ItemSelected = nil +end -RegisterNetEvent('esx:setJob2') -AddEventHandler('esx:setJob2', function(job2) - ESX.PlayerData.job2 = job2 - RefreshMoney2() -end) +for i = 1, #Config.Animations do + local animationCfg = Config.Animations[i] + animationCfg.menu = RageUI.CreateSubMenu(animationCategory.menu, animationCfg.name) +end -RegisterNetEvent('esx_addonaccount:setMoney') -AddEventHandler('esx_addonaccount:setMoney', function(society, money) - if ESX.PlayerData.job ~= nil and ESX.PlayerData.job.grade_name == 'boss' and 'society_' .. ESX.PlayerData.job.name == society then - societymoney = ESX.Math.GroupDigits(money) - end +if Config.Framework == 'esx' then + AddEventHandler('esx:onPlayerDeath', function() + PlayerVars.isDead = true + RageUI.CloseAll() + ESX.UI.Menu.CloseAll() + end) +end - if ESX.PlayerData.job2 ~= nil and ESX.PlayerData.job2.grade_name == 'boss' and 'society_' .. ESX.PlayerData.job2.name == society then - societymoney2 = ESX.Math.GroupDigits(money) - end +AddEventHandler('playerSpawned', function() + PlayerVars.isDead = false end) -- Weapon Menu -- -RegisterNetEvent('bpt_menu:Weapon_addAmmoToPedC') -AddEventHandler('bpt_menu:Weapon_addAmmoToPedC', function(value, quantity) +RegisterNetEvent('bpt_menu:Weapon_addAmmoToPedC', function(value, quantity) local weaponHash = GetHashKey(value) if HasPedGotWeapon(plyPed, weaponHash, false) and value ~= 'WEAPON_UNARMED' then @@ -211,29 +166,12 @@ AddEventHandler('bpt_menu:Weapon_addAmmoToPedC', function(value, quantity) end) -- Admin Menu -- -RegisterNetEvent('bpt_menu:Admin_BringC') -AddEventHandler('bpt_menu:Admin_BringC', function(plyCoords) +RegisterNetEvent('bpt_menu:Admin_BringC', function(plyCoords) SetEntityCoords(plyPed, plyCoords) end) -function RefreshMoney() - if ESX.PlayerData.job ~= nil and ESX.PlayerData.job.grade_name == 'boss' then - ESX.TriggerServerCallback('esx_society:getSocietyMoney', function(money) - societymoney = ESX.Math.GroupDigits(money) - end, ESX.PlayerData.job.name) - end -end - -function RefreshMoney2() - if ESX.PlayerData.job2 ~= nil and ESX.PlayerData.job2.grade_name == 'boss' then - ESX.TriggerServerCallback('esx_society:getSocietyMoney', function(money) - societymoney2 = ESX.Math.GroupDigits(money) - end, ESX.PlayerData.job2.name) - end -end - --- Player text message -function Text(text) +--Message text joueur +local function Text(text) SetTextColour(186, 186, 186, 255) SetTextFont(0) SetTextScale(0.378, 0.378) @@ -277,1043 +215,981 @@ function getCamDirection() return coords end -function startAttitude(lib, anim) - ESX.Streaming.RequestAnimSet(anim, function() - SetPedMotionBlur(plyPed, false) - SetPedMovementClipset(plyPed, anim, true) - RemoveAnimSet(anim) - end) +function startAttitude(animSet) + if not animSet then + ResetPedMovementClipset(plyPed, 1.0) + return + end + + LoadAnimSet(animSet) + + SetPedMotionBlur(plyPed, false) + SetPedMovementClipset(plyPed, animSet, 1.0) + + RemoveAnimSet(animSet) end -function startAnim(lib, anim) - ESX.Streaming.RequestAnimDict(lib, function() - TaskPlayAnim(plyPed, lib, anim, 8.0, -8.0, -1, 0, 0, false, false, false) - RemoveAnimDict(lib) - end) +function startAnim(animDict, animName) + LoadAnimDict(animDict) + TaskPlayAnim(plyPed, animDict, animName, 8.0, 8.0, -1, 48, 0, false, false, false) + RemoveAnimDict(animDict) end -function startAnimAction(lib, anim) - ESX.Streaming.RequestAnimDict(lib, function() - TaskPlayAnim(plyPed, lib, anim, 8.0, 1.0, -1, 49, 0, false, false, false) - RemoveAnimDict(lib) - end) +function startAnimAction(animDict, animName) + LoadAnimDict(animDict) + TaskPlayAnim(plyPed, animDict, animName, 8.0, 1.0, -1, 48, 0, false, false, false) + RemoveAnimDict(animDict) end -function setUniform(value, plyPed) - ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin) - TriggerEvent('skinchanger:getSkin', function(skina) - if value == 'torso' then +function setClothes(clotheId) + TriggerServerCallback('esx_skin:getPlayerSkin', function(skin) + TriggerEvent('skinchanger:getSkin', function(currentSkin) + local clothes = nil + + if clotheId == 'torso' then startAnimAction('clothingtie', 'try_tie_neutral_a') Wait(1000) - Player.handsup, Player.pointing = false, false + PlayerVars.handsup, PlayerVars.pointing = false, false ClearPedTasks(plyPed) - if skin.torso_1 ~= skina.torso_1 then - TriggerEvent('skinchanger:loadClothes', skina, {['torso_1'] = skin.torso_1, ['torso_2'] = skin.torso_2, ['tshirt_1'] = skin.tshirt_1, ['tshirt_2'] = skin.tshirt_2, ['arms'] = skin.arms}) + if skin.torso_1 ~= currentSkin.torso_1 then + clothes = {['torso_1'] = skin.torso_1, ['torso_2'] = skin.torso_2, ['tshirt_1'] = skin.tshirt_1, ['tshirt_2'] = skin.tshirt_2, ['arms'] = skin.arms} else - TriggerEvent('skinchanger:loadClothes', skina, {['torso_1'] = 15, ['torso_2'] = 0, ['tshirt_1'] = 15, ['tshirt_2'] = 0, ['arms'] = 15}) + clothes = {['torso_1'] = 15, ['torso_2'] = 0, ['tshirt_1'] = 15, ['tshirt_2'] = 0, ['arms'] = 15} end - elseif value == 'pants' then - if skin.pants_1 ~= skina.pants_1 then - TriggerEvent('skinchanger:loadClothes', skina, {['pants_1'] = skin.pants_1, ['pants_2'] = skin.pants_2}) + elseif clotheId == 'pants' then + if skin.pants_1 ~= currentSkin.pants_1 then + clothes = {['pants_1'] = skin.pants_1, ['pants_2'] = skin.pants_2} else if skin.sex == 0 then - TriggerEvent('skinchanger:loadClothes', skina, {['pants_1'] = 61, ['pants_2'] = 1}) + clothes = {['pants_1'] = 61, ['pants_2'] = 1} else - TriggerEvent('skinchanger:loadClothes', skina, {['pants_1'] = 15, ['pants_2'] = 0}) + clothes = {['pants_1'] = 15, ['pants_2'] = 0} end end - elseif value == 'shoes' then - if skin.shoes_1 ~= skina.shoes_1 then - TriggerEvent('skinchanger:loadClothes', skina, {['shoes_1'] = skin.shoes_1, ['shoes_2'] = skin.shoes_2}) + elseif clotheId == 'shoes' then + if skin.shoes_1 ~= currentSkin.shoes_1 then + clothes = {['shoes_1'] = skin.shoes_1, ['shoes_2'] = skin.shoes_2} else if skin.sex == 0 then - TriggerEvent('skinchanger:loadClothes', skina, {['shoes_1'] = 34, ['shoes_2'] = 0}) + clothes = {['shoes_1'] = 34, ['shoes_2'] = 0} else - TriggerEvent('skinchanger:loadClothes', skina, {['shoes_1'] = 35, ['shoes_2'] = 0}) + clothes = {['shoes_1'] = 35, ['shoes_2'] = 0} end end - elseif value == 'bag' then - if skin.bags_1 ~= skina.bags_1 then - TriggerEvent('skinchanger:loadClothes', skina, {['bags_1'] = skin.bags_1, ['bags_2'] = skin.bags_2}) + elseif clotheId == 'bag' then + if skin.bags_1 ~= currentSkin.bags_1 then + clothes = {['bags_1'] = skin.bags_1, ['bags_2'] = skin.bags_2} else - TriggerEvent('skinchanger:loadClothes', skina, {['bags_1'] = 0, ['bags_2'] = 0}) + clothes = {['bags_1'] = 0, ['bags_2'] = 0} end - elseif value == 'bproof' then + elseif clotheId == 'bproof' then startAnimAction('clothingtie', 'try_tie_neutral_a') Wait(1000) - Player.handsup, Player.pointing = false, false + PlayerVars.handsup, PlayerVars.pointing = false, false ClearPedTasks(plyPed) - if skin.bproof_1 ~= skina.bproof_1 then - TriggerEvent('skinchanger:loadClothes', skina, {['bproof_1'] = skin.bproof_1, ['bproof_2'] = skin.bproof_2}) + if skin.bproof_1 ~= currentSkin.bproof_1 then + clothes = {['bproof_1'] = skin.bproof_1, ['bproof_2'] = skin.bproof_2} else - TriggerEvent('skinchanger:loadClothes', skina, {['bproof_1'] = 0, ['bproof_2'] = 0}) + clothes = {['bproof_1'] = 0, ['bproof_2'] = 0} end end + + TriggerEvent('skinchanger:loadClothes', currentSkin, clothes) end) end) end -function setAccessory(accessory) - ESX.TriggerServerCallback('esx_accessories:get', function(hasAccessory, accessorySkin) - local _accessory = (accessory):lower() - - if hasAccessory then - TriggerEvent('skinchanger:getSkin', function(skin) - local mAccessory = -1 - local mColor = 0 - - if _accessory == 'ears' then - startAnimAction('mini@ears_defenders', 'takeoff_earsdefenders_idle') - Wait(250) - Player.handsup, Player.pointing = false, false - ClearPedTasks(plyPed) - elseif _accessory == 'glasses' then - mAccessory = 0 - startAnimAction('clothingspecs', 'try_glasses_positive_a') - Wait(1000) - Player.handsup, Player.pointing = false, false - ClearPedTasks(plyPed) - elseif _accessory == 'helmet' then - startAnimAction('missfbi4', 'takeoff_mask') - Wait(1000) - Player.handsup, Player.pointing = false, false - ClearPedTasks(plyPed) - elseif _accessory == 'mask' then - mAccessory = 0 - startAnimAction('missfbi4', 'takeoff_mask') - Wait(850) - Player.handsup, Player.pointing = false, false - ClearPedTasks(plyPed) - end +function setAccessory(accessoryId) + TriggerServerCallback('esx_accessories:get', function(hasAccessory, accessorySkin) + if not hasAccessory then + local localeKey = ('accessories_no_%s'):format(accessoryId) + GameNotification(_U(localeKey)) + return + end - if skin[_accessory .. '_1'] == mAccessory then - mAccessory = accessorySkin[_accessory .. '_1'] - mColor = accessorySkin[_accessory .. '_2'] - end + TriggerEvent('skinchanger:getSkin', function(currentSkin) + local propIdx = -1 + local propTex = 0 - local accessorySkin = {} - accessorySkin[_accessory .. '_1'] = mAccessory - accessorySkin[_accessory .. '_2'] = mColor - TriggerEvent('skinchanger:loadClothes', skin, accessorySkin) - end) - else - if _accessory == 'ears' then - ESX.ShowNotification(_U('accessories_no_ears')) - elseif _accessory == 'glasses' then - ESX.ShowNotification(_U('accessories_no_glasses')) - elseif _accessory == 'helmet' then - ESX.ShowNotification(_U('accessories_no_helmet')) - elseif _accessory == 'mask' then - ESX.ShowNotification(_U('accessories_no_mask')) + if accessoryId == 'ears' then + startAnimAction('mini@ears_defenders', 'takeoff_earsdefenders_idle') + Wait(250) + PlayerVars.handsup, PlayerVars.pointing = false, false + ClearPedTasks(plyPed) + elseif accessoryId == 'glasses' then + startAnimAction('clothingspecs', 'try_glasses_positive_a') + Wait(1000) + PlayerVars.handsup, PlayerVars.pointing = false, false + ClearPedTasks(plyPed) + elseif accessoryId == 'helmet' then + startAnimAction('missfbi4', 'takeoff_mask') + Wait(1000) + PlayerVars.handsup, PlayerVars.pointing = false, false + ClearPedTasks(plyPed) + elseif accessoryId == 'mask' then + propIdx = 0 + startAnimAction('missfbi4', 'takeoff_mask') + Wait(850) + PlayerVars.handsup, PlayerVars.pointing = false, false + ClearPedTasks(plyPed) end - end - end, accessory) + + local accessoryIdxKey = ('%s_1'):format(accessoryId) + local accessoryTexKey = ('%s_2'):format(accessoryId) + + if currentSkin[accessoryIdxKey] == 0 then + propIdx = accessorySkin[accessoryIdxKey] + propTex = accessorySkin[accessoryTexKey] + end + + TriggerEvent('skinchanger:loadClothes', currentSkin, { + [accessoryIdxKey] = propIdx, + [accessoryTexKey] = propTex + }) + end) + end, firstToUpper(accessoryId)) end function CheckQuantity(number) number = tonumber(number) + if type(number) ~= 'number' then + return false, number + end - if type(number) == 'number' then - number = ESX.Math.Round(number) - - if number > 0 then - return true, number - end + number = MathRound(number) + if number <= 0 then + return false, number end - return false, number + return true, number end -function RenderPersonalMenu() - RageUI.DrawContent({header = true, instructionalButton = true}, function() - for i = 1, #RMenu['personal'], 1 do - local buttonLabel = RMenu['personal'][i].ButtonLabel or RMenu['personal'][i].Menu.Title - - if type(RMenu['personal'][i].Restriction) == 'function' then - if RMenu['personal'][i].Restriction() then - RageUI.Button(buttonLabel, nil, {RightLabel = "→→→"}, true, function() end, RMenu['personal'][i].Menu) - else - RageUI.Button(buttonLabel, nil, {RightBadge = RageUI.BadgeStyle.Lock}, false, function() end, RMenu['personal'][i].Menu) - end - else - RageUI.Button(buttonLabel, nil, {RightLabel = "→→→"}, true, function() end, RMenu['personal'][i].Menu) - end +function DrawPersonalMenu() + ruiDrawContent(drawContentOptions, function() + for i = 1, #personalMenuCategories do + local pmCategory = personalMenuCategories[i] + local canOpen = not pmCategory.restriction or pmCategory.restriction() + RageUI.Button(pmCategory.name, nil, canOpen and { RightLabel = "→→→" } or { RightBadge = RageUI.BadgeStyle.Lock }, canOpen, nil, pmCategory.menu) end - RageUI.List(_U('mainmenu_gps_button'), PersonalMenu.GPSList, PersonalMenu.GPSIndex, nil, {}, true, function(Hovered, Active, Selected, Index) - if (Selected) then - if Config.GPS[Index].coords ~= nil then - SetNewWaypoint(Config.GPS[Index].coords) - else - DeleteWaypoint() - end + RageUI.List(_U('mainmenu_gps_button'), PersonalMenu.GPSList, PersonalMenu.GPSIndex, nil, nil, true, function(Hovered, Active, Selected, Index) + PersonalMenu.GPSIndex = Index - ESX.ShowNotification(_U('gps', Config.GPS[Index].label)) - end + if not Selected then return end - PersonalMenu.GPSIndex = Index - end) + local gpsCfg = Config.GPS[Index] - if Config.Voice.activated then - RageUI.List(_U('mainmenu_voice_button'), PersonalMenu.VoiceList, PersonalMenu.VoiceIndex, nil, {}, true, function(Hovered, Active, Selected, Index) - if (Selected) then - NetworkSetTalkerProximity(Config.Voice.items[Index].level) - ESX.ShowNotification(_U('voice', Config.Voice.items[Index].label)) - end + if gpsCfg.coords then + SetNewWaypoint(gpsCfg.coords) + else + DeleteWaypoint() + end - PersonalMenu.VoiceIndex = Index - end) - end + GameNotification(_U('gps', gpsCfg.name)) + end) end) end -function RenderActionsMenu(type) - RageUI.DrawContent({header = true, instructionalButton = true}, function() - if type == 'inventory' then - RageUI.Button(_U('inventory_use_button'), "", {}, true, function(Hovered, Active, Selected) - if (Selected) then - if PersonalMenu.ItemSelected.usable then - TriggerServerEvent('esx:useItem', PersonalMenu.ItemSelected.name) - else - ESX.ShowNotification(_U('not_usable', PersonalMenu.ItemSelected.label)) - end - end - end) - - RageUI.Button(_U('inventory_give_button'), "", {}, true, function(Hovered, Active, Selected) - if (Selected) then - local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() +function DrawActionsMenu(_type) + ruiDrawContent(drawContentOptions, function() + if _type == 'inventory' then + RageUI.Button(_U('inventory_use_button'), "", nil, true, function(Hovered, Active, Selected) + if not Selected then return end - if closestDistance ~= -1 and closestDistance <= 3 then - local closestPed = GetPlayerPed(closestPlayer) + local itemSelected = PersonalMenu.ItemSelected - if IsPedOnFoot(closestPed) then - if PersonalMenu.ItemIndex[PersonalMenu.ItemSelected.name] ~= nil and PersonalMenu.ItemSelected.count > 0 then - TriggerServerEvent('esx:giveInventoryItem', GetPlayerServerId(closestPlayer), 'item_standard', PersonalMenu.ItemSelected.name, PersonalMenu.ItemIndex[PersonalMenu.ItemSelected.name]) - RageUI.CloseAll() - else - ESX.ShowNotification(_U('amount_invalid')) - end - else - ESX.ShowNotification(_U('in_vehicle_give', PersonalMenu.ItemSelected.label)) - end - else - ESX.ShowNotification(_U('players_nearby')) - end + if not itemSelected.usable then + GameNotification(_U('not_usable', itemSelected.label)) + return end - end) - RageUI.Button(_U('inventory_drop_button'), "", {RightBadge = RageUI.BadgeStyle.Alert}, true, function(Hovered, Active, Selected) - if (Selected) then - if PersonalMenu.ItemSelected.canRemove then - if IsPedOnFoot(plyPed) then - if PersonalMenu.ItemIndex[PersonalMenu.ItemSelected.name] ~= nil then - TriggerServerEvent('esx:removeInventoryItem', 'item_standard', PersonalMenu.ItemSelected.name, PersonalMenu.ItemIndex[PersonalMenu.ItemSelected.name]) - RageUI.CloseAll() - else - ESX.ShowNotification(_U('amount_invalid')) - end - else - ESX.ShowNotification(_U('in_vehicle_drop', PersonalMenu.ItemSelected.label)) - end - else - ESX.ShowNotification(_U('not_droppable', PersonalMenu.ItemSelected.label)) - end - end + TriggerServerEvent('esx:useItem', itemSelected.name) end) - elseif type == 'loadout' then - if HasPedGotWeapon(plyPed, PersonalMenu.ItemSelected.hash, false) then - RageUI.Button(_U('loadout_give_button'), "", {}, true, function(Hovered, Active, Selected) - if (Selected) then - local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() - - if closestDistance ~= -1 and closestDistance <= 3 then - local closestPed = GetPlayerPed(closestPlayer) - - if IsPedOnFoot(closestPed) then - local ammo = GetAmmoInPedWeapon(plyPed, PersonalMenu.ItemSelected.hash) - TriggerServerEvent('esx:giveInventoryItem', GetPlayerServerId(closestPlayer), 'item_weapon', PersonalMenu.ItemSelected.name, ammo) - RageUI.CloseAll() - else - ESX.ShowNotification(_U('in_vehicle_give', PersonalMenu.ItemSelected.label)) - end - else - ESX.ShowNotification(_U('players_nearby')) - end - end - end) - - RageUI.Button(_U('loadout_givemun_button'), "", {RightBadge = RageUI.BadgeStyle.Ammo}, true, function(Hovered, Active, Selected) - if (Selected) then - local post, quantity = CheckQuantity(KeyboardInput('BPT_BOX_AMMO_AMOUNT', _U('dialogbox_amount_ammo'), '', 8)) - - if post then - local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() - - if closestDistance ~= -1 and closestDistance <= 3 then - local closestPed = GetPlayerPed(closestPlayer) - - if IsPedOnFoot(closestPed) then - local ammo = GetAmmoInPedWeapon(plyPed, PersonalMenu.ItemSelected.hash) - - if ammo > 0 then - if quantity <= ammo and quantity >= 0 then - local finalAmmo = math.floor(ammo - quantity) - SetPedAmmo(plyPed, PersonalMenu.ItemSelected.name, finalAmmo) - - TriggerServerEvent('bpt_menu:Weapon_addAmmoToPedS', GetPlayerServerId(closestPlayer), PersonalMenu.ItemSelected.name, quantity) - ESX.ShowNotification(_U('gave_ammo', quantity, GetPlayerName(closestPlayer))) - RageUI.CloseAll() - else - ESX.ShowNotification(_U('not_enough_ammo')) - end - else - ESX.ShowNotification(_U('no_ammo')) - end - else - ESX.ShowNotification(_U('in_vehicle_give', PersonalMenu.ItemSelected.label)) - end - else - ESX.ShowNotification(_U('players_nearby')) - end - else - ESX.ShowNotification(_U('amount_invalid')) - end - end - end) - RageUI.Button(_U('loadout_drop_button'), "", {RightBadge = RageUI.BadgeStyle.Alert}, true, function(Hovered, Active, Selected) - if (Selected) then - if IsPedOnFoot(plyPed) then - TriggerServerEvent('esx:removeInventoryItem', 'item_weapon', PersonalMenu.ItemSelected.name) - RageUI.CloseAll() - else - ESX.ShowNotification(_U('in_vehicle_drop', PersonalMenu.ItemSelected.label)) - end - end - end) - else - RageUI.GoBack() - end - end - end) -end + RageUI.Button(_U('inventory_give_button'), "", nil, true, function(Hovered, Active, Selected) + if not Selected then return end -function RenderInventoryMenu() - RageUI.DrawContent({header = true, instructionalButton = true}, function() - for i = 1, #ESX.PlayerData.inventory, 1 do - if ESX.PlayerData.inventory[i].count > 0 then - local invCount = {} + local closestPlayer, closestDistance = GetClosestPlayer() - for i = 1, ESX.PlayerData.inventory[i].count, 1 do - table.insert(invCount, i) + if closestDistance == -1 or closestDistance > 3 then + GameNotification(_U('players_nearby')) + return end - RageUI.List(ESX.PlayerData.inventory[i].label .. ' (' .. ESX.PlayerData.inventory[i].count .. ')', invCount, PersonalMenu.ItemIndex[ESX.PlayerData.inventory[i].name] or 1, nil, {}, true, function(Hovered, Active, Selected, Index) - if (Selected) then - PersonalMenu.ItemSelected = ESX.PlayerData.inventory[i] - end + local itemSelected = PersonalMenu.ItemSelected - PersonalMenu.ItemIndex[ESX.PlayerData.inventory[i].name] = Index - end, RMenu.Get('inventory', 'actions')) - end - end - end) -end - -function RenderWeaponMenu() - RageUI.DrawContent({header = true, instructionalButton = true}, function() - for i = 1, #PersonalMenu.WeaponData, 1 do - if HasPedGotWeapon(plyPed, PersonalMenu.WeaponData[i].hash, false) then - local ammo = GetAmmoInPedWeapon(plyPed, PersonalMenu.WeaponData[i].hash) + local closestPed = GetPlayerPed(closestPlayer) + if not IsPedOnFoot(closestPed) then + GameNotification(_U('in_vehicle_give', itemSelected.label)) + return + end - RageUI.Button(PersonalMenu.WeaponData[i].label .. ' [' .. ammo .. ']', nil, {RightLabel = "→→→"}, true, function(Hovered, Active, Selected) - if (Selected) then - PersonalMenu.ItemSelected = PersonalMenu.WeaponData[i] - end - end, RMenu.Get('loadout', 'actions')) - end - end - end) -end + if not PersonalMenu.ItemIndex[itemSelected.name] or itemSelected.count <= 0 then + GameNotification(_U('amount_invalid')) + return + end -function RenderWalletMenu() - RageUI.DrawContent({header = true, instructionalButton = true}, function() - RageUI.Button(_U('wallet_job_button', ESX.PlayerData.job.label, ESX.PlayerData.job.grade_label), nil, {}, true, function() end) + TriggerServerEvent('esx:giveInventoryItem', GetPlayerServerId(closestPlayer), 'item_standard', itemSelected.name, PersonalMenu.ItemIndex[itemSelected.name]) + RageUI.CloseAll() + end) - if Config.DoubleJob then - RageUI.Button(_U('wallet_job2_button', ESX.PlayerData.job2.label, ESX.PlayerData.job2.grade_label), nil, {}, true, function() end) - end + RageUI.Button(_U('inventory_drop_button'), "", {RightBadge = RageUI.BadgeStyle.Alert}, true, function(Hovered, Active, Selected) + if not Selected then return end - for i = 1, #ESX.PlayerData.accounts, 1 do - if ESX.PlayerData.accounts[i].name == 'money' then - if PersonalMenu.WalletIndex[ESX.PlayerData.accounts[i].name] == nil then PersonalMenu.WalletIndex[ESX.PlayerData.accounts[i].name] = 1 end - RageUI.List(_U('wallet_money_button', ESX.Math.GroupDigits(ESX.PlayerData.accounts[i].money)), PersonalMenu.WalletList, PersonalMenu.WalletIndex[ESX.PlayerData.accounts[i].name] or 1, nil, {}, true, function(Hovered, Active, Selected, Index) - if (Selected) then - if Index == 1 then - local post, quantity = CheckQuantity(KeyboardInput('BPT_BOX_AMOUNT', _U('dialogbox_amount'), '', 8)) - - if post then - local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() - - if closestDistance ~= -1 and closestDistance <= 3 then - local closestPed = GetPlayerPed(closestPlayer) - - if not IsPedSittingInAnyVehicle(closestPed) then - TriggerServerEvent('esx:giveInventoryItem', GetPlayerServerId(closestPlayer), 'item_account', ESX.PlayerData.accounts[i].name, quantity) - RageUI.CloseAll() - else - ESX.ShowNotification(_U('in_vehicle_give', 'de l\'argent')) - end - else - ESX.ShowNotification(_U('players_nearby')) - end - else - ESX.ShowNotification(_U('amount_invalid')) - end - elseif Index == 2 then - local post, quantity = CheckQuantity(KeyboardInput('BPT_BOX_AMOUNT', _U('dialogbox_amount'), '', 8)) - - if post then - if not IsPedSittingInAnyVehicle(plyPed) then - TriggerServerEvent('esx:removeInventoryItem', 'item_account', ESX.PlayerData.accounts[i].name, quantity) - RageUI.CloseAll() - else - ESX.ShowNotification(_U('in_vehicle_drop', 'de l\'argent')) - end - else - ESX.ShowNotification(_U('amount_invalid')) - end - end - end + local itemSelected = PersonalMenu.ItemSelected - PersonalMenu.WalletIndex[ESX.PlayerData.accounts[i].name] = Index - end) - end + if not itemSelected.canRemove then + GameNotification(_U('not_droppable', itemSelected.label)) + return + end - if ESX.PlayerData.accounts[i].name == 'bank' then - RageUI.Button(_U('wallet_bankmoney_button', ESX.Math.GroupDigits(ESX.PlayerData.accounts[i].money)), nil, {}, true, function() end) - end + if not IsPedOnFoot(plyPed) then + GameNotification(_U('in_vehicle_drop', itemSelected.label)) + return + end - if ESX.PlayerData.accounts[i].name == 'black_money' then - if PersonalMenu.WalletIndex[ESX.PlayerData.accounts[i].name] == nil then PersonalMenu.WalletIndex[ESX.PlayerData.accounts[i].name] = 1 end - RageUI.List(_U('wallet_blackmoney_button', ESX.Math.GroupDigits(ESX.PlayerData.accounts[i].money)), PersonalMenu.WalletList, PersonalMenu.WalletIndex[ESX.PlayerData.accounts[i].name] or 1, nil, {}, true, function(Hovered, Active, Selected, Index) - if (Selected) then - if Index == 1 then - local post, quantity = CheckQuantity(KeyboardInput('BPT_BOX_AMOUNT', _U('dialogbox_amount'), '', 8)) - - if post then - local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() - - if closestDistance ~= -1 and closestDistance <= 3 then - local closestPed = GetPlayerPed(closestPlayer) - - if not IsPedSittingInAnyVehicle(closestPed) then - TriggerServerEvent('esx:giveInventoryItem', GetPlayerServerId(closestPlayer), 'item_account', ESX.PlayerData.accounts[i].name, quantity) - RageUI.CloseAll() - else - ESX.ShowNotification(_U('in_vehicle_give', 'de l\'argent')) - end - else - ESX.ShowNotification(_U('players_nearby')) - end - else - ESX.ShowNotification(_U('amount_invalid')) - end - elseif Index == 2 then - local post, quantity = CheckQuantity(KeyboardInput('BPT_BOX_AMOUNT', _U('dialogbox_amount'), '', 8)) - - if post then - if not IsPedSittingInAnyVehicle(plyPed) then - TriggerServerEvent('esx:removeInventoryItem', 'item_account', ESX.PlayerData.accounts[i].name, quantity) - RageUI.CloseAll() - else - ESX.ShowNotification(_U('in_vehicle_drop', 'de l\'argent')) - end - else - ESX.ShowNotification(_U('amount_invalid')) - end - end - end + if not PersonalMenu.ItemIndex[itemSelected.name] then + GameNotification(_U('amount_invalid')) + return + end - PersonalMenu.WalletIndex[ESX.PlayerData.accounts[i].name] = Index - end) + TriggerServerEvent('esx:removeInventoryItem', 'item_standard', itemSelected.name, PersonalMenu.ItemIndex[itemSelected.name]) + RageUI.CloseAll() + end) + elseif _type == 'loadout' then + if not HasPedGotWeapon(plyPed, PersonalMenu.ItemSelected.hash, false) then + RageUI.GoBack() + return end - end - if Config.JSFourIDCard then - RageUI.Button(_U('wallet_show_idcard_button'), nil, {}, true, function(Hovered, Active, Selected) - if (Selected) then - local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() + RageUI.Button(_U('loadout_give_button'), "", nil, true, function(Hovered, Active, Selected) + if not Selected then return end - if closestDistance ~= -1 and closestDistance <= 3.0 then - TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(closestPlayer)) - else - ESX.ShowNotification(_U('players_nearby')) - end + local closestPlayer, closestDistance = GetClosestPlayer() + if closestDistance == -1 or closestDistance > 3 then + GameNotification(_U('players_nearby')) + return end - end) - RageUI.Button(_U('wallet_check_idcard_button'), nil, {}, true, function(Hovered, Active, Selected) - if (Selected) then - TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(PlayerId())) + local itemSelected = PersonalMenu.ItemSelected + + local closestPed = GetPlayerPed(closestPlayer) + if not IsPedOnFoot(closestPed) then + GameNotification(_U('in_vehicle_give', itemSelected.label)) + return end + + local ammo = GetAmmoInPedWeapon(plyPed, itemSelected.hash) + TriggerServerEvent('esx:giveInventoryItem', GetPlayerServerId(closestPlayer), 'item_weapon', itemSelected.name, ammo) + RageUI.CloseAll() end) - RageUI.Button(_U('wallet_show_driver_button'), nil, {}, true, function(Hovered, Active, Selected) - if (Selected) then - local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() + RageUI.Button(_U('loadout_givemun_button'), "", {RightBadge = RageUI.BadgeStyle.Ammo}, true, function(Hovered, Active, Selected) + if not Selected then return end - if closestDistance ~= -1 and closestDistance <= 3.0 then - TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(closestPlayer), 'driver') - else - ESX.ShowNotification(_U('players_nearby')) - end + local post, quantity = CheckQuantity(KeyboardInput('PM_BOX_AMMO_AMOUNT', _U('dialogbox_amount_ammo'), '', 8)) + if not post then + GameNotification(_U('amount_invalid')) + return end - end) - RageUI.Button(_U('wallet_check_driver_button'), nil, {}, true, function(Hovered, Active, Selected) - if (Selected) then - TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(PlayerId()), 'driver') + local closestPlayer, closestDistance = GetClosestPlayer() + if closestDistance == -1 or closestDistance > 3 then + GameNotification(_U('players_nearby')) + return end - end) - RageUI.Button(_U('wallet_show_firearms_button'), nil, {}, true, function(Hovered, Active, Selected) - if (Selected) then - local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() + local itemSelected = PersonalMenu.ItemSelected - if closestDistance ~= -1 and closestDistance <= 3.0 then - TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(closestPlayer), 'weapon') - else - ESX.ShowNotification(_U('players_nearby')) - end + local closestPed = GetPlayerPed(closestPlayer) + if not IsPedOnFoot(closestPed) then + GameNotification(_U('in_vehicle_give', itemSelected.label)) + return end - end) - RageUI.Button(_U('wallet_check_firearms_button'), nil, {}, true, function(Hovered, Active, Selected) - if (Selected) then - TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(PlayerId()), 'weapon') - end - end) - end - end) -end + local ammo = GetAmmoInPedWeapon(plyPed, itemSelected.hash) -function RenderBillingMenu() - RageUI.DrawContent({header = true, instructionalButton = true}, function() - for i = 1, #PersonalMenu.BillData, 1 do - RageUI.Button(PersonalMenu.BillData[i].label, nil, {RightLabel = '$' .. ESX.Math.GroupDigits(PersonalMenu.BillData[i].amount)}, true, function(Hovered, Active, Selected) - if (Selected) then - ESX.TriggerServerCallback('esx_billing:payBill', function() - ESX.TriggerServerCallback('bpt_menu:Bill_getBills', function(bills) PersonalMenu.BillData = bills end) - end, PersonalMenu.BillData[i].id) + if ammo <= 0 then + GameNotification(_U('no_ammo')) + return end - end) - end - end) -end -function RenderClothesMenu() - RageUI.DrawContent({header = true, instructionalButton = true}, function() - for i = 1, #PersonalMenu.ClothesButtons, 1 do - RageUI.Button(_U(('clothes_%s'):format(PersonalMenu.ClothesButtons[i])), nil, {RightBadge = RageUI.BadgeStyle.Clothes}, true, function(Hovered, Active, Selected) - if (Selected) then - setUniform(PersonalMenu.ClothesButtons[i], plyPed) + if quantity > ammo then + GameNotification(_U('not_enough_ammo')) + return end + + local finalAmmo = math.floor(ammo - quantity) + SetPedAmmo(plyPed, itemSelected.name, finalAmmo) + + TriggerServerEvent('bpt_menu:Weapon_addAmmoToPedS', GetPlayerServerId(closestPlayer), itemSelected.name, quantity) + GameNotification(_U('gave_ammo', quantity, GetPlayerName(closestPlayer))) + RageUI.CloseAll() end) - end - end) -end -function RenderAccessoriesMenu() - RageUI.DrawContent({header = true, instructionalButton = true}, function() - for i = 1, #PersonalMenu.AccessoriesButtons, 1 do - RageUI.Button(_U(('accessories_%s'):format((PersonalMenu.AccessoriesButtons[i]:lower()))), nil, {RightBadge = RageUI.BadgeStyle.Clothes}, true, function(Hovered, Active, Selected) - if (Selected) then - setAccessory(PersonalMenu.AccessoriesButtons[i]) + RageUI.Button(_U('loadout_drop_button'), "", {RightBadge = RageUI.BadgeStyle.Alert}, true, function(Hovered, Active, Selected) + if not Selected then return end + + local itemSelected = PersonalMenu.ItemSelected + + if not IsPedOnFoot(plyPed) then + GameNotification(_U('in_vehicle_drop', itemSelected.label)) + return end + + TriggerServerEvent('esx:removeInventoryItem', 'item_weapon', itemSelected.name) + RageUI.CloseAll() end) end end) end -function RenderAnimationMenu() - RageUI.DrawContent({header = true, instructionalButton = true}, function() - for i = 1, #RMenu['animation'], 1 do - RageUI.Button(RMenu['animation'][i].Menu.Title, nil, {RightLabel = "→→→"}, true, function() end, RMenu['animation'][i].Menu) +getPersonalMenuCategory('inventory').drawer = function() + local inventory = GetPlayerInventory() + + for i = 1, #inventory do + local invItem = inventory[i] + + if invItem.count > 0 then + local invCount = {} + for j = 1, invItem.count do invCount[j] = j end + + RageUI.List(('%s (%u)'):format(invItem.label, invItem.count), invCount, PersonalMenu.ItemIndex[invItem.name] or 1, nil, nil, true, function(Hovered, Active, Selected, Index) + PersonalMenu.ItemIndex[invItem.name] = Index + + if not Selected then return end + PersonalMenu.ItemSelected = invItem + end, inventoryActionsMenu) end - end) + end end -function RenderAnimationsSubMenu(menu) - RageUI.DrawContent({header = true, instructionalButton = true}, function() - for i = 1, #Config.Animations, 1 do - if Config.Animations[i].name == menu then - for j = 1, #Config.Animations[i].items, 1 do - RageUI.Button(Config.Animations[i].items[j].label, nil, {}, true, function(Hovered, Active, Selected) - if (Selected) then - if Config.Animations[i].items[j].type == 'anim' then - startAnim(Config.Animations[i].items[j].data.lib, Config.Animations[i].items[j].data.anim) - elseif Config.Animations[i].items[j].type == 'scenario' then - TaskStartScenarioInPlace(plyPed, Config.Animations[i].items[j].data.anim, 0, false) - elseif Config.Animations[i].items[j].type == 'attitude' then - startAttitude(Config.Animations[i].items[j].data.lib, Config.Animations[i].items[j].data.anim) - end - end - end) - end - end +getPersonalMenuCategory('loadout').drawer = function() + for i = 1, #PersonalMenu.WeaponData do + local weaponData = PersonalMenu.WeaponData[i] + + if HasPedGotWeapon(plyPed, weaponData.hash, false) then + local ammo = GetAmmoInPedWeapon(plyPed, weaponData.hash) + + RageUI.Button(('%s [%u]'):format(weaponData.label, ammo), nil, {RightLabel = "→→→"}, true, function(Hovered, Active, Selected) + if not Selected then return end + PersonalMenu.ItemSelected = weaponData + end, loadoutActionsMenu) end - end) + end end -function RenderVehicleMenu() - RageUI.DrawContent({header = true, instructionalButton = true}, function() - RageUI.Button(_U('vehicle_engine_button'), nil, {}, true, function(Hovered, Active, Selected) - if (Selected) then - if IsPedSittingInAnyVehicle(plyPed) then - local plyVeh = GetVehiclePedIsIn(plyPed, false) - - if GetIsVehicleEngineRunning(plyVeh) then - SetVehicleEngineOn(plyVeh, false, false, true) - SetVehicleUndriveable(plyVeh, true) - elseif not GetIsVehicleEngineRunning(plyVeh) then - SetVehicleEngineOn(plyVeh, true, false, true) - SetVehicleUndriveable(plyVeh, false) - end - else - ESX.ShowNotification(_U('no_vehicle')) - end - end - end) +local accountInPockets = { + ['money'] = 'wallet_money_button', + ['black_money'] = 'wallet_blackmoney_button' +} - RageUI.List(_U('vehicle_door_button'), PersonalMenu.DoorList, PersonalMenu.DoorIndex, nil, {}, true, function(Hovered, Active, Selected, Index) - if (Selected) then - if IsPedSittingInAnyVehicle(plyPed) then - local plyVeh = GetVehiclePedIsIn(plyPed, false) - - if Index == 1 then - if not PersonalMenu.DoorState.FrontLeft then - PersonalMenu.DoorState.FrontLeft = true - SetVehicleDoorOpen(plyVeh, 0, false, false) - elseif PersonalMenu.DoorState.FrontLeft then - PersonalMenu.DoorState.FrontLeft = false - SetVehicleDoorShut(plyVeh, 0, false, false) - end - elseif Index == 2 then - if not PersonalMenu.DoorState.FrontRight then - PersonalMenu.DoorState.FrontRight = true - SetVehicleDoorOpen(plyVeh, 1, false, false) - elseif PersonalMenu.DoorState.FrontRight then - PersonalMenu.DoorState.FrontRight = false - SetVehicleDoorShut(plyVeh, 1, false, false) +getPersonalMenuCategory('wallet').drawer = function() + local playerJob = GetPlayerJob() + RageUI.Button(_U('wallet_job_button', playerJob.name, playerJob.gradeName), nil, nil, true, nil) + + if Config.DoubleJob then + local playerJob2 = GetPlayerJob2() + RageUI.Button(_U('wallet_job2_button', playerJob2.name, playerJob2.gradeName), nil, nil, true, nil) + end + + local playerAccounts = GetPlayerAccounts() + for i = 1, #playerAccounts do + local account = playerAccounts[i] + + if accountInPockets[account.name] then + if PersonalMenu.WalletIndex[account.name] == nil then PersonalMenu.WalletIndex[account.name] = 1 end + + RageUI.List(_U(accountInPockets[account.name], GroupDigits(account.money)), PersonalMenu.WalletList, PersonalMenu.WalletIndex[account.name] or 1, nil, nil, true, function(Hovered, Active, Selected, Index) + if not Selected then return end + + if Index == 1 then + local post, quantity = CheckQuantity(KeyboardInput('PM_BOX_AMOUNT', _U('dialogbox_amount'), '', 8)) + + if post then + local closestPlayer, closestDistance = GetClosestPlayer() + if closestDistance == -1 or closestDistance > 3 then + GameNotification(_U('players_nearby')) + return end - elseif Index == 3 then - if not PersonalMenu.DoorState.BackLeft then - PersonalMenu.DoorState.BackLeft = true - SetVehicleDoorOpen(plyVeh, 2, false, false) - elseif PersonalMenu.DoorState.BackLeft then - PersonalMenu.DoorState.BackLeft = false - SetVehicleDoorShut(plyVeh, 2, false, false) + + local closestPed = GetPlayerPed(closestPlayer) + + if not IsPedSittingInAnyVehicle(closestPed) then + TriggerServerEvent('esx:giveInventoryItem', GetPlayerServerId(closestPlayer), 'item_account', account.name, quantity) + RageUI.CloseAll() + else + GameNotification(_U('in_vehicle_give', 'de l\'argent')) end - elseif Index == 4 then - if not PersonalMenu.DoorState.BackRight then - PersonalMenu.DoorState.BackRight = true - SetVehicleDoorOpen(plyVeh, 3, false, false) - elseif PersonalMenu.DoorState.BackRight then - PersonalMenu.DoorState.BackRight = false - SetVehicleDoorShut(plyVeh, 3, false, false) + else + GameNotification(_U('amount_invalid')) + end + elseif Index == 2 then + local post, quantity = CheckQuantity(KeyboardInput('PM_BOX_AMOUNT', _U('dialogbox_amount'), '', 8)) + + if post then + if not IsPedSittingInAnyVehicle(plyPed) then + TriggerServerEvent('esx:removeInventoryItem', 'item_account', account.name, quantity) + RageUI.CloseAll() + else + GameNotification(_U('in_vehicle_drop', 'de l\'argent')) end + else + GameNotification(_U('amount_invalid')) end - else - ESX.ShowNotification(_U('no_vehicle')) end + + PersonalMenu.WalletIndex[account.name] = Index + end) + elseif account.name == 'bank' then + RageUI.Button(_U('wallet_bankmoney_button', GroupDigits(account.money)), nil, nil, true, nil) + end + end + + if Config.JSFourIDCard then + RageUI.Button(_U('wallet_show_idcard_button'), nil, nil, true, function(Hovered, Active, Selected) + if not Selected then return end + + local closestPlayer, closestDistance = GetClosestPlayer() + + if closestDistance ~= -1 and closestDistance <= 3.0 then + TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(closestPlayer)) + else + GameNotification(_U('players_nearby')) end + end) - PersonalMenu.DoorIndex = Index + RageUI.Button(_U('wallet_check_idcard_button'), nil, nil, true, function(Hovered, Active, Selected) + if not Selected then return end + TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(PlayerId())) end) - RageUI.Button(_U('vehicle_hood_button'), nil, {}, true, function(Hovered, Active, Selected) - if (Selected) then - if IsPedSittingInAnyVehicle(plyPed) then - local plyVeh = GetVehiclePedIsIn(plyPed, false) - - if not PersonalMenu.DoorState.Hood then - PersonalMenu.DoorState.Hood = true - SetVehicleDoorOpen(plyVeh, 4, false, false) - elseif PersonalMenu.DoorState.Hood then - PersonalMenu.DoorState.Hood = false - SetVehicleDoorShut(plyVeh, 4, false, false) - end - else - ESX.ShowNotification(_U('no_vehicle')) - end + RageUI.Button(_U('wallet_show_driver_button'), nil, nil, true, function(Hovered, Active, Selected) + if not Selected then return end + + local closestPlayer, closestDistance = GetClosestPlayer() + + if closestDistance ~= -1 and closestDistance <= 3.0 then + TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(closestPlayer), 'driver') + else + GameNotification(_U('players_nearby')) end end) - RageUI.Button(_U('vehicle_trunk_button'), nil, {}, true, function(Hovered, Active, Selected) - if (Selected) then - if IsPedSittingInAnyVehicle(plyPed) then - local plyVeh = GetVehiclePedIsIn(plyPed, false) - - if not PersonalMenu.DoorState.Trunk then - PersonalMenu.DoorState.Trunk = true - SetVehicleDoorOpen(plyVeh, 5, false, false) - elseif PersonalMenu.DoorState.Trunk then - PersonalMenu.DoorState.Trunk = false - SetVehicleDoorShut(plyVeh, 5, false, false) - end - else - ESX.ShowNotification(_U('no_vehicle')) - end + RageUI.Button(_U('wallet_check_driver_button'), nil, nil, true, function(Hovered, Active, Selected) + if not Selected then return end + TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(PlayerId()), 'driver') + end) + + RageUI.Button(_U('wallet_show_firearms_button'), nil, nil, true, function(Hovered, Active, Selected) + if not Selected then return end + + local closestPlayer, closestDistance = GetClosestPlayer() + + if closestDistance ~= -1 and closestDistance <= 3.0 then + TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(closestPlayer), 'weapon') + else + GameNotification(_U('players_nearby')) end end) - end) + + RageUI.Button(_U('wallet_check_firearms_button'), nil, nil, true, function(Hovered, Active, Selected) + if not Selected then return end + TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(PlayerId()), 'weapon') + end) + end end -function RenderBossMenu() - RageUI.DrawContent({header = true, instructionalButton = true}, function() - if societymoney ~= nil then - RageUI.Button(_U('bossmanagement_chest_button'), nil, {RightLabel = '$' .. societymoney}, true, function() end) - end +getPersonalMenuCategory('billing').drawer = function() + for i = 1, #PersonalMenu.BillData do + local billData = PersonalMenu.BillData[i] - RageUI.Button(_U('bossmanagement_hire_button'), nil, {}, true, function(Hovered, Active, Selected) - if (Selected) then - if ESX.PlayerData.job.grade_name == 'boss' then - local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() + RageUI.Button(billData.label, nil, { RightLabel = ('$%s'):format(GroupDigits(billData.amount)) }, true, function(Hovered, Active, Selected) + if not Selected then return end - if closestPlayer == -1 or closestDistance > 3.0 then - ESX.ShowNotification(_U('players_nearby')) - else - TriggerServerEvent('bpt_menu:Boss_recruitplayer', GetPlayerServerId(closestPlayer)) - end - else - ESX.ShowNotification(_U('missing_rights')) - end - end + TriggerServerCallback('esx_billing:payBill', function() + TriggerServerCallback('bpt_menu:Bill_getBills', function(bills) PersonalMenu.BillData = bills end) + end, billData.id) end) + end +end - RageUI.Button(_U('bossmanagement_fire_button'), nil, {}, true, function(Hovered, Active, Selected) - if (Selected) then - if ESX.PlayerData.job.grade_name == 'boss' then - local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() +getPersonalMenuCategory('clothes').drawer = function() + for i = 1, #PersonalMenu.ClothesButtons do + local clotheId = PersonalMenu.ClothesButtons[i] - if closestPlayer == -1 or closestDistance > 3.0 then - ESX.ShowNotification(_U('players_nearby')) - else - TriggerServerEvent('bpt_menu:Boss_fireplayer', GetPlayerServerId(closestPlayer)) - end - else - ESX.ShowNotification(_U('missing_rights')) - end - end + RageUI.Button(_U(('clothes_%s'):format(clotheId)), nil, {RightBadge = RageUI.BadgeStyle.Clothes}, true, function(Hovered, Active, Selected) + if not Selected then return end + setClothes(clotheId) end) + end +end - RageUI.Button(_U('bossmanagement_promote_button'), nil, {}, true, function(Hovered, Active, Selected) - if (Selected) then - if ESX.PlayerData.job.grade_name == 'boss' then - local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() +getPersonalMenuCategory('accessories').drawer = function() + for i = 1, #PersonalMenu.AccessoriesButtons do + local accessoryId = PersonalMenu.AccessoriesButtons[i] - if closestPlayer == -1 or closestDistance > 3.0 then - ESX.ShowNotification(_U('players_nearby')) - else - TriggerServerEvent('bpt_menu:Boss_promoteplayer', GetPlayerServerId(closestPlayer)) - end - else - ESX.ShowNotification(_U('missing_rights')) - end - end + RageUI.Button(_U(('accessories_%s'):format(accessoryId)), nil, {RightBadge = RageUI.BadgeStyle.Clothes}, true, function(Hovered, Active, Selected) + if not Selected then return end + setAccessory(accessoryId) end) + end +end - RageUI.Button(_U('bossmanagement_demote_button'), nil, {}, true, function(Hovered, Active, Selected) - if (Selected) then - if ESX.PlayerData.job.grade_name == 'boss' then - local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() +getPersonalMenuCategory('animation').drawer = function() + for i = 1, #Config.Animations do + local animationCfg = Config.Animations[i] + RageUI.Button(animationCfg.name, nil, {RightLabel = "→→→"}, true, nil, animationCfg.menu) + end +end - if closestPlayer == -1 or closestDistance > 3.0 then - ESX.ShowNotification(_U('players_nearby')) - else - TriggerServerEvent('bpt_menu:Boss_dismissplayer', GetPlayerServerId(closestPlayer)) - end - else - ESX.ShowNotification(_U('missing_rights')) +function DrawAnimationsCategory(animationCfg) + ruiDrawContent(drawContentOptions, function() + for i = 1, #animationCfg.items do + local animItemCfg = animationCfg.items[i] + + RageUI.Button(animItemCfg.name, nil, nil, true, function(Hovered, Active, Selected) + if not Selected then return end + + if animItemCfg.type == 'anim' then + startAnim(animItemCfg.animDict, animItemCfg.animName) + elseif animItemCfg.type == 'scenario' then + TaskStartScenarioInPlace(plyPed, animItemCfg.scenarioName, 0, false) + elseif animItemCfg.type == 'attitude' then + startAttitude(animItemCfg.animSet) end - end - end) + end) + end end) end -function RenderBoss2Menu() - RageUI.DrawContent({header = true, instructionalButton = true}, function() - if societymoney ~= nil then - RageUI.Button(_U('bossmanagement2_chest_button'), nil, {RightLabel = '$' .. societymoney2}, true, function() end) +getPersonalMenuCategory('vehicle').drawer = function() + RageUI.Button(_U('vehicle_engine_button'), nil, nil, true, function(Hovered, Active, Selected) + if not Selected then return end + + if not IsPedSittingInAnyVehicle(plyPed) then + GameNotification(_U('no_vehicle')) + return end - RageUI.Button(_U('bossmanagement2_hire_button'), nil, {}, true, function(Hovered, Active, Selected) - if (Selected) then - if ESX.PlayerData.job2.grade_name == 'boss' then - local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() + local plyVeh = GetVehiclePedIsIn(plyPed, false) - if closestPlayer == -1 or closestDistance > 3.0 then - ESX.ShowNotification(_U('players_nearby')) - else - TriggerServerEvent('bpt_menu:Boss_recruitplayer2', GetPlayerServerId(closestPlayer)) - end - else - ESX.ShowNotification(_U('missing_rights')) - end - end - end) + if GetIsVehicleEngineRunning(plyVeh) then + SetVehicleEngineOn(plyVeh, false, false, true) + SetVehicleUndriveable(plyVeh, true) + elseif not GetIsVehicleEngineRunning(plyVeh) then + SetVehicleEngineOn(plyVeh, true, false, true) + SetVehicleUndriveable(plyVeh, false) + end + end) - RageUI.Button(_U('bossmanagement2_fire_button'), nil, {}, true, function(Hovered, Active, Selected) - if (Selected) then - if ESX.PlayerData.job2.grade_name == 'boss' then - local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() + RageUI.List(_U('vehicle_door_button'), PersonalMenu.DoorList, PersonalMenu.DoorIndex, nil, nil, true, function(Hovered, Active, Selected, Index) + PersonalMenu.DoorIndex = Index - if closestPlayer == -1 or closestDistance > 3.0 then - ESX.ShowNotification(_U('players_nearby')) - else - TriggerServerEvent('bpt_menu:Boss_fireplayer2', GetPlayerServerId(closestPlayer)) - end - else - ESX.ShowNotification(_U('missing_rights')) - end - end - end) + if not Selected then return end - RageUI.Button(_U('bossmanagement2_promote_button'), nil, {}, true, function(Hovered, Active, Selected) - if (Selected) then - if ESX.PlayerData.job2.grade_name == 'boss' then - local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() + if not IsPedSittingInAnyVehicle(plyPed) then + GameNotification(_U('no_vehicle')) + return + end - if closestPlayer == -1 or closestDistance > 3.0 then - ESX.ShowNotification(_U('players_nearby')) - else - TriggerServerEvent('bpt_menu:Boss_promoteplayer2', GetPlayerServerId(closestPlayer)) - end - else - ESX.ShowNotification(_U('missing_rights')) - end + local plyVeh = GetVehiclePedIsIn(plyPed, false) + + if Index == 1 then + if not PersonalMenu.DoorState.FrontLeft then + PersonalMenu.DoorState.FrontLeft = true + SetVehicleDoorOpen(plyVeh, 0, false, false) + elseif PersonalMenu.DoorState.FrontLeft then + PersonalMenu.DoorState.FrontLeft = false + SetVehicleDoorShut(plyVeh, 0, false, false) end - end) + elseif Index == 2 then + if not PersonalMenu.DoorState.FrontRight then + PersonalMenu.DoorState.FrontRight = true + SetVehicleDoorOpen(plyVeh, 1, false, false) + elseif PersonalMenu.DoorState.FrontRight then + PersonalMenu.DoorState.FrontRight = false + SetVehicleDoorShut(plyVeh, 1, false, false) + end + elseif Index == 3 then + if not PersonalMenu.DoorState.BackLeft then + PersonalMenu.DoorState.BackLeft = true + SetVehicleDoorOpen(plyVeh, 2, false, false) + elseif PersonalMenu.DoorState.BackLeft then + PersonalMenu.DoorState.BackLeft = false + SetVehicleDoorShut(plyVeh, 2, false, false) + end + elseif Index == 4 then + if not PersonalMenu.DoorState.BackRight then + PersonalMenu.DoorState.BackRight = true + SetVehicleDoorOpen(plyVeh, 3, false, false) + elseif PersonalMenu.DoorState.BackRight then + PersonalMenu.DoorState.BackRight = false + SetVehicleDoorShut(plyVeh, 3, false, false) + end + end + end) - RageUI.Button(_U('bossmanagement2_demote_button'), nil, {}, true, function(Hovered, Active, Selected) - if (Selected) then - if ESX.PlayerData.job2.grade_name == 'boss' then - local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() + RageUI.Button(_U('vehicle_hood_button'), nil, nil, true, function(Hovered, Active, Selected) + if not Selected then return end - if closestPlayer == -1 or closestDistance > 3.0 then - ESX.ShowNotification(_U('players_nearby')) - else - TriggerServerEvent('bpt_menu:Boss_dismissplayer2', GetPlayerServerId(closestPlayer)) - end - else - ESX.ShowNotification(_U('missing_rights')) - end - end - end) + if not IsPedSittingInAnyVehicle(plyPed) then + GameNotification(_U('no_vehicle')) + return + end + + local plyVeh = GetVehiclePedIsIn(plyPed, false) + + if not PersonalMenu.DoorState.Hood then + PersonalMenu.DoorState.Hood = true + SetVehicleDoorOpen(plyVeh, 4, false, false) + elseif PersonalMenu.DoorState.Hood then + PersonalMenu.DoorState.Hood = false + SetVehicleDoorShut(plyVeh, 4, false, false) + end end) -end -function RenderAdminMenu() - RageUI.DrawContent({header = true, instructionalButton = true}, function() - for i = 1, #Config.Admin, 1 do - local authorized = false + RageUI.Button(_U('vehicle_trunk_button'), nil, nil, true, function(Hovered, Active, Selected) + if not Selected then return end - for j = 1, #Config.Admin[i].groups, 1 do - if Config.Admin[i].groups[j] == Player.group then - authorized = true - end - end + if not IsPedSittingInAnyVehicle(plyPed) then + GameNotification(_U('no_vehicle')) + return + end - if authorized then - RageUI.Button(Config.Admin[i].label, nil, {}, true, function(Hovered, Active, Selected) - if (Selected) then - Config.Admin[i].command() - end - end) - else - RageUI.Button(Config.Admin[i].label, nil, {RightBadge = RageUI.BadgeStyle.Lock}, false, function() end) - end + local plyVeh = GetVehiclePedIsIn(plyPed, false) + + if not PersonalMenu.DoorState.Trunk then + PersonalMenu.DoorState.Trunk = true + SetVehicleDoorOpen(plyVeh, 5, false, false) + elseif PersonalMenu.DoorState.Trunk then + PersonalMenu.DoorState.Trunk = false + SetVehicleDoorShut(plyVeh, 5, false, false) end end) end -CreateThread(function() - while true do - Wait(0) +getPersonalMenuCategory('boss').drawer = function() + if societyMoney then + RageUI.Button(_U('bossmanagement_chest_button'), nil, { RightLabel = ('$%s'):format(GroupDigits(societyMoney)) }, true, nil) + end - if IsControlJustReleased(0, Config.Controls.OpenMenu.keyboard) and not Player.isDead then - if not RageUI.Visible() then - ESX.TriggerServerCallback('bpt_menu:Admin_getUsergroup', function(plyGroup) - Player.group = plyGroup - - ESX.TriggerServerCallback('bpt_menu:Bill_getBills', function(bills) - PersonalMenu.BillData = bills - ESX.PlayerData = ESX.GetPlayerData() - RageUI.Visible(RMenu.Get('rageui', 'personal'), true) - end) - end) - end - end + RageUI.Button(_U('bossmanagement_hire_button'), nil, nil, true, function(Hovered, Active, Selected) + if not Selected then return end - if RageUI.Visible(RMenu.Get('rageui', 'personal')) then - RenderPersonalMenu() + local playerJob = GetPlayerJob() + + if not playerJob.isBoss then + GameNotification(_U('missing_rights')) + return end - if RageUI.Visible(RMenu.Get('inventory', 'actions')) then - RenderActionsMenu('inventory') - elseif RageUI.Visible(RMenu.Get('loadout', 'actions')) then - RenderActionsMenu('loadout') + local closestPlayer, closestDistance = GetClosestPlayer() + if closestPlayer == -1 or closestDistance > 3.0 then + GameNotification(_U('players_nearby')) + return end - if RageUI.Visible(RMenu.Get('personal', 'inventory')) then - RenderInventoryMenu() + TriggerServerEvent('bpt_menu:Boss_recruterplayer', GetPlayerServerId(closestPlayer)) + end) + + RageUI.Button(_U('bossmanagement_fire_button'), nil, nil, true, function(Hovered, Active, Selected) + if not Selected then return end + + local playerJob = GetPlayerJob() + + if not playerJob.isBoss then + GameNotification(_U('missing_rights')) + return end - if RageUI.Visible(RMenu.Get('personal', 'loadout')) then - RenderWeaponMenu() + local closestPlayer, closestDistance = GetClosestPlayer() + if closestPlayer == -1 or closestDistance > 3.0 then + GameNotification(_U('players_nearby')) + return end - if RageUI.Visible(RMenu.Get('personal', 'wallet')) then - RenderWalletMenu() + TriggerServerEvent('bpt_menu:Boss_virerplayer', GetPlayerServerId(closestPlayer)) + end) + + RageUI.Button(_U('bossmanagement_promote_button'), nil, nil, true, function(Hovered, Active, Selected) + if not Selected then return end + + local playerJob = GetPlayerJob() + + if not playerJob.isBoss then + GameNotification(_U('missing_rights')) + return end - if RageUI.Visible(RMenu.Get('personal', 'billing')) then - RenderBillingMenu() + local closestPlayer, closestDistance = GetClosestPlayer() + if closestPlayer == -1 or closestDistance > 3.0 then + GameNotification(_U('players_nearby')) + return end - if RageUI.Visible(RMenu.Get('personal', 'clothes')) then - RenderClothesMenu() + TriggerServerEvent('bpt_menu:Boss_promouvoirplayer', GetPlayerServerId(closestPlayer)) + end) + + RageUI.Button(_U('bossmanagement_demote_button'), nil, nil, true, function(Hovered, Active, Selected) + if not Selected then return end + + local playerJob = GetPlayerJob() + + if not playerJob.isBoss then + GameNotification(_U('missing_rights')) + return end - if RageUI.Visible(RMenu.Get('personal', 'accessories')) then - RenderAccessoriesMenu() + local closestPlayer, closestDistance = GetClosestPlayer() + if closestPlayer == -1 or closestDistance > 3.0 then + GameNotification(_U('players_nearby')) + return end - if RageUI.Visible(RMenu.Get('personal', 'animation')) then - RenderAnimationMenu() + TriggerServerEvent('bpt_menu:Boss_destituerplayer', GetPlayerServerId(closestPlayer)) + end) +end + +if Config.DoubleJob then + getPersonalMenuCategory('boss2').drawer = function() + if societyMoney ~= nil then + RageUI.Button(_U('bossmanagement2_chest_button'), nil, { RightLabel = ('$%s'):format(GroupDigits(societyMoney2)) }, true, nil) end - if RageUI.Visible(RMenu.Get('personal', 'vehicle')) then - if not RMenu.Settings('personal', 'vehicle', 'Restriction')() then - RageUI.GoBack() + RageUI.Button(_U('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(_U('missing_rights')) + return end - RenderVehicleMenu() - end - if RageUI.Visible(RMenu.Get('personal', 'boss')) then - if not RMenu.Settings('personal', 'boss', 'Restriction')() then - RageUI.GoBack() + local closestPlayer, closestDistance = GetClosestPlayer() + if closestPlayer == -1 or closestDistance > 3.0 then + GameNotification(_U('players_nearby')) + return end - RenderBossMenu() - end - if RageUI.Visible(RMenu.Get('personal', 'boss2')) then - if not RMenu.Settings('personal', 'boss2', 'Restriction')() then - RageUI.GoBack() + TriggerServerEvent('bpt_menu:Boss_recruterplayer2', GetPlayerServerId(closestPlayer)) + end) + + RageUI.Button(_U('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(_U('missing_rights')) + return end - RenderBoss2Menu() - end - if RageUI.Visible(RMenu.Get('personal', 'admin')) then - if not RMenu.Settings('personal', 'admin', 'Restriction')() then - RageUI.GoBack() + local closestPlayer, closestDistance = GetClosestPlayer() + if closestPlayer == -1 or closestDistance > 3.0 then + GameNotification(_U('players_nearby')) + return + end + + TriggerServerEvent('bpt_menu:Boss_virerplayer2', GetPlayerServerId(closestPlayer)) + end) + + RageUI.Button(_U('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(_U('missing_rights')) + return end - RenderAdminMenu() - end - for i = 1, #Config.Animations, 1 do - if RageUI.Visible(RMenu.Get('animation', Config.Animations[i].name)) then - RenderAnimationsSubMenu(Config.Animations[i].name) + local closestPlayer, closestDistance = GetClosestPlayer() + if closestPlayer == -1 or closestDistance > 3.0 then + GameNotification(_U('players_nearby')) + return end + + TriggerServerEvent('bpt_menu:Boss_promouvoirplayer2', GetPlayerServerId(closestPlayer)) + end) + + RageUI.Button(_U('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(_U('missing_rights')) + return + end + + local closestPlayer, closestDistance = GetClosestPlayer() + if closestPlayer == -1 or closestDistance > 3.0 then + GameNotification(_U('players_nearby')) + return + end + + TriggerServerEvent('bpt_menu:Boss_destituerplayer2', GetPlayerServerId(closestPlayer)) + end) + end +end + +getPersonalMenuCategory('admin').drawer = function() + for i = 1, #Config.AdminCommands do + local adminCommandCfg = Config.AdminCommands[i] + + if adminCommandCfg.groupsById[PlayerVars.group] then + RageUI.Button(adminCommandCfg.name, nil, nil, true, function(Hovered, Active, Selected) + if not Selected then return end + adminCommandCfg.command() + end) + else + RageUI.Button(adminCommandCfg.name, nil, {RightBadge = RageUI.BadgeStyle.Lock}, false, nil) end end -end) +end + +RegisterCommand('+openpersonal', function() + if PlayerVars.isDead then return end + if RageUI.Visible(mainMenu) then return end + + TriggerServerCallback('bpt_menu:Admin_getUsergroup', function(plyGroup) + PlayerVars.group = plyGroup + end) + + TriggerServerCallback('bpt_menu:Bill_getBills', function(bills) + PersonalMenu.BillData = bills + end) + + TriggerEvent('bpt_menu:menuOpening') + RageUI.Visible(mainMenu, true) + DrawPersonalMenu() +end, false) + +RegisterCommand('-openpersonal', function() end, false) + +RegisterKeyMapping('+openpersonal', 'Ouvrir le menu personnel', 'KEYBOARD', Config.Controls.OpenMenu.keyboard) +TriggerEvent('chat:removeSuggestion', '/+openpersonal') +TriggerEvent('chat:removeSuggestion', '/-openpersonal') CreateThread(function() - while true do - plyPed = PlayerPedId() + local ruiVisible = RageUI.Visible - if IsControlJustReleased(0, Config.Controls.StopTasks.keyboard) and IsInputDisabled(2) and not Player.isDead then - Player.handsup, Player.pointing = false, false - ClearPedTasks(plyPed) + while true do + if ruiVisible(mainMenu) then + DrawPersonalMenu() + goto continue end - if IsControlPressed(1, Config.Controls.TPMarker.keyboard1) and IsControlJustReleased(1, Config.Controls.TPMarker.keyboard2) and IsInputDisabled(2) and not Player.isDead then - ESX.TriggerServerCallback('bpt_menu:Admin_getUsergroup', function(plyGroup) - if plyGroup ~= nil and (plyGroup == 'mod' or plyGroup == 'admin' or plyGroup == 'superadmin' or plyGroup == 'owner' or plyGroup == '_dev') then - local waypointHandle = GetFirstBlipInfoId(8) - - if DoesBlipExist(waypointHandle) then - CreateThread(function() - local waypointCoords = GetBlipInfoIdCoord(waypointHandle) - local foundGround, zCoords, zPos = false, -500.0, 0.0 - - while not foundGround do - zCoords = zCoords + 10.0 - RequestCollisionAtCoord(waypointCoords.x, waypointCoords.y, zCoords) - Wait(0) - foundGround, zPos = GetGroundZFor_3dCoord(waypointCoords.x, waypointCoords.y, zCoords) - - if not foundGround and zCoords >= 2000.0 then - foundGround = true - end - end - - SetPedCoordsKeepVehicle(plyPed, waypointCoords.x, waypointCoords.y, zPos) - ESX.ShowNotification(_U('admin_tpmarker')) - end) - else - ESX.ShowNotification(_U('admin_nomarker')) - end - end - end) + if ruiVisible(inventoryActionsMenu) then + DrawActionsMenu('inventory') + goto continue end - if Player.showCoords then - local plyCoords = GetEntityCoords(plyPed, false) - Text('~r~X~s~: ' .. ESX.Math.Round(plyCoords.x, 2) .. '\n~b~Y~s~: ' .. ESX.Math.Round(plyCoords.y, 2) .. '\n~g~Z~s~: ' .. ESX.Math.Round(plyCoords.z, 2) .. '\n~y~Angle~s~: ' .. ESX.Math.Round(GetEntityPhysicsHeading(plyPed), 2)) + if ruiVisible(loadoutActionsMenu) then + DrawActionsMenu('loadout') + goto continue end - if Player.noclip then - local plyCoords = GetEntityCoords(plyPed, false) - local camCoords = getCamDirection() - SetEntityVelocity(plyPed, 0.01, 0.01, 0.01) + for i = 1, #personalMenuCategories do + local pmCategory = personalMenuCategories[i] - if IsControlPressed(0, 32) then - plyCoords = plyCoords + (Config.NoclipSpeed * camCoords) - end + if ruiVisible(pmCategory.menu) then + if not pmCategory.restriction or pmCategory.restriction() then + ruiDrawContent(drawContentOptions, pmCategory.drawer) + else + RageUI.GoBack() + end - if IsControlPressed(0, 269) then - plyCoords = plyCoords - (Config.NoclipSpeed * camCoords) + goto continue end + end - SetEntityCoordsNoOffset(plyPed, plyCoords, true, true, true) + for i = 1, #Config.Animations do + local animationCfg = Config.Animations[i] + + if ruiVisible(animationCfg.menu) then + DrawAnimationsCategory(animationCfg) + goto continue + end end + ::continue:: Wait(0) end end) +RegisterCommand('+stoptask', function() + local playerPed = PlayerPedId() + + if (not IsPedArmed(playerPed, tonumber('111', 2)) or IsPedInAnyVehicle(playerPed)) and not PlayerVars.isDead then + if GetScriptTaskStatus(playerPed, `SCRIPT_TASK_START_SCENARIO_IN_PLACE`) == 1 or GetScriptTaskStatus(playerPed, `SCRIPT_TASK_PLAY_ANIM`) == 1 then + ResetOtherAnimsVals() + ClearPedTasks(plyPed) + end + end +end, false) + +RegisterCommand('-stoptask', function() end, false) + +RegisterKeyMapping('+stoptask', 'Annulez animation', 'KEYBOARD', Config.Controls.StopTasks.keyboard) +TriggerEvent('chat:removeSuggestion', '/+stoptask') +TriggerEvent('chat:removeSuggestion', '/-stoptask') + +function tpMarker() + local waypointHandle = GetFirstBlipInfoId(8) + + if not DoesBlipExist(waypointHandle) then + GameNotification(_U('admin_nomarker')) + return + end + + CreateThread(function() + local waypointCoords = GetBlipInfoIdCoord(waypointHandle) + local foundGround, zCoords, zPos = false, -500.0, 0.0 + + while not foundGround do + zCoords = zCoords + 10.0 + RequestCollisionAtCoord(waypointCoords.x, waypointCoords.y, zCoords) + Wait(0) + foundGround, zPos = GetGroundZFor_3dCoord(waypointCoords.x, waypointCoords.y, zCoords, false) + + if not foundGround and zCoords >= 2000.0 then + foundGround = true + end + end + + SetPedCoordsKeepVehicle(plyPed, waypointCoords.x, waypointCoords.y, zPos) + GameNotification(_U('admin_tpmarker')) + end) +end + CreateThread(function() while true do - if Player.showName then - for k, v in ipairs(ESX.Game.GetPlayers()) do - local otherPed = GetPlayerPed(v) + plyPed = PlayerPedId() - if otherPed ~= plyPed then - if #(GetEntityCoords(plyPed, false) - GetEntityCoords(otherPed, false)) < 5000.0 then - Player.gamerTags[v] = CreateFakeMpGamerTag(otherPed, ('[%s] %s'):format(GetPlayerServerId(v), GetPlayerName(v)), false, false, '', 0) - else - RemoveMpGamerTag(Player.gamerTags[v]) - Player.gamerTags[v] = nil - end + if (IsControlPressed(0, Config.Controls.TPMarker.keyboard1) or IsDisabledControlPressed(0, Config.Controls.TPMarker.keyboard1)) and + (IsControlJustReleased(0, Config.Controls.TPMarker.keyboard2) or IsDisabledControlJustReleased(0, Config.Controls.TPMarker.keyboard2)) and + IsUsingKeyboard(2) and + not PlayerVars.isDead + then + TriggerServerCallback('bpt_menu:Admin_getUsergroup', function(plyGroup) + if not adminGroups[plyGroup] then + return end - end + + tpMarker() + end) end - Wait(100) + + if PlayerVars.showCoords then + local plyCoords = GetEntityCoords(plyPed, false) + Text('~r~X~s~: ' .. MathRound(plyCoords.x, 2) .. '\n~b~Y~s~: ' .. MathRound(plyCoords.y, 2) .. '\n~g~Z~s~: ' .. MathRound(plyCoords.z, 2) .. '\n~y~Angle~s~: ' .. MathRound(GetEntityPhysicsHeading(plyPed), 2)) + end + + Wait(0) end end) \ No newline at end of file diff --git a/server-data/resources/[bpt_addons]/bpt_menu/client/other.lua b/server-data/resources/[bpt_addons]/bpt_menu/client/other.lua index bf2948adc..9b574cc56 100644 --- a/server-data/resources/[bpt_addons]/bpt_menu/client/other.lua +++ b/server-data/resources/[bpt_addons]/bpt_menu/client/other.lua @@ -1,118 +1,136 @@ -local function startPointing(plyPed) - ESX.Streaming.RequestAnimDict('anim@mp_point', function() - SetPedConfigFlag(plyPed, 36, 1) - TaskMoveNetworkByName(plyPed, 'task_mp_pointing', 0.5, 0, 'anim@mp_point', 24) - RemoveAnimDict('anim@mp_point') - end) +local function startPointing(ped) + LoadAnimDict('anim@mp_point') + SetPedConfigFlag(ped, 36, true) + TaskMoveNetworkByName(ped, 'task_mp_pointing', 0.5, false, 'anim@mp_point', 24) + RemoveAnimDict('anim@mp_point') end -local function stopPointing() - RequestTaskMoveNetworkStateTransition(plyPed, 'Stop') +local function stopPointing(ped) + RequestTaskMoveNetworkStateTransition(ped, 'Stop') + SetPedConfigFlag(ped, 36, false) + ClearPedSecondaryTask(ped) +end + +function ResetOtherAnimsVals() + PlayerVars.pointing = false - if not IsPedInjured(plyPed) then - ClearPedSecondaryTask(plyPed) + if PlayerVars.handsUp then + PlayerVars.handsUp = false end +end - SetPedConfigFlag(plyPed, 36, 0) - ClearPedSecondaryTask(plyPed) +if Config.Framework == 'esx' then + AddEventHandler('esx:onPlayerDeath', ResetOtherAnimsVals) end -CreateThread(function() - while true do - Wait(0) - DisableControlAction(1, Config.Controls.Crouch.keyboard, true) +RegisterCommand('+handsup', function() + local playerPed = PlayerPedId() - if IsDisabledControlJustReleased(1, Config.Controls.Crouch.keyboard) and IsInputDisabled(2) then - local plyPed = PlayerPedId() + if not PlayerVars.isDead and IsPedOnFoot(playerPed) then + if PlayerVars.pointing then + PlayerVars.pointing = false + end - if (DoesEntityExist(plyPed)) and (not IsEntityDead(plyPed)) and (IsPedOnFoot(plyPed)) then - Player.crouched = not Player.crouched + PlayerVars.handsUp = not PlayerVars.handsUp - if Player.crouched then - ESX.Streaming.RequestAnimSet('move_ped_crouched', function() - SetPedMovementClipset(plyPed, 'move_ped_crouched', 0.25) - RemoveAnimSet('move_ped_crouched') - end) - else - ResetPedMovementClipset(plyPed, 0) - end - end + if PlayerVars.handsUp then + LoadAnimDict('random@mugging3') + TaskPlayAnim(playerPed, 'random@mugging3', 'handsup_standing_base', 8.0, -8.0, -1, 49, 0.0, false, false, false) + RemoveAnimDict('random@mugging3') + else + StopAnimTask(playerPed, 'random@mugging3', 'handsup_standing_base', -4.0) end + end +end, false) - if IsControlJustReleased(1, Config.Controls.HandsUP.keyboard) and IsInputDisabled(2) then - local plyPed = PlayerPedId() +RegisterCommand('-handsup', function() end, false) - if (DoesEntityExist(plyPed)) and not (IsEntityDead(plyPed)) and (IsPedOnFoot(plyPed)) then - if Player.pointing then - Player.pointing = false - end +RegisterKeyMapping('+handsup', 'Lever les mains', 'KEYBOARD', Config.Controls.HandsUP.keyboard) +TriggerEvent('chat:removeSuggestion', '/+handsup') +TriggerEvent('chat:removeSuggestion', '/-handsup') - Player.handsUp = not Player.handsUp +RegisterCommand('+fingerpoint', function() + local playerPed = PlayerPedId() - if Player.handsUp then - ESX.Streaming.RequestAnimDict('random@mugging3', function() - TaskPlayAnim(plyPed, 'random@mugging3', 'handsup_standing_base', 8.0, -8, -1, 49, 0, 0, 0, 0) - RemoveAnimDict('random@mugging3') - end) - else - ClearPedSecondaryTask(plyPed) - end - end + if not PlayerVars.isDead and IsPedOnFoot(playerPed) then + if PlayerVars.handsUp then + PlayerVars.handsUp = false end - if IsControlJustReleased(1, Config.Controls.Pointing.keyboard) and IsInputDisabled(2) then - local plyPed = PlayerPedId() - - if (DoesEntityExist(plyPed)) and (not IsEntityDead(plyPed)) and (IsPedOnFoot(plyPed)) then - if Player.handsUp then - Player.handsUp = false - end + PlayerVars.pointing = not PlayerVars.pointing - Player.pointing = not Player.pointing + if PlayerVars.pointing then + startPointing(playerPed) + else + stopPointing(playerPed) + end + end +end, false) + +RegisterCommand('-fingerpoint', function() end, false) + +RegisterKeyMapping('+fingerpoint', 'Pointer du doigt', 'KEYBOARD', Config.Controls.Pointing.keyboard) +TriggerEvent('chat:removeSuggestion', '/+fingerpoint') +TriggerEvent('chat:removeSuggestion', '/-fingerpoint') + +CreateThread(function() + while true do + Wait(0) + local playerPed = PlayerPedId() - if Player.pointing then - startPointing(plyPed) + DisableControlAction(0, Config.Controls.Crouch.keyboard, true) + + if IsDisabledControlJustReleased(0, Config.Controls.Crouch.keyboard) and IsUsingKeyboard(2) then + if DoesEntityExist(playerPed) and not IsEntityDead(playerPed) and IsPedOnFoot(playerPed) then + PlayerVars.crouched = not PlayerVars.crouched + + if PlayerVars.crouched then + LoadAnimSet('move_ped_crouched') + SetPedMovementClipset(playerPed, 'move_ped_crouched', 0.5) + RemoveAnimSet('move_ped_crouched') else - stopPointing(plyPed) + ResetPedMovementClipset(playerPed, 0.5) end end end - if Player.crouched or Player.handsUp or Player.pointing then - if not IsPedOnFoot(PlayerPedId()) then - ResetPedMovementClipset(plyPed, 0) + if PlayerVars.crouched or PlayerVars.handsUp or PlayerVars.pointing then + if not IsPedOnFoot(playerPed) then + ResetPedMovementClipset(playerPed, 0.5) stopPointing() - Player.crouched, Player.handsUp, Player.pointing = false, false, false - elseif Player.pointing then - local ped = PlayerPedId() - local camPitch = GetGameplayCamRelativePitch() - - if camPitch < -70.0 then - camPitch = -70.0 - elseif camPitch > 42.0 then - camPitch = 42.0 - end - - camPitch = (camPitch + 70.0) / 112.0 - local camHeading = GetGameplayCamRelativeHeading() - local cosCamHeading = Cos(camHeading) - local sinCamHeading = Sin(camHeading) + PlayerVars.crouched = false + PlayerVars.pointing = false - if camHeading < -180.0 then - camHeading = -180.0 - elseif camHeading > 180.0 then - camHeading = 180.0 + if PlayerVars.handsUp then + PlayerVars.handsUp = false + end + else + if PlayerVars.pointing then + local camPitch = GetGameplayCamRelativePitch() + camPitch = (camPitch < -70.0 and -70.0) or (camPitch > 42.0 and 42.0) or camPitch + camPitch = (camPitch + 70.0) / 112.0 + + local camHeading = GetGameplayCamRelativeHeading() + local cosCamHeading, sinCamHeading = math.cos(camHeading * (math.pi / 180.0)), math.sin(camHeading * (math.pi / 180.0)) + + camHeading = (camHeading < -180.0 and -180.0) or (camHeading > 180.0 and 180.0) or camHeading + camHeading = (camHeading + 180.0) / 360.0 + + local coords = GetOffsetFromEntityInWorldCoords(playerPed, vec3((cosCamHeading * -0.2) - (sinCamHeading * (0.4 * camHeading + 0.3)), (sinCamHeading * -0.2) + (cosCamHeading * (0.4 * camHeading + 0.3)), 0.6)) + local shapeTestHandle = StartShapeTestCapsule(coords - vec3(0.0, 0.0, 0.2), coords + vec3(0.0, 0.0, 0.2), 0.4, 95, playerPed, 7) + + local shapeTestStatus, hit, endCoords, surfaceNormal, entityHit = GetShapeTestResult(shapeTestHandle) + while shapeTestStatus == 1 do + Wait(0) + shapeTestStatus, hit, endCoords, surfaceNormal, entityHit = GetShapeTestResult(shapeTestHandle) + end + + SetTaskMoveNetworkSignalFloat(playerPed, 'Pitch', camPitch) + SetTaskMoveNetworkSignalFloat(playerPed, 'Heading', (camHeading * -1.0) + 1.0) + SetTaskMoveNetworkSignalBool(playerPed, 'isBlocked', shapeTestStatus == 2 and hit == 1) + SetTaskMoveNetworkSignalBool(playerPed, 'isFirstPerson', GetCamViewModeForContext(GetCamActiveViewModeContext()) == 4) end - - camHeading = (camHeading + 180.0) / 360.0 - local coords = GetOffsetFromEntityInWorldCoords(ped, (cosCamHeading * -0.2) - (sinCamHeading * (0.4 * camHeading + 0.3)), (sinCamHeading * -0.2) + (cosCamHeading * (0.4 * camHeading + 0.3)), 0.6) - local rayHandle, blocked = GetShapeTestResult(StartShapeTestCapsule(coords.x, coords.y, coords.z - 0.2, coords.x, coords.y, coords.z + 0.2, 0.4, 95, ped, 7)) - - SetTaskMoveNetworkSignalFloat(ped, 'Pitch', camPitch) - SetTaskMoveNetworkSignalFloat(ped, 'Heading', (camHeading * -1.0) + 1.0) - SetTaskMoveNetworkSignalBool(ped, 'isBlocked', blocked) - SetTaskMoveNetworkSignalBool(ped, 'isFirstPerson', N_0xee778f8c7e1142e2(N_0x19cafa3c87f7c2ff()) == 4) end end end diff --git a/server-data/resources/[bpt_addons]/bpt_menu/client/showName.lua b/server-data/resources/[bpt_addons]/bpt_menu/client/showName.lua new file mode 100644 index 000000000..bf464a8cb --- /dev/null +++ b/server-data/resources/[bpt_addons]/bpt_menu/client/showName.lua @@ -0,0 +1,147 @@ +local GTComponents = { + GAMER_NAME = 0, + CREW_TAG = 1, + healthArmour = 2, + BIG_TEXT = 3, + AUDIO_ICON = 4, + MP_USING_MENU = 5, + MP_PASSIVE_MODE = 6, + WANTED_STARS = 7, + MP_DRIVER = 8, + MP_CO_DRIVER = 9, + MP_TAGGED = 10, + GAMER_NAME_NEARBY = 11, + ARROW = 12, + MP_PACKAGES = 13, + INV_IF_PED_FOLLOWING = 14, + RANK_TEXT = 15, + MP_TYPING = 16, + MP_BAG_LARGE = 17, + MP_TAG_ARROW = 18, + MP_GANG_CEO = 19, + MP_GANG_BIKER = 20, + BIKER_ARROW = 21, + MC_ROLE_PRESIDENT = 22, + MC_ROLE_VICE_PRESIDENT = 23, + MC_ROLE_ROAD_CAPTAIN = 24, + MC_ROLE_SARGEANT = 25, + MC_ROLE_ENFORCER = 26, + MC_ROLE_PROSPECT = 27, + MP_TRANSMITTER = 28, + MP_BOMB = 29 +} + +activeTags = {} +activeTagsMutex = {} + +CreateThread(function() + local playerId = PlayerId() + local GetPlayerPed = GetPlayerPed + local GetPlayerServerId = GetPlayerServerId + local GetPlayerName = GetPlayerName + + local function sanitizeString(s) + if type(s) ~= "string" then return "" end + local res = s:gsub("[^\32-\126]", "") + :gsub('[<>]', '') + :gsub('~.*~', '') + + if res:len() < s:len() then + local trimmedRes = res:gsub("%s", "") + + if trimmedRes == "" then + return trimmedRes + end + end + + return res + end + + local activeTagsMutex = activeTagsMutex + + while true do + if PlayerVars.showName then + local activeTagsByPlayerId = {} + + for i = #activeTagsMutex, 1, -1 do + local tag = activeTagsMutex[i] + + if tag then + if IsMpGamerTagActive(tag.handle) then + activeTagsByPlayerId[tag.playerId] = true + else + table.remove(activeTagsMutex, i) + end + end + end + + do + local activePlayers = GetActivePlayers() + + for i = 1, #activePlayers do + local targetPlayer = activePlayers[i] + + if targetPlayer ~= playerId then + if not activeTagsByPlayerId[targetPlayer] then + local targetPed = GetPlayerPed(targetPlayer) + + if targetPed > 0 then + local targetPlayerServerId = GetPlayerServerId(targetPlayer) + local sanitizedName = sanitizeString(GetPlayerName(targetPlayer)) + local renderedText = ("[%d] %s"):format(targetPlayerServerId, sanitizedName == "" and "Inconnu" or sanitizedName) + local tagHandle = CreateFakeMpGamerTag(targetPed, renderedText, false, false, "", 0) + + activeTagsMutex[#activeTagsMutex + 1] = { + handle = tagHandle, + playerId = targetPlayer + } + end + end + end + end + end + + local _activeTags = {} + + for i = 1, #activeTagsMutex do + local tagMutex = activeTagsMutex[i] + _activeTags[i] = tagMutex + end + + activeTags = _activeTags + end + + Wait(PlayerVars.showName and 100 or 200) + end +end) + +CreateThread(function() + SetMpGamerTagsUseVehicleBehavior(false) + SetMpGamerTagsVisibleDistance(424.0) + + local GetPlayerPed = GetPlayerPed + local MumbleIsPlayerTalking = MumbleIsPlayerTalking + + while true do + if PlayerVars.showName then + for i = 1, #activeTags do + local tag = activeTags[i] + local targetPed = GetPlayerPed(tag.playerId) + + if targetPed > 0 then + local tagHandle = tag.handle + SetMpGamerTagVisibility(tagHandle, GTComponents["GAMER_NAME"], true) + SetMpGamerTagVisibility(tagHandle, GTComponents["healthArmour"], true) + SetMpGamerTagVisibility(tagHandle, GTComponents["AUDIO_ICON"], MumbleIsPlayerTalking(tag.playerId)) + + SetMpGamerTagAlpha(tagHandle, GTComponents["healthArmour"], 255) + + SetMpGamerTagAlpha(tagHandle, GTComponents["AUDIO_ICON"], 255) + SetMpGamerTagColour(tagHandle, GTComponents["AUDIO_ICON"], 118) + end + end + end + + Wait(PlayerVars.showName and 0 or 200) + end +end) \ No newline at end of file diff --git a/server-data/resources/[bpt_addons]/bpt_menu/client/utils.lua b/server-data/resources/[bpt_addons]/bpt_menu/client/utils.lua new file mode 100644 index 000000000..7b05d8417 --- /dev/null +++ b/server-data/resources/[bpt_addons]/bpt_menu/client/utils.lua @@ -0,0 +1,173 @@ +function LoadAnimDict(dict) + RequestAnimDict(dict) + + while not HasAnimDictLoaded(dict) do + Wait(0) + end +end + +function LoadAnimSet(animSet) + RequestAnimSet(animSet) + + while not HasAnimSetLoaded(animSet) do + Wait(0) + end +end + +function MathRound(v, numDecimal) + if math.type(v) ~= 'float' then v += 0.0 end + + if numDecimal then + local power = 10 ^ numDecimal + return math.floor(v * power + 0.5) / power + end + + return math.floor(v + 0.5) +end + +if Config.Framework == 'esx' then + local playerData = { + inventory = {}, + accounts = {}, + job = {} + } + + local societyMoney, societyMoney2 = nil, nil + + if Config.DoubleJob then + playerData.job2 = {} + end + + local function parsePlayerJob(job, xPlayerJob) + job.id = xPlayerJob.name + job.name = xPlayerJob.label + job.gradeName = xPlayerJob.grade_label + job.isBoss = xPlayerJob.grade_name == 'boss' + end + + local function parsePlayerData(xPlayer) + playerData.inventory = xPlayer.inventory + playerData.accounts = xPlayer.accounts + parsePlayerJob(playerData.job, xPlayer.job) + + if Config.DoubleJob then + parsePlayerJob(playerData.job2, xPlayer.job2) + end + end + + function GetPlayerInventory() + return playerData.inventory + end + + function GetPlayerAccounts() + return playerData.accounts + end + + function GetPlayerJob() + return playerData.job + end + + function GetSocietyMoney() + 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() + + if playerJob.isBoss then + ESX.TriggerServerCallback('esx_society:getSocietyMoney', function(money) + societyMoney = money + end, playerJob.id) + 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:playerLoaded', function(xPlayer) + parsePlayerData(xPlayer) + + refreshMoney() + + if Config.DoubleJob then + refreshMoney2() + end + end) + + RegisterNetEvent('esx:setJob', function(job) + parsePlayerJob(playerData.job, job) + refreshMoney() + end) + + RegisterNetEvent('esx:setJob2', function(job) + parsePlayerJob(playerData.job2, job) + refreshMoney2() + end) + + AddEventHandler('bpt_menu:menuOpening', function() + parsePlayerData(ESX.GetPlayerData()) + end) + + RegisterNetEvent('esx_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) + ESX.ShowNotification(msg) + end + + function GetClosestPlayer() + return ESX.Game.GetClosestPlayer() + end + + function GroupDigits(number) + return ESX.Math.GroupDigits(number) + end + + function TriggerServerCallback(name, cb, ...) + ESX.TriggerServerCallback(name, cb, ...) + end + + CreateThread(function() + ESX = exports['es_extended']:getSharedObject() + + while not ESX.GetPlayerData().job do + Wait(100) + end + + if Config.DoubleJob then + while not ESX.GetPlayerData().job2 do + Wait(100) + end + end + + parsePlayerData(ESX.GetPlayerData()) + end) +end \ No newline at end of file diff --git a/server-data/resources/[bpt_addons]/bpt_menu/config.lua b/server-data/resources/[bpt_addons]/bpt_menu/config.lua index 591e033d4..6e157d28c 100644 --- a/server-data/resources/[bpt_addons]/bpt_menu/config.lua +++ b/server-data/resources/[bpt_addons]/bpt_menu/config.lua @@ -1,10 +1,10 @@ local Keys = { - ['ESC'] = 322, ['F1'] = 288, ['F2'] = 289, ['F3'] = 170, ['F5'] = 166, ['F6'] = 167, ['F7'] = 168, ['F8'] = 169, ['F9'] = 56, ['F10'] = 57, - ['~'] = 243, ['1'] = 157, ['2'] = 158, ['3'] = 160, ['4'] = 164, ['5'] = 165, ['6'] = 159, ['7'] = 161, ['8'] = 162, ['9'] = 163, ['-'] = 84, ['='] = 83, ['BACKSPACE'] = 177, + ['ESC'] = 322, ['F1'] = 288, ['F2'] = 289, ['F3'] = 170, ['F5'] = 166, ['F6'] = 167, ['F7'] = 168, ['F8'] = 169, ['F9'] = 56, ['F10'] = 57, + ['~'] = 243, ['1'] = 157, ['2'] = 158, ['3'] = 160, ['4'] = 164, ['5'] = 165, ['6'] = 159, ['7'] = 161, ['8'] = 162, ['9'] = 163, ['-'] = 84, ['='] = 83, ['BACKSPACE'] = 177, ['TAB'] = 37, ['Q'] = 44, ['W'] = 32, ['E'] = 38, ['R'] = 45, ['T'] = 245, ['Y'] = 246, ['U'] = 303, ['P'] = 199, ['['] = 39, [']'] = 40, ['ENTER'] = 18, ['CAPS'] = 137, ['A'] = 34, ['S'] = 8, ['D'] = 9, ['F'] = 23, ['G'] = 47, ['H'] = 74, ['K'] = 311, ['L'] = 182, ['LEFTSHIFT'] = 21, ['Z'] = 20, ['X'] = 73, ['C'] = 26, ['V'] = 0, ['B'] = 29, ['N'] = 249, ['M'] = 244, [','] = 82, ['.'] = 81, - ['LEFTCTRL'] = 36, ['LEFTALT'] = 19, ['SPACE'] = 22, ['RIGHTCTRL'] = 70, + ['LEFTCTRL'] = 36, ['LEFTALT'] = 19, ['SPACE'] = 22, ['RIGHTCTRL'] = 70, ['HOME'] = 213, ['PAGEUP'] = 10, ['PAGEDOWN'] = 11, ['DELETE'] = 178, ['LEFT'] = 174, ['RIGHT'] = 175, ['TOP'] = 27, ['DOWN'] = 173, ['NENTER'] = 201, ['N4'] = 108, ['N5'] = 60, ['N6'] = 107, ['N+'] = 96, ['N-'] = 97, ['N7'] = 117, ['N8'] = 61, ['N9'] = 118 @@ -12,6 +12,9 @@ local Keys = { Config = {} +-- FRAMEWORK -- +Config.Framework = 'esx' -- change it to 'qb' if you're using qbcore + -- LANGUAGE -- Config.Locale = 'it' @@ -23,236 +26,219 @@ Config.JSFourIDCard = false -- enable if you're using jsfour-idcard -- CONTROLS -- Config.Controls = { - OpenMenu = {keyboard = Keys['F5']}, - HandsUP = {keyboard = Keys['~']}, - Pointing = {keyboard = Keys['B']}, + OpenMenu = {keyboard = 'F5'}, + HandsUP = {keyboard = 'GRAVE'}, + Pointing = {keyboard = 'B'}, Crouch = {keyboard = Keys['LEFTCTRL']}, - StopTasks = {keyboard = Keys['X']}, + StopTasks = {keyboard = 'X'}, TPMarker = {keyboard1 = Keys['LEFTALT'], keyboard2 = Keys['E']} } -- GPS -- Config.GPS = { - {label = _U('none'), coords = nil}, - {label = _U('police_station'), coords = vector2(425.13, -979.55)}, - {label = _U('central_garage'), coords = vector2(-449.67, -340.83)}, - {label = _U('hospital'), coords = vector2(-33.88, -1102.37)}, - {label = _U('dealer'), coords = vector2(215.06, -791.56)}, - {label = _U('bennys_custom'), coords = vector2(-212.13, -1325.27)}, - {label = _U('job_center'), coords = vector2(-264.83, -964.54)}, - {label = _U('driving_school'), coords = vector2(-829.22, -696.99)}, - {label = _U('tequila-la'), coords = vector2(-565.09, 273.45)}, - {label = _U('bahama_mamas'), coords = vector2(-1391.06, -590.34)} -} - --- VOICE -- -Config.Voice = { - activated = true, - defaultLevel = 8.0 -} - -Config.Voice.items = { - {label = _U('voice_whisper'), level = 3.0}, - {label = _U('voice_normal'), level = Config.Voice.defaultLevel}, - {label = _U('voice_cry'), level = 14.0} + {name = _U('none'), coords = nil}, + {name = _U('police_station'), coords = vec2(425.13, -979.55)}, + {name = _U('central_garage'), coords = vec2(-449.67, -340.83)}, + {name = _U('hospital'), coords = vec2(-33.88, -1102.37)}, + {name = _U('dealer'), coords = vec2(215.06, -791.56)}, + {name = _U('bennys_custom'), coords = vec2(-212.13, -1325.27)}, + {name = _U('job_center'), coords = vec2(-264.83, -964.54)}, + {name = _U('driving_school'), coords = vec2(-829.22, -696.99)}, + {name = _U('tequila-la'), coords = vec2(-565.09, 273.45)}, + {name = _U('bahama_mamas'), coords = vec2(-1391.06, -590.34)} } -- ANIMATIONS -- Config.Animations = { { name = 'party', - label = _U('animation_party_title'), + name = _U('animation_party_title'), items = { - {label = _U('animation_party_smoke'), type = "scenario", data = {anim = "WORLD_HUMAN_SMOKING"}}, - {label = _U('animation_party_playsong'), type = "scenario", data = {anim = "WORLD_HUMAN_MUSICIAN"}}, - {label = _U('animation_party_dj'), type = "anim", data = {lib = "anim@mp_player_intcelebrationmale@dj", anim = "dj"}}, - {label = _U('animation_party_beer'), type = "scenario", data = {anim = "WORLD_HUMAN_DRINKING"}}, - {label = _U('animation_party_dancing'), type = "scenario", data = {anim = "WORLD_HUMAN_PARTYING"}}, - {label = _U('animation_party_airguitar'), type = "anim", data = {lib = "anim@mp_player_intcelebrationmale@air_guitar", anim = "air_guitar"}}, - {label = _U('animation_party_shagging'), type = "anim", data = {lib = "anim@mp_player_intcelebrationfemale@air_shagging", anim = "air_shagging"}}, - {label = _U('animation_party_rock'), type = "anim", data = {lib = "mp_player_int_upperrock", anim = "mp_player_int_rock"}}, - {label = _U('animation_party_drunk'), type = "anim", data = {lib = "amb@world_human_bum_standing@drunk@idle_a", anim = "idle_a"}}, - {label = _U('animation_party_vomit'), type = "anim", data = {lib = "oddjobs@taxi@tie", anim = "vomit_outside"}} + {name = _U('animation_party_smoke'), type = "scenario", scenarioName = "WORLD_HUMAN_SMOKING"}, + {name = _U('animation_party_playsong'), type = "scenario", scenarioName = "WORLD_HUMAN_MUSICIAN"}, + {name = _U('animation_party_dj'), type = "anim", animDict = "anim@mp_player_intcelebrationmale@dj", animName = "dj"}, + {name = _U('animation_party_beer'), type = "scenario", scenarioName = "WORLD_HUMAN_DRINKING"}, + {name = _U('animation_party_dancing'), type = "scenario", scenarioName = "WORLD_HUMAN_PARTYING"}, + {name = _U('animation_party_airguitar'), type = "anim", animDict = "anim@mp_player_intcelebrationmale@air_guitar", animName = "air_guitar"}, + {name = _U('animation_party_shagging'), type = "anim", animDict = "anim@mp_player_intcelebrationfemale@air_shagging", animName = "air_shagging"}, + {name = _U('animation_party_rock'), type = "anim", animDict = "mp_player_int_upperrock", animName = "mp_player_int_rock"}, + {name = _U('animation_party_drunk'), type = "anim", animDict = "amb@world_human_bum_standing@drunk@idle_a", animName = "idle_a"}, + {name = _U('animation_party_vomit'), type = "anim", animDict = "oddjobs@taxi@tie", animName = "vomit_outside"} } }, { name = 'salute', - label = _U('animation_salute_title'), + name = _U('animation_salute_title'), items = { - {label = _U('animation_salute_saluate'), type = "anim", data = {lib = "gestures@m@standing@casual", anim = "gesture_hello"}}, - {label = _U('animation_salute_serrer'), type = "anim", data = {lib = "mp_common", anim = "givetake1_a"}}, - {label = _U('animation_salute_tchek'), type = "anim", data = {lib = "mp_ped_interaction", anim = "handshake_guy_a"}}, - {label = _U('animation_salute_bandit'), type = "anim", data = {lib = "mp_ped_interaction", anim = "hugs_guy_a"}}, - {label = _U('animation_salute_military'), type = "anim", data = {lib = "mp_player_int_uppersalute", anim = "mp_player_int_salute"}} + {name = _U('animation_salute_saluate'), type = "anim", animDict = "gestures@m@standing@casual", animName = "gesture_hello"}, + {name = _U('animation_salute_serrer'), type = "anim", animDict = "mp_common", animName = "givetake1_a"}, + {name = _U('animation_salute_tchek'), type = "anim", animDict = "mp_ped_interaction", animName = "handshake_guy_a"}, + {name = _U('animation_salute_bandit'), type = "anim", animDict = "mp_ped_interaction", animName = "hugs_guy_a"}, + {name = _U('animation_salute_military'), type = "anim", animDict = "mp_player_int_uppersalute", animName = "mp_player_int_salute"} } }, { name = 'work', - label = _U('animation_work_title'), + name = _U('animation_work_title'), items = { - {label = _U('animation_work_suspect'), type = "anim", data = {lib = "random@arrests@busted", anim = "idle_c"}}, - {label = _U('animation_work_fisherman'), type = "scenario", data = {anim = "world_human_stand_fishing"}}, - {label = _U('animation_work_inspect'), type = "anim", data = {lib = "amb@code_human_police_investigate@idle_b", anim = "idle_f"}}, - {label = _U('animation_work_radio'), type = "anim", data = {lib = "random@arrests", anim = "generic_radio_chatter"}}, - {label = _U('animation_work_circulation'), type = "scenario", data = {anim = "WORLD_HUMAN_CAR_PARK_ATTENDANT"}}, - {label = _U('animation_work_binoculars'), type = "scenario", data = {anim = "WORLD_HUMAN_BINOCULARS"}}, - {label = _U('animation_work_harvest'), type = "scenario", data = {anim = "world_human_gardener_plant"}}, - {label = _U('animation_work_repair'), type = "anim", data = {lib = "mini@repair", anim = "fixing_a_ped"}}, - {label = _U('animation_work_observe'), type = "scenario", data = {anim = "CODE_HUMAN_MEDIC_KNEEL"}}, - {label = _U('animation_work_talk'), type = "anim", data = {lib = "oddjobs@taxi@driver", anim = "leanover_idle"}}, - {label = _U('animation_work_bill'), type = "anim", data = {lib = "oddjobs@taxi@cyi", anim = "std_hand_off_ps_passenger"}}, - {label = _U('animation_work_buy'), type = "anim", data = {lib = "mp_am_hold_up", anim = "purchase_beerbox_shopkeeper"}}, - {label = _U('animation_work_shot'), type = "anim", data = {lib = "mini@drinking", anim = "shots_barman_b"}}, - {label = _U('animation_work_picture'), type = "scenario", data = {anim = "WORLD_HUMAN_PAPARAZZI"}}, - {label = _U('animation_work_notes'), type = "scenario", data = {anim = "WORLD_HUMAN_CLIPBOARD"}}, - {label = _U('animation_work_hammer'), type = "scenario", data = {anim = "WORLD_HUMAN_HAMMERING"}}, - {label = _U('animation_work_beg'), type = "scenario", data = {anim = "WORLD_HUMAN_BUM_FREEWAY"}}, - {label = _U('animation_work_statue'), type = "scenario", data = {anim = "WORLD_HUMAN_HUMAN_STATUE"}} + {name = _U('animation_work_suspect'), type = "anim", animDict = "random@arrests@busted", animName = "idle_c"}, + {name = _U('animation_work_fisherman'), type = "scenario", scenarioName = "world_human_stand_fishing"}, + {name = _U('animation_work_inspect'), type = "anim", animDict = "amb@code_human_police_investigate@idle_b", animName = "idle_f"}, + {name = _U('animation_work_radio'), type = "anim", animDict = "random@arrests", animName = "generic_radio_chatter"}, + {name = _U('animation_work_circulation'), type = "scenario", scenarioName = "WORLD_HUMAN_CAR_PARK_ATTENDANT"}, + {name = _U('animation_work_binoculars'), type = "scenario", scenarioName = "WORLD_HUMAN_BINOCULARS"}, + {name = _U('animation_work_harvest'), type = "scenario", scenarioName = "world_human_gardener_plant"}, + {name = _U('animation_work_repair'), type = "anim", animDict = "mini@repair", animName = "fixing_a_ped"}, + {name = _U('animation_work_observe'), type = "scenario", scenarioName = "CODE_HUMAN_MEDIC_KNEEL"}, + {name = _U('animation_work_talk'), type = "anim", animDict = "oddjobs@taxi@driver", animName = "leanover_idle"}, + {name = _U('animation_work_bill'), type = "anim", animDict = "oddjobs@taxi@cyi", animName = "std_hand_off_ps_passenger"}, + {name = _U('animation_work_buy'), type = "anim", animDict = "mp_am_hold_up", animName = "purchase_beerbox_shopkeeper"}, + {name = _U('animation_work_shot'), type = "anim", animDict = "mini@drinking", animName = "shots_barman_b"}, + {name = _U('animation_work_picture'), type = "scenario", scenarioName = "WORLD_HUMAN_PAPARAZZI"}, + {name = _U('animation_work_notes'), type = "scenario", scenarioName = "WORLD_HUMAN_CLIPBOARD"}, + {name = _U('animation_work_hammer'), type = "scenario", scenarioName = "WORLD_HUMAN_HAMMERING"}, + {name = _U('animation_work_beg'), type = "scenario", scenarioName = "WORLD_HUMAN_BUM_FREEWAY"}, + {name = _U('animation_work_statue'), type = "scenario", scenarioName = "WORLD_HUMAN_HUMAN_STATUE"} } }, { name = 'mood', - label = _U('animation_mood_title'), + name = _U('animation_mood_title'), items = { - {label = _U('animation_mood_felicitate'), type = "scenario", data = {anim = "WORLD_HUMAN_CHEERING"}}, - {label = _U('animation_mood_nice'), type = "anim", data = {lib = "mp_action", anim = "thanks_male_06"}}, - {label = _U('animation_mood_you'), type = "anim", data = {lib = "gestures@m@standing@casual", anim = "gesture_point"}}, - {label = _U('animation_mood_come'), type = "anim", data = {lib = "gestures@m@standing@casual", anim = "gesture_come_here_soft"}}, - {label = _U('animation_mood_what'), type = "anim", data = {lib = "gestures@m@standing@casual", anim = "gesture_bring_it_on"}}, - {label = _U('animation_mood_me'), type = "anim", data = {lib = "gestures@m@standing@casual", anim = "gesture_me"}}, - {label = _U('animation_mood_seriously'), type = "anim", data = {lib = "anim@am_hold_up@male", anim = "shoplift_high"}}, - {label = _U('animation_mood_tired'), type = "scenario", data = {lib = "amb@world_human_jog_standing@male@idle_b", anim = "idle_d"}}, - {label = _U('animation_mood_shit'), type = "scenario", data = {lib = "amb@world_human_bum_standing@depressed@idle_a", anim = "idle_a"}}, - {label = _U('animation_mood_facepalm'), type = "anim", data = {lib = "anim@mp_player_intcelebrationmale@face_palm", anim = "face_palm"}}, - {label = _U('animation_mood_calm'), type = "anim", data = {lib = "gestures@m@standing@casual", anim = "gesture_easy_now"}}, - {label = _U('animation_mood_why'), type = "anim", data = {lib = "oddjobs@assassinate@multi@", anim = "react_big_variations_a"}}, - {label = _U('animation_mood_fear'), type = "anim", data = {lib = "amb@code_human_cower_stand@male@react_cowering", anim = "base_right"}}, - {label = _U('animation_mood_fight'), type = "anim", data = {lib = "anim@deathmatch_intros@unarmed", anim = "intro_male_unarmed_e"}}, - {label = _U('animation_mood_notpossible'), type = "anim", data = {lib = "gestures@m@standing@casual", anim = "gesture_damn"}}, - {label = _U('animation_mood_embrace'), type = "anim", data = {lib = "mp_ped_interaction", anim = "kisses_guy_a"}}, - {label = _U('animation_mood_fuckyou'), type = "anim", data = {lib = "mp_player_int_upperfinger", anim = "mp_player_int_finger_01_enter"}}, - {label = _U('animation_mood_wanker'), type = "anim", data = {lib = "mp_player_int_upperwank", anim = "mp_player_int_wank_01"}}, - {label = _U('animation_mood_suicide'), type = "anim", data = {lib = "mp_suicide", anim = "pistol"}} + {name = _U('animation_mood_felicitate'), type = "scenario", scenarioName = "WORLD_HUMAN_CHEERING"}, + {name = _U('animation_mood_nice'), type = "anim", animDict = "mp_action", animName = "thanks_male_06"}, + {name = _U('animation_mood_you'), type = "anim", animDict = "gestures@m@standing@casual", animName = "gesture_point"}, + {name = _U('animation_mood_come'), type = "anim", animDict = "gestures@m@standing@casual", animName = "gesture_come_here_soft"}, + {name = _U('animation_mood_what'), type = "anim", animDict = "gestures@m@standing@casual", animName = "gesture_bring_it_on"}, + {name = _U('animation_mood_me'), type = "anim", animDict = "gestures@m@standing@casual", animName = "gesture_me"}, + {name = _U('animation_mood_seriously'), type = "anim", animDict = "anim@am_hold_up@male", animName = "shoplift_high"}, + {name = _U('animation_mood_tired'), type = "anim", animDict = "amb@world_human_jog_standing@male@idle_b", animName = "idle_d"}, + {name = _U('animation_mood_shit'), type = "anim", animDict = "amb@world_human_bum_standing@depressed@idle_a", animName = "idle_a"}, + {name = _U('animation_mood_facepalm'), type = "anim", animDict = "anim@mp_player_intcelebrationmale@face_palm", animName = "face_palm"}, + {name = _U('animation_mood_calm'), type = "anim", animDict = "gestures@m@standing@casual", animName = "gesture_easy_now"}, + {name = _U('animation_mood_why'), type = "anim", animDict = "oddjobs@assassinate@multi@", animName = "react_big_variations_a"}, + {name = _U('animation_mood_fear'), type = "anim", animDict = "amb@code_human_cower_stand@male@react_cowering", animName = "base_right"}, + {name = _U('animation_mood_fight'), type = "anim", animDict = "anim@deathmatch_intros@unarmed", animName = "intro_male_unarmed_e"}, + {name = _U('animation_mood_notpossible'), type = "anim", animDict = "gestures@m@standing@casual", animName = "gesture_damn"}, + {name = _U('animation_mood_embrace'), type = "anim", animDict = "mp_ped_interaction", animName = "kisses_guy_a"}, + {name = _U('animation_mood_fuckyou'), type = "anim", animDict = "mp_player_int_upperfinger", animName = "mp_player_int_finger_01_enter"}, + {name = _U('animation_mood_wanker'), type = "anim", animDict = "mp_player_int_upperwank", animName = "mp_player_int_wank_01"}, + {name = _U('animation_mood_suicide'), type = "anim", animDict = "mp_suicide", animName = "pistol"} } }, { name = 'sports', - label = _U('animation_sports_title'), + name = _U('animation_sports_title'), items = { - {label = _U('animation_sports_muscle'), type = "anim", data = {lib = "amb@world_human_muscle_flex@arms_at_side@base", anim = "base"}}, - {label = _U('animation_sports_weightbar'), type = "anim", data = {lib = "amb@world_human_muscle_free_weights@male@barbell@base", anim = "base"}}, - {label = _U('animation_sports_pushup'), type = "anim", data = {lib = "amb@world_human_push_ups@male@base", anim = "base"}}, - {label = _U('animation_sports_abs'), type = "anim", data = {lib = "amb@world_human_sit_ups@male@base", anim = "base"}}, - {label = _U('animation_sports_yoga'), type = "anim", data = {lib = "amb@world_human_yoga@male@base", anim = "base_a"}} + {name = _U('animation_sports_muscle'), type = "anim", animDict = "amb@world_human_muscle_flex@arms_at_side@base", animName = "base"}, + {name = _U('animation_sports_weightbar'), type = "anim", animDict = "amb@world_human_muscle_free_weights@male@barbell@base", animName = "base"}, + {name = _U('animation_sports_pushup'), type = "anim", animDict = "amb@world_human_push_ups@male@base", animName = "base"}, + {name = _U('animation_sports_abs'), type = "anim", animDict = "amb@world_human_sit_ups@male@base", animName = "base"}, + {name = _U('animation_sports_yoga'), type = "anim", animDict = "amb@world_human_yoga@male@base", animName = "base_a"} } }, { name = 'other', - label = _U('animation_other_title'), + name = _U('animation_other_title'), items = { - {label = _U('animation_other_sit'), type = "anim", data = {lib = "anim@heists@prison_heistunfinished_biztarget_idle", anim = "target_idle"}}, - {label = _U('animation_other_waitwall'), type = "scenario", data = {anim = "world_human_leaning"}}, - {label = _U('animation_other_ontheback'), type = "scenario", data = {anim = "WORLD_HUMAN_SUNBATHE_BACK"}}, - {label = _U('animation_other_stomach'), type = "scenario", data = {anim = "WORLD_HUMAN_SUNBATHE"}}, - {label = _U('animation_other_clean'), type = "scenario", data = {anim = "world_human_maid_clean"}}, - {label = _U('animation_other_cooking'), type = "scenario", data = {anim = "PROP_HUMAN_BBQ"}}, - {label = _U('animation_other_search'), type = "anim", data = {lib = "mini@prostitutes@sexlow_veh", anim = "low_car_bj_to_prop_female"}}, - {label = _U('animation_other_selfie'), type = "scenario", data = {anim = "world_human_tourist_mobile"}}, - {label = _U('animation_other_door'), type = "anim", data = {lib = "mini@safe_cracking", anim = "idle_base"}} + {name = _U('animation_other_sit'), type = "anim", animDict = "anim@heists@prison_heistunfinished_biztarget_idle", animName = "target_idle"}, + {name = _U('animation_other_waitwall'), type = "scenario", scenarioName = "world_human_leaning"}, + {name = _U('animation_other_ontheback'), type = "scenario", scenarioName = "WORLD_HUMAN_SUNBATHE_BACK"}, + {name = _U('animation_other_stomach'), type = "scenario", scenarioName = "WORLD_HUMAN_SUNBATHE"}, + {name = _U('animation_other_clean'), type = "scenario", scenarioName = "world_human_maid_clean"}, + {name = _U('animation_other_cooking'), type = "scenario", scenarioName = "PROP_HUMAN_BBQ"}, + {name = _U('animation_other_search'), type = "anim", animDict = "mini@prostitutes@sexlow_veh", animName = "low_car_bj_to_prop_female"}, + {name = _U('animation_other_selfie'), type = "scenario", scenarioName = "world_human_tourist_mobile"}, + {name = _U('animation_other_door'), type = "anim", animDict = "mini@safe_cracking", animName = "idle_base"} } }, { name = 'pegi', - label = _U('animation_pegi_title'), + name = _U('animation_pegi_title'), items = { - {label = _U('animation_pegi_hsuck'), type = "anim", data = {lib = "oddjobs@towing", anim = "m_blow_job_loop"}}, - {label = _U('animation_pegi_fsuck'), type = "anim", data = {lib = "oddjobs@towing", anim = "f_blow_job_loop"}}, - {label = _U('animation_pegi_hfuck'), type = "anim", data = {lib = "mini@prostitutes@sexlow_veh", anim = "low_car_sex_loop_player"}}, - {label = _U('animation_pegi_ffuck'), type = "anim", data = {lib = "mini@prostitutes@sexlow_veh", anim = "low_car_sex_loop_female"}}, - {label = _U('animation_pegi_scratch'), type = "anim", data = {lib = "mp_player_int_uppergrab_crotch", anim = "mp_player_int_grab_crotch"}}, - {label = _U('animation_pegi_charm'), type = "anim", data = {lib = "mini@strip_club@idles@stripper", anim = "stripper_idle_02"}}, - {label = _U('animation_pegi_golddigger'), type = "scenario", data = {anim = "WORLD_HUMAN_PROSTITUTE_HIGH_CLASS"}}, - {label = _U('animation_pegi_breast'), type = "anim", data = {lib = "mini@strip_club@backroom@", anim = "stripper_b_backroom_idle_b"}}, - {label = _U('animation_pegi_strip1'), type = "anim", data = {lib = "mini@strip_club@lap_dance@ld_girl_a_song_a_p1", anim = "ld_girl_a_song_a_p1_f"}}, - {label = _U('animation_pegi_strip2'), type = "anim", data = {lib = "mini@strip_club@private_dance@part2", anim = "priv_dance_p2"}}, - {label = _U('animation_pegi_stripfloor'), type = "anim", data = {lib = "mini@strip_club@private_dance@part3", anim = "priv_dance_p3"}} + {name = _U('animation_pegi_hsuck'), type = "anim", animDict = "oddjobs@towing", animName = "m_blow_job_loop"}, + {name = _U('animation_pegi_fsuck'), type = "anim", animDict = "oddjobs@towing", animName = "f_blow_job_loop"}, + {name = _U('animation_pegi_hfuck'), type = "anim", animDict = "mini@prostitutes@sexlow_veh", animName = "low_car_sex_loop_player"}, + {name = _U('animation_pegi_ffuck'), type = "anim", animDict = "mini@prostitutes@sexlow_veh", animName = "low_car_sex_loop_female"}, + {name = _U('animation_pegi_scratch'), type = "anim", animDict = "mp_player_int_uppergrab_crotch", animName = "mp_player_int_grab_crotch"}, + {name = _U('animation_pegi_charm'), type = "anim", animDict = "mini@strip_club@idles@stripper", animName = "stripper_idle_02"}, + {name = _U('animation_pegi_golddigger'), type = "scenario", scenarioName = "WORLD_HUMAN_PROSTITUTE_HIGH_CLASS"}, + {name = _U('animation_pegi_breast'), type = "anim", animDict = "mini@strip_club@backroom@", animName = "stripper_b_backroom_idle_b"}, + {name = _U('animation_pegi_strip1'), type = "anim", animDict = "mini@strip_club@lap_dance@ld_girl_a_song_a_p1", animName = "ld_girl_a_song_a_p1_f"}, + {name = _U('animation_pegi_strip2'), type = "anim", animDict = "mini@strip_club@private_dance@part2", animName = "priv_dance_p2"}, + {name = _U('animation_pegi_stripfloor'), type = "anim", animDict = "mini@strip_club@private_dance@part3", animName = "priv_dance_p3"} } }, { name = 'attitudes', - label = _U('animation_attitudes_title'), + name = _U('animation_attitudes_title'), items = { - {label = "Normal M", type = "attitude", data = {lib = "move_m@confident", anim = "move_m@confident"}}, - {label = "Normal F", type = "attitude", data = {lib = "move_f@heels@c", anim = "move_f@heels@c"}}, - {label = "Depressif", type = "attitude", data = {lib = "move_m@depressed@a", anim = "move_m@depressed@a"}}, - {label = "Depressif F", type = "attitude", data = {lib = "move_f@depressed@a", anim = "move_f@depressed@a"}}, - {label = "Business", type = "attitude", data = {lib = "move_m@business@a", anim = "move_m@business@a"}}, - {label = "Determine", type = "attitude", data = {lib = "move_m@brave@a", anim = "move_m@brave@a"}}, - {label = "Casual", type = "attitude", data = {lib = "move_m@casual@a", anim = "move_m@casual@a"}}, - {label = "Trop mange", type = "attitude", data = {lib = "move_m@fat@a", anim = "move_m@fat@a"}}, - {label = "Hipster", type = "attitude", data = {lib = "move_m@hipster@a", anim = "move_m@hipster@a"}}, - {label = "Blesse", type = "attitude", data = {lib = "move_m@injured", anim = "move_m@injured"}}, - {label = "Intimide", type = "attitude", data = {lib = "move_m@hurry@a", anim = "move_m@hurry@a"}}, - {label = "Hobo", type = "attitude", data = {lib = "move_m@hobo@a", anim = "move_m@hobo@a"}}, - {label = "Malheureux", type = "attitude", data = {lib = "move_m@sad@a", anim = "move_m@sad@a"}}, - {label = "Muscle", type = "attitude", data = {lib = "move_m@muscle@a", anim = "move_m@muscle@a"}}, - {label = "Choc", type = "attitude", data = {lib = "move_m@shocked@a", anim = "move_m@shocked@a"}}, - {label = "Sombre", type = "attitude", data = {lib = "move_m@shadyped@a", anim = "move_m@shadyped@a"}}, - {label = "Fatigue", type = "attitude", data = {lib = "move_m@buzzed", anim = "move_m@buzzed"}}, - {label = "Pressee", type = "attitude", data = {lib = "move_m@hurry_butch@a", anim = "move_m@hurry_butch@a"}}, - {label = "Fier", type = "attitude", data = {lib = "move_m@money", anim = "move_m@money"}}, - {label = "Petite course", type = "attitude", data = {lib = "move_m@quick", anim = "move_m@quick"}}, - {label = "Mangeuse d'homme", type = "attitude", data = {lib = "move_f@maneater", anim = "move_f@maneater"}}, - {label = "Impertinent", type = "attitude", data = {lib = "move_f@sassy", anim = "move_f@sassy"}}, - {label = "Arrogante", type = "attitude", data = {lib = "move_f@arrogant@a", anim = "move_f@arrogant@a"}} + {name = "Normal", type = "attitude"}, + {name = "Confiant", type = "attitude", animSet = "move_m@confident"}, + {name = "Talons", type = "attitude", animSet = "move_f@heels@c"}, + {name = "Dépressif", type = "attitude", animSet = "move_m@depressed@a"}, + {name = "Dépressive", type = "attitude", animSet = "move_f@depressed@a"}, + {name = "Business", type = "attitude", animSet = "move_m@business@a"}, + {name = "Déterminé", type = "attitude", animSet = "move_m@brave@a"}, + {name = "Casual", type = "attitude", animSet = "move_m@casual@a"}, + {name = "Trop mange", type = "attitude", animSet = "move_m@fat@a"}, + {name = "Hipster", type = "attitude", animSet = "move_m@hipster@a"}, + {name = "Blesse", type = "attitude", animSet = "move_m@injured"}, + {name = "Intimide", type = "attitude", animSet = "move_m@hurry@a"}, + {name = "Hobo", type = "attitude", animSet = "move_m@hobo@a"}, + {name = "Malheureux", type = "attitude", animSet = "move_m@sad@a"}, + {name = "Muscle", type = "attitude", animSet = "move_m@muscle@a"}, + {name = "Choc", type = "attitude", animSet = "move_m@shocked@a"}, + {name = "Sombre", type = "attitude", animSet = "move_m@shadyped@a"}, + {name = "Fatigue", type = "attitude", animSet = "move_m@buzzed"}, + {name = "Pressee", type = "attitude", animSet = "move_m@hurry_butch@a"}, + {name = "Fièr", type = "attitude", animSet = "move_m@money"}, + {name = "Petite course", type = "attitude", animSet = "move_m@quick"}, + {name = "Mangeuse d'homme", type = "attitude", animSet = "move_f@maneater"}, + {name = "Impertinente", type = "attitude", animSet = "move_f@sassy"}, + {name = "Arrogante", type = "attitude", animSet = "move_f@arrogant@a"} } } } -- ADMIN -- -Config.Admin = { +Config.AdminCommands = { { - name = 'goto', - label = _U('admin_goto_button'), + id = 'goto', + name = _U('admin_goto_button'), groups = {'_dev', 'owner', 'superadmin', 'admin', 'mod'}, command = function() - local plyId = KeyboardInput('BPT_BOX_ID', _U('dialogbox_playerid'), '', 8) - - if plyId ~= nil then - plyId = tonumber(plyId) + local targetServerId = KeyboardInput('PM_BOX_ID', _U('dialogbox_playerid'), '', 8) + if not targetServerId then return end - if type(plyId) == 'number' then - TriggerServerEvent('bpt_menu:Admin_BringS', GetPlayerServerId(PlayerId()), plyId) - end - end + targetServerId = tonumber(targetServerId) + if type(targetServerId) ~= 'number' then return end + TriggerServerEvent('bpt_menu:Admin_BringS', GetPlayerServerId(PlayerId()), targetServerId) RageUI.CloseAll() end }, { - name = 'bring', - label = _U('admin_bring_button'), + id = 'bring', + name = _U('admin_bring_button'), groups = {'_dev', 'owner', 'superadmin', 'admin', 'mod'}, command = function() - local plyId = KeyboardInput('BPT_BOX_ID', _U('dialogbox_playerid'), '', 8) - - if plyId ~= nil then - plyId = tonumber(plyId) + local targetServerId = KeyboardInput('PM_BOX_ID', _U('dialogbox_playerid'), '', 8) + if not targetServerId then return end - if type(plyId) == 'number' then - TriggerServerEvent('bpt_menu:Admin_BringS', plyId, GetPlayerServerId(PlayerId())) - end - end + targetServerId = tonumber(targetServerId) + if type(targetServerId) ~= 'number' then return end + TriggerServerEvent('bpt_menu:Admin_BringS', targetServerId, GetPlayerServerId(PlayerId())) RageUI.CloseAll() end }, { - name = 'tpxyz', - label = _U('admin_tpxyz_button'), + id = 'tpxyz', + name = _U('admin_tpxyz_button'), groups = {'_dev', 'owner', 'superadmin', 'admin'}, command = function() - local pos = KeyboardInput('BPT_BOX_XYZ', _U('dialogbox_xyz'), '', 50) + local pos = KeyboardInput('PM_BOX_XYZ', _U('dialogbox_xyz'), '', 50) if pos ~= nil and pos ~= '' then local _, _, x, y, z = string.find(pos, '([%d%.]+) ([%d%.]+) ([%d%.]+)') @@ -266,92 +252,128 @@ Config.Admin = { end }, { - name = 'noclip', - label = _U('admin_noclip_button'), + id = 'noclip', + name = _U('admin_noclip_button'), groups = {'_dev', 'owner', 'superadmin', 'admin', 'mod'}, command = function() - Player.noclip = not Player.noclip + PlayerVars.noclip = not PlayerVars.noclip - if Player.noclip then - FreezeEntityPosition(plyPed, true) - SetEntityInvincible(plyPed, true) - SetEntityCollision(plyPed, false, false) - SetEntityVisible(plyPed, false, false) + if PlayerVars.noclip then + Citizen.CreateThreadNow(function() + while PlayerVars.noclip do + local plyPed = PlayerPedId() + + FreezeEntityPosition(plyPed, true) + SetEntityInvincible(plyPed, true) + SetEntityCollision(plyPed, false, false) + + SetEntityVisible(plyPed, false, false) + + local playerId = PlayerId() + SetEveryoneIgnorePlayer(playerId, true) + SetPoliceIgnorePlayer(playerId, true) + + local plyCoords = GetEntityCoords(plyPed, false) + + local heading = GetGameplayCamRelativeHeading() + GetEntityPhysicsHeading(plyPed) + local pitch = GetGameplayCamRelativePitch() + local camCoords = vec3(-math.sin(heading * math.pi / 180.0), math.cos(heading * math.pi / 180.0), math.sin(pitch * math.pi / 180.0)) + + local len = math.sqrt((camCoords.x * camCoords.x) + (camCoords.y * camCoords.y) + (camCoords.z * camCoords.z)) + if len ~= 0 then camCoords = camCoords / len end + + SetEntityVelocity(plyPed, vec3(0)) + + local isShiftPressed, isCtrlPressed = IsControlPressed(0, 21), IsControlPressed(0, 326) + + local noclipVelocity = isShiftPressed and isCtrlPressed and Config.NoclipSpeed + or isShiftPressed and Config.NoclipSpeed * 2.0 + or isCtrlPressed and Config.NoclipSpeed / 2.0 + or Config.NoclipSpeed + + if IsControlPressed(0, 32) then plyCoords += noclipVelocity * camCoords end + if IsControlPressed(0, 269) then plyCoords -= noclipVelocity * camCoords end + + SetEntityCoordsNoOffset(plyPed, plyCoords, true, true, true) + + Wait(0) + end + end) - SetEveryoneIgnorePlayer(PlayerId(), true) - SetPoliceIgnorePlayer(PlayerId(), true) - ESX.ShowNotification(_U('admin_noclipon')) + GameNotification(_U('admin_noclipon')) else + local plyPed = PlayerPedId() + FreezeEntityPosition(plyPed, false) SetEntityInvincible(plyPed, false) SetEntityCollision(plyPed, true, true) SetEntityVisible(plyPed, true, false) - SetEveryoneIgnorePlayer(PlayerId(), false) - SetPoliceIgnorePlayer(PlayerId(), false) - ESX.ShowNotification(_U('admin_noclipoff')) + local playerId = PlayerId() + SetEveryoneIgnorePlayer(playerId, false) + SetPoliceIgnorePlayer(playerId, false) + + GameNotification(_U('admin_noclipoff')) end RageUI.CloseAll() end }, { - name = 'godmode', - label = _U('admin_godmode_button'), + id = 'godmode', + name = _U('admin_godmode_button'), groups = {'_dev', 'owner', 'superadmin'}, command = function() - Player.godmode = not Player.godmode + PlayerVars.godmode = not PlayerVars.godmode - if Player.godmode then + if PlayerVars.godmode then SetEntityInvincible(plyPed, true) - ESX.ShowNotification(_U('admin_godmodeon')) + GameNotification(_U('admin_godmodeon')) else SetEntityInvincible(plyPed, false) - ESX.ShowNotification(_U('admin_godmodeoff')) + GameNotification(_U('admin_godmodeoff')) end end }, { - name = 'ghostmode', - label = _U('admin_ghostmode_button'), + id = 'ghostmode', + name = _U('admin_ghostmode_button'), groups = {'_dev', 'owner', 'superadmin'}, command = function() - Player.ghostmode = not Player.ghostmode + PlayerVars.ghostmode = not PlayerVars.ghostmode - if Player.ghostmode then + if PlayerVars.ghostmode then SetEntityVisible(plyPed, false, false) - ESX.ShowNotification(_U('admin_ghoston')) + GameNotification(_U('admin_ghoston')) else SetEntityVisible(plyPed, true, false) - ESX.ShowNotification(_U('admin_ghostoff')) + GameNotification(_U('admin_ghostoff')) end end }, { - name = 'spawnveh', - label = _U('admin_spawnveh_button'), + id = 'spawnveh', + name = _U('admin_spawnveh_button'), groups = {'_dev', 'owner', 'superadmin'}, command = function() - local modelName = KeyboardInput('BPT_BOX_VEHICLE_NAME', _U('dialogbox_vehiclespawner'), '', 50) + local modelName = KeyboardInput('PM_BOX_VEHICLE_NAME', _U('dialogbox_vehiclespawner'), '', 50) + if not modelName then return end - if modelName ~= nil then - modelName = tostring(modelName) + modelName = tostring(modelName) + if type(modelName) ~= 'string' then return end - if type(modelName) == 'string' then - ESX.Game.SpawnVehicle(modelName, GetEntityCoords(plyPed), GetEntityHeading(plyPed), function(vehicle) - TaskWarpPedIntoVehicle(plyPed, vehicle, -1) - end) - end - end + ESX.Game.SpawnVehicle(modelName, GetEntityCoords(plyPed), GetEntityHeading(plyPed), function(vehicle) + TaskWarpPedIntoVehicle(plyPed, vehicle, -1) + end) RageUI.CloseAll() end }, { - name = 'repairveh', - label = _U('admin_repairveh_button'), + id = 'repairveh', + name = _U('admin_repairveh_button'), groups = {'_dev', 'owner', 'superadmin', 'admin'}, command = function() local plyVeh = GetVehiclePedIsIn(plyPed, false) @@ -360,147 +382,117 @@ Config.Admin = { end }, { - name = 'flipveh', - label = _U('admin_flipveh_button'), + id = 'flipveh', + name = _U('admin_flipveh_button'), groups = {'_dev', 'owner', 'superadmin', 'admin'}, command = function() local plyCoords = GetEntityCoords(plyPed) - local newCoords = plyCoords + vector3(0.0, 2.0, 0.0) local closestVeh = GetClosestVehicle(plyCoords, 10.0, 0, 70) - SetEntityCoords(closestVeh, newCoords) - ESX.ShowNotification(_U('admin_vehicleflip')) + SetVehicleOnGroundProperly(closestVeh) + GameNotification(_U('admin_vehicleflip')) end }, { - name = 'givemoney', - label = _U('admin_givemoney_button'), + id = 'givemoney', + name = _U('admin_givemoney_button'), groups = {'_dev', 'owner', 'superadmin'}, command = function() - local amount = KeyboardInput('BPT_BOX_AMOUNT', _U('dialogbox_amount'), '', 8) + local amount = KeyboardInput('PM_BOX_AMOUNT', _U('dialogbox_amount'), '', 8) + if not amount then return end - if amount ~= nil then - amount = tonumber(amount) - - if type(amount) == 'number' then - TriggerServerEvent('bpt_menu:Admin_giveCash', amount) - end - end + amount = tonumber(amount) + if type(amount) ~= 'number' then return end + TriggerServerEvent('bpt_menu:Admin_giveCash', amount) RageUI.CloseAll() end }, { - name = 'givebank', - label = _U('admin_givebank_button'), + id = 'givebank', + name = _U('admin_givebank_button'), groups = {'_dev', 'owner', 'superadmin'}, command = function() - local amount = KeyboardInput('BPT_BOX_AMOUNT', _U('dialogbox_amount'), '', 8) + local amount = KeyboardInput('PM_BOX_AMOUNT', _U('dialogbox_amount'), '', 8) + if not amount then return end - if amount ~= nil then - amount = tonumber(amount) - - if type(amount) == 'number' then - TriggerServerEvent('bpt_menu:Admin_giveBank', amount) - end - end + amount = tonumber(amount) + if type(amount) ~= 'number' then return end + TriggerServerEvent('bpt_menu:Admin_giveBank', amount) RageUI.CloseAll() end }, { - name = 'givedirtymoney', - label = _U('admin_givedirtymoney_button'), + id = 'givedirtymoney', + name = _U('admin_givedirtymoney_button'), groups = {'_dev', 'owner', 'superadmin'}, command = function() - local amount = KeyboardInput('BPT_BOX_AMOUNT', _U('dialogbox_amount'), '', 8) + local amount = KeyboardInput('PM_BOX_AMOUNT', _U('dialogbox_amount'), '', 8) + if not amount then return end - if amount ~= nil then - amount = tonumber(amount) - - if type(amount) == 'number' then - TriggerServerEvent('bpt_menu:Admin_giveDirtyMoney', amount) - end - end + amount = tonumber(amount) + if type(amount) ~= 'number' then return end + TriggerServerEvent('bpt_menu:Admin_giveDirtyMoney', amount) RageUI.CloseAll() end }, { - name = 'showxyz', - label = _U('admin_showxyz_button'), + id = 'showxyz', + name = _U('admin_showxyz_button'), groups = {'_dev', 'owner', 'superadmin', 'admin', 'mod'}, command = function() - Player.showCoords = not Player.showCoords + PlayerVars.showCoords = not PlayerVars.showCoords end }, { - name = 'showname', - label = _U('admin_showname_button'), + id = 'showname', + name = _U('admin_showname_button'), groups = {'_dev', 'owner', 'superadmin', 'admin', 'mod'}, command = function() - Player.showName = not Player.showName + PlayerVars.showName = not PlayerVars.showName + + if not PlayerVars.showName then + for i = 1, #activeTags do + local tag = activeTags[i] - if not showname then - for targetPlayer, gamerTag in pairs(Player.gamerTags) do - RemoveMpGamerTag(gamerTag) - Player.gamerTags[targetPlayer] = nil + if IsMpGamerTagActive(tag.handle) then + RemoveMpGamerTag(tag.handle) + end end + + activeTags = {} + table.wipe(activeTagsMutex) end end }, { - name = 'tpmarker', - label = _U('admin_tpmarker_button'), + id = 'tpmarker', + name = _U('admin_tpmarker_button'), groups = {'_dev', 'owner', 'superadmin', 'admin'}, command = function() - local waypointHandle = GetFirstBlipInfoId(8) - - if DoesBlipExist(waypointHandle) then - CreateThread(function() - local waypointCoords = GetBlipInfoIdCoord(waypointHandle) - local foundGround, zCoords, zPos = false, -500.0, 0.0 - - while not foundGround do - zCoords = zCoords + 10.0 - RequestCollisionAtCoord(waypointCoords.x, waypointCoords.y, zCoords) - Wait(0) - foundGround, zPos = GetGroundZFor_3dCoord(waypointCoords.x, waypointCoords.y, zCoords) - - if not foundGround and zCoords >= 2000.0 then - foundGround = true - end - end - - SetPedCoordsKeepVehicle(plyPed, waypointCoords.x, waypointCoords.y, zPos) - ESX.ShowNotification(_U('admin_tpmarker')) - end) - else - ESX.ShowNotification(_U('admin_nomarker')) - end + tpMarker() end }, { - name = 'revive', - label = _U('admin_revive_button'), + id = 'revive', + name = _U('admin_revive_button'), groups = {'_dev', 'owner', 'superadmin', 'admin'}, command = function() - local plyId = KeyboardInput('BPT_BOX_ID', _U('dialogbox_playerid'), '', 8) + local targetServerId = KeyboardInput('PM_BOX_ID', _U('dialogbox_playerid'), '', 8) + if not targetServerId then return end - if plyId ~= nil then - plyId = tonumber(plyId) - - if type(plyId) == 'number' then - TriggerServerEvent('esx_ambulancejob:revive', plyId) - end - end + targetServerId = tonumber(targetServerId) + if type(targetServerId) ~= 'number' then return end + TriggerServerEvent('esx_ambulancejob:revive', targetServerId) RageUI.CloseAll() end }, { - name = 'changeskin', - label = _U('admin_changeskin_button'), + id = 'changeskin', + name = _U('admin_changeskin_button'), groups = {'_dev', 'owner', 'superadmin'}, command = function() RageUI.CloseAll() @@ -509,8 +501,8 @@ Config.Admin = { end }, { - name = 'saveskin', - label = _U('admin_saveskin_button'), + id = 'saveskin', + name = _U('admin_saveskin_button'), groups = {'_dev', 'owner', 'superadmin'}, command = function() TriggerEvent('esx_skin:requestSaveSkin') diff --git a/server-data/resources/[bpt_addons]/bpt_menu/dependencies/RMenu.lua b/server-data/resources/[bpt_addons]/bpt_menu/dependencies/RMenu.lua deleted file mode 100644 index 79197d34a..000000000 --- a/server-data/resources/[bpt_addons]/bpt_menu/dependencies/RMenu.lua +++ /dev/null @@ -1,72 +0,0 @@ ----@type table -RageUI = {} - ----@type table -RMenu = setmetatable({}, RMenu) - ----Add ----@param Type string ----@param Name string ----@param Menu table ----@return void ----@public -function RMenu.Add(Type, Name, Menu, Restriction) - if RMenu[Type] == nil then - RMenu[Type] = {} - end - - table.insert(RMenu[Type], { - Name = Name, - Menu = Menu, - Restriction = Restriction - }) -end - ----Get ----@param Type string ----@param Name string ----@return table ----@public -function RMenu.Get(Type, Name) - if RMenu[Type] ~= nil then - for i = 1, #RMenu[Type], 1 do - if RMenu[Type][i].Name == Name then - return RMenu[Type][i].Menu - end - end - end -end - ----Delete ----@param Type string ----@param Name string ----@return void ----@public -function RMenu.Delete(Type, Name) - if RMenu[Type] ~= nil then - for i = 1, #RMenu[Type], 1 do - if RMenu[Type][i].Name == Name then - table.remove(RMenu[Type], i) - end - end - end -end - ----Settings ----@param Type string ----@param Name string ----@param Settings string ----@param Value any ----@return void ----@public -function RMenu.Settings(Type, Name, Settings, Value) - for i = 1, #RMenu[Type], 1 do - if RMenu[Type][i].Name == Name then - if Value ~= nil then - RMenu[Type][i][Settings] = Value - else - return RMenu[Type][i][Settings] - end - end - end -end \ No newline at end of file diff --git a/server-data/resources/[bpt_addons]/bpt_menu/dependencies/components/Audio.lua b/server-data/resources/[bpt_addons]/bpt_menu/dependencies/components/Audio.lua deleted file mode 100644 index 0e9d8d171..000000000 --- a/server-data/resources/[bpt_addons]/bpt_menu/dependencies/components/Audio.lua +++ /dev/null @@ -1,23 +0,0 @@ ----PlaySound ----@param Library string ----@param Sound string ----@param IsLooped boolean ----@return void ----@public -function PlaySound(Library, Sound, IsLooped, Audio) - if not IsLooped then - PlaySoundFrontend(-1, Sound, Library, true) - else - if not Audio.Id then - CreateThread(function() - Audio.Id = GetSoundId() - PlaySoundFrontend(Audio.Id, Sound, Library, true) - Wait(0.01) - - StopSound(Audio.Id) - ReleaseSoundId(Audio.Id) - Audio.Id = nil - end) - end - end -end \ No newline at end of file diff --git a/server-data/resources/[bpt_addons]/bpt_menu/dependencies/components/Rectangle.lua b/server-data/resources/[bpt_addons]/bpt_menu/dependencies/components/Rectangle.lua deleted file mode 100644 index ecfbef410..000000000 --- a/server-data/resources/[bpt_addons]/bpt_menu/dependencies/components/Rectangle.lua +++ /dev/null @@ -1,15 +0,0 @@ ----RenderRectangle ----@param X number ----@param Y number ----@param Width number ----@param Height number ----@param R number ----@param G number ----@param B number ----@param A number ----@return void ----@public -function RenderRectangle(X, Y, Width, Height, R, G, B, A) - local X, Y, Width, Height = (tonumber(X) or 0) / 1920, (tonumber(Y) or 0) / 1080, (tonumber(Width) or 0) / 1920, (tonumber(Height) or 0) / 1080 - DrawRect(X + Width * 0.5, Y + Height * 0.5, Width, Height, tonumber(R) or 255, tonumber(G) or 255, tonumber(B) or 255, tonumber(A) or 255) -end \ No newline at end of file diff --git a/server-data/resources/[bpt_addons]/bpt_menu/dependencies/components/Screen.lua b/server-data/resources/[bpt_addons]/bpt_menu/dependencies/components/Screen.lua deleted file mode 100644 index 910bd08a4..000000000 --- a/server-data/resources/[bpt_addons]/bpt_menu/dependencies/components/Screen.lua +++ /dev/null @@ -1,28 +0,0 @@ ----LoadingPrompt ----@param loadingText string ----@param spinnerType number ----@return void ----@public -function LoadingPrompt(loadingText, spinnerType) - if BusyspinnerIsOn() then - BusyspinnerOff() - end - - if (loadingText == nil) then - BeginTextCommandBusyspinnerOn(nil) - else - BeginTextCommandBusyspinnerOn("STRING") - AddTextComponentSubstringPlayerName(loadingText) - end - - EndTextCommandBusyspinnerOn(spinnerType) -end - ----LoadingPromptHide ----@return void ----@public -function LoadingPromptHide() - if BusyspinnerIsOn() then - BusyspinnerOff() - end -end \ No newline at end of file diff --git a/server-data/resources/[bpt_addons]/bpt_menu/dependencies/components/Sprite.lua b/server-data/resources/[bpt_addons]/bpt_menu/dependencies/components/Sprite.lua deleted file mode 100644 index 7c971c8ac..000000000 --- a/server-data/resources/[bpt_addons]/bpt_menu/dependencies/components/Sprite.lua +++ /dev/null @@ -1,24 +0,0 @@ ----RenderSprite ----@param TextureDictionary string ----@param TextureName string ----@param X number ----@param Y number ----@param Width number ----@param Height number ----@param Heading number ----@param R number ----@param G number ----@param B number ----@param A number ----@return void ----@public -function RenderSprite(TextureDictionary, TextureName, X, Y, Width, Height, Heading, R, G, B, A) - ---@type number - local X, Y, Width, Height = (tonumber(X) or 0) / 1920, (tonumber(Y) or 0) / 1080, (tonumber(Width) or 0) / 1920, (tonumber(Height) or 0) / 1080 - - if not HasStreamedTextureDictLoaded(TextureDictionary) then - RequestStreamedTextureDict(TextureDictionary, true) - end - - DrawSprite(TextureDictionary, TextureName, X + Width * 0.5, Y + Height * 0.5, Width, Height, Heading or 0, tonumber(R) or 255, tonumber(G) or 255, tonumber(B) or 255, tonumber(A) or 255) -end \ No newline at end of file diff --git a/server-data/resources/[bpt_addons]/bpt_menu/dependencies/components/Text.lua b/server-data/resources/[bpt_addons]/bpt_menu/dependencies/components/Text.lua deleted file mode 100644 index 8baabd4ec..000000000 --- a/server-data/resources/[bpt_addons]/bpt_menu/dependencies/components/Text.lua +++ /dev/null @@ -1,166 +0,0 @@ ----MeasureStringWidth ----@param str string ----@param font number ----@param scale number ----@return number ----@public -function MeasureStringWidth(str, font, scale) - BeginTextCommandWidth("CELL_EMAIL_BCON") - AddTextComponentSubstringPlayerName(str) - SetTextFont(font or 0) - SetTextScale(1.0, scale or 0) - return EndTextCommandGetWidth(true) * 1920 -end - ----GetCharacterCount ----@param Str string ----@return number ----@public -function GetCharacterCount(Str) - ---@type number - local Chars = 0 - - for Char in Str:gmatch("[%z\1-\127\194-\244][\128-\191]*") do - Chars = Chars + 1 - end - - return Chars -end - ----AddText ----@param Text string ----@return void ----@public -function AddText(Text) - ---@type number - local Characters = GetCharacterCount(Text) - - if Characters < 100 then - AddTextComponentSubstringPlayerName(Text) - else - ---@type number - local StringsNeeded = (Characters % 99 == 0) and Characters / 99 or (Characters / 99) + 1 - - for Index = 0, StringsNeeded do - AddTextComponentSubstringPlayerName(Text:sub(Index * 99, (Index * 99) + 99)) - end - end -end - ----GetLineCount ----@param Text string ----@param X number ----@param Y number ----@param Font number ----@param Scale number ----@param R number ----@param G number ----@param B number ----@param A number ----@param Alignment string ----@param DropShadow boolean ----@param Outline boolean ----@param WordWrap number ----@return function ----@public -function GetLineCount(Text, X, Y, Font, Scale, R, G, B, A, Alignment, DropShadow, Outline, WordWrap) - ---@type table - local Text, X, Y = tostring(Text), (tonumber(X) or 0) / 1920, (tonumber(Y) or 0) / 1080 - - SetTextFont(Font or 0) - SetTextScale(1.0, Scale or 0) - SetTextColour(tonumber(R) or 255, tonumber(G) or 255, tonumber(B) or 255, tonumber(A) or 255) - - if DropShadow then - SetTextDropShadow() - end - - if Outline then - SetTextOutline() - end - - if Alignment ~= nil then - if Alignment == 1 or Alignment == "Center" or Alignment == "Centre" then - SetTextCentre(true) - elseif Alignment == 2 or Alignment == "Right" then - SetTextRightJustify(true) - end - end - - if tonumber(WordWrap) and tonumber(WordWrap) ~= 0 then - if Alignment == 1 or Alignment == "Center" or Alignment == "Centre" then - SetTextWrap(X - ((WordWrap / 1920) / 2), X + ((WordWrap / 1920) / 2)) - elseif Alignment == 2 or Alignment == "Right" then - SetTextWrap(0, X) - else - SetTextWrap(X, X + (WordWrap / 1920)) - end - else - if Alignment == 2 or Alignment == "Right" then - SetTextWrap(0, X) - end - end - - BeginTextCommandLineCount("CELL_EMAIL_BCON") - AddText(Text) - return EndTextCommandGetLineCount(X, Y) -end - ----RenderText ----@param Text string ----@param X number ----@param Y number ----@param Font number ----@param Scale number ----@param R number ----@param G number ----@param B number ----@param A number ----@param Alignment string ----@param DropShadow boolean ----@param Outline boolean ----@param WordWrap number ----@return void ----@public -function RenderText(Text, X, Y, Font, Scale, R, G, B, A, Alignment, DropShadow, Outline, WordWrap) - ---@type table - local Text, X, Y = tostring(Text), (tonumber(X) or 0) / 1920, (tonumber(Y) or 0) / 1080 - - SetTextFont(Font or 0) - SetTextScale(1.0, Scale or 0) - SetTextColour(tonumber(R) or 255, tonumber(G) or 255, tonumber(B) or 255, tonumber(A) or 255) - - if DropShadow then - SetTextDropShadow() - end - - if Outline then - SetTextOutline() - end - - if Alignment ~= nil then - if Alignment == 1 or Alignment == "Center" or Alignment == "Centre" then - SetTextCentre(true) - elseif Alignment == 2 or Alignment == "Right" then - SetTextRightJustify(true) - end - end - - if tonumber(WordWrap) and tonumber(WordWrap) ~= 0 then - if Alignment == 1 or Alignment == "Center" or Alignment == "Centre" then - SetTextWrap(X - ((WordWrap / 1920) / 2), X + ((WordWrap / 1920) / 2)) - elseif Alignment == 2 or Alignment == "Right" then - SetTextWrap(0, X) - else - SetTextWrap(X, X + (WordWrap / 1920)) - end - else - if Alignment == 2 or Alignment == "Right" then - SetTextWrap(0, X) - end - end - - BeginTextCommandDisplayText("CELL_EMAIL_BCON") - AddText(Text) - EndTextCommandDisplayText(X, Y) -end \ No newline at end of file diff --git a/server-data/resources/[bpt_addons]/bpt_menu/dependencies/components/Visual.lua b/server-data/resources/[bpt_addons]/bpt_menu/dependencies/components/Visual.lua deleted file mode 100644 index 851fe9554..000000000 --- a/server-data/resources/[bpt_addons]/bpt_menu/dependencies/components/Visual.lua +++ /dev/null @@ -1,123 +0,0 @@ ----- event from server to show notification -RegisterNetEvent("RageUI:Popup") -AddEventHandler("RageUI:Popup", function(array) - RageUI.Popup(array) -end) - ----Popup ----@param array table ----@public -function RageUI.Popup(array) - ClearPrints() - - if (array.colors == nil) then - SetNotificationBackgroundColor(140) - else - SetNotificationBackgroundColor(array.colors) - end - - SetNotificationTextEntry("STRING") - - if (array.message == nil) then - error("Missing arguments, message") - else - AddTextComponentSubstringPlayerName(tostring(array.message)) - end - - DrawNotification(false, true) - - if (array.sound ~= nil) then - if (array.sound.audio_name ~= nil) then - if (array.sound.audio_ref ~= nil) then - PlaySoundFrontend(-1, array.sound.audio_name, array.sound.audio_ref, true) - else - error("Missing arguments, audio_ref") - end - else - error("Missing arguments, audio_name") - end - end -end - ----PopupChar ----@param array table ----@public -function RageUI.PopupChar(array) - if (array.colors == nil) then - SetNotificationBackgroundColor(140) - else - SetNotificationBackgroundColor(array.colors) - end - - SetNotificationTextEntry("STRING") - - if (array.message == nil) then - error("Missing arguments, message") - else - AddTextComponentSubstringPlayerName(tostring(array.message)) - end - - if (array.request_stream_texture_dics ~= nil) then - RequestStreamedTextureDict(array.request_stream_texture_dics) - end - - if (array.picture ~= nil) then - if (array.iconTypes == 1) or (array.iconTypes == 2) or (array.iconTypes == 3) or (array.iconTypes == 7) or (array.iconTypes == 8) or (array.iconTypes == 9) then - SetNotificationMessage(tostring(array.picture), tostring(array.picture), true, array.iconTypes, array.sender, array.title) - else - SetNotificationMessage(tostring(array.picture), tostring(array.picture), true, 4, array.sender, array.title) - end - else - if (array.iconTypes == 1) or (array.iconTypes == 2) or (array.iconTypes == 3) or (array.iconTypes == 7) or (array.iconTypes == 8) or (array.iconTypes == 9) then - SetNotificationMessage('CHAR_ALL_PLAYERS_CONF', 'CHAR_ALL_PLAYERS_CONF', true, array.iconTypes, array.sender, array.title) - else - SetNotificationMessage('CHAR_ALL_PLAYERS_CONF', 'CHAR_ALL_PLAYERS_CONF', true, 4, array.sender, array.title) - end - end - - if (array.sound ~= nil) then - if (array.sound.audio_name ~= nil) then - if (array.sound.audio_ref ~= nil) then - PlaySoundFrontend(-1, array.sound.audio_name, array.sound.audio_ref, true) - else - error("Missing arguments, audio_ref") - end - else - error("Missing arguments, audio_name") - end - end - - DrawNotification(false, true) -end - ----Text ----@param array table ----@public -function RageUI.Text(array) - ClearPrints() - BeginTextCommandPrint("STRING") - - if (array.message ~= nil) then - AddTextComponentSubstringPlayerName(tostring(array.message)) - else - error("Missing arguments, message") - end - - if (array.time_display ~= nil) then - DrawSubtitleTimed(tonumber(array.time_display), 1) - else - DrawSubtitleTimed(6000, 1) - end - - if (array.sound ~= nil) then - if (array.sound.audio_name ~= nil) then - if (array.sound.audio_ref ~= nil) then - PlaySoundFrontend(-1, array.sound.audio_name, array.sound.audio_ref, true) - else - error("Missing arguments, audio_ref") - end - else - error("Missing arguments, audio_name") - end - end -end \ No newline at end of file diff --git a/server-data/resources/[bpt_addons]/bpt_menu/dependencies/menu/RageUI.lua b/server-data/resources/[bpt_addons]/bpt_menu/dependencies/menu/RageUI.lua index 21d7c578f..6237e20f4 100644 --- a/server-data/resources/[bpt_addons]/bpt_menu/dependencies/menu/RageUI.lua +++ b/server-data/resources/[bpt_addons]/bpt_menu/dependencies/menu/RageUI.lua @@ -1,3 +1,237 @@ +RageUI = {} + +---PlaySound +---@param Library string +---@param Sound string +---@param IsLooped boolean +---@return void +---@public +function PlaySound(Library, Sound, IsLooped, Audio) + if not IsLooped then + PlaySoundFrontend(-1, Sound, Library, true) + else + if not Audio.Id then + Citizen.CreateThread(function() + Audio.Id = GetSoundId() + PlaySoundFrontend(Audio.Id, Sound, Library, true) + Citizen.Wait(0.01) + + StopSound(Audio.Id) + ReleaseSoundId(Audio.Id) + Audio.Id = nil + end) + end + end +end + +---RenderRectangle +---@param X number +---@param Y number +---@param Width number +---@param Height number +---@param R number +---@param G number +---@param B number +---@param A number +---@return void +---@public +function RenderRectangle(X, Y, Width, Height, R, G, B, A) + local X, Y, Width, Height = (tonumber(X) or 0) / 1920, (tonumber(Y) or 0) / 1080, (tonumber(Width) or 0) / 1920, (tonumber(Height) or 0) / 1080 + DrawRect(X + Width * 0.5, Y + Height * 0.5, Width, Height, tonumber(R) or 255, tonumber(G) or 255, tonumber(B) or 255, tonumber(A) or 255) +end + +---RenderSprite +---@param TextureDictionary string +---@param TextureName string +---@param X number +---@param Y number +---@param Width number +---@param Height number +---@param Heading number +---@param R number +---@param G number +---@param B number +---@param A number +---@return void +---@public +function RenderSprite(TextureDictionary, TextureName, X, Y, Width, Height, Heading, R, G, B, A) + ---@type number + local X, Y, Width, Height = (tonumber(X) or 0) / 1920, (tonumber(Y) or 0) / 1080, (tonumber(Width) or 0) / 1920, (tonumber(Height) or 0) / 1080 + + if not HasStreamedTextureDictLoaded(TextureDictionary) then + RequestStreamedTextureDict(TextureDictionary, true) + end + + DrawSprite(TextureDictionary, TextureName, X + Width * 0.5, Y + Height * 0.5, Width, Height, Heading or 0, tonumber(R) or 255, tonumber(G) or 255, tonumber(B) or 255, tonumber(A) or 255) +end + +---MeasureStringWidth +---@param str string +---@param font number +---@param scale number +---@return number +---@public +function MeasureStringWidth(str, font, scale) + BeginTextCommandWidth("CELL_EMAIL_BCON") + AddTextComponentSubstringPlayerName(str) + SetTextFont(font or 0) + SetTextScale(1.0, scale or 0) + return EndTextCommandGetWidth(true) * 1920 +end + +---GetCharacterCount +---@param Str string +---@return number +---@public +function GetCharacterCount(Str) + ---@type number + local Chars = 0 + + for Char in Str:gmatch("[%z\1-\127\194-\244][\128-\191]*") do + Chars = Chars + 1 + end + + return Chars +end + +---AddText +---@param Text string +---@return void +---@public +function AddText(Text) + ---@type number + local Characters = GetCharacterCount(Text) + + if Characters < 100 then + AddTextComponentSubstringPlayerName(Text) + else + ---@type number + local StringsNeeded = (Characters % 99 == 0) and Characters / 99 or (Characters / 99) + 1 + + for Index = 0, StringsNeeded do + AddTextComponentSubstringPlayerName(Text:sub(Index * 99, (Index * 99) + 99)) + end + end +end + +---GetLineCount +---@param Text string +---@param X number +---@param Y number +---@param Font number +---@param Scale number +---@param R number +---@param G number +---@param B number +---@param A number +---@param Alignment string +---@param DropShadow boolean +---@param Outline boolean +---@param WordWrap number +---@return function +---@public +function GetLineCount(Text, X, Y, Font, Scale, R, G, B, A, Alignment, DropShadow, Outline, WordWrap) + ---@type table + local Text, X, Y = tostring(Text), (tonumber(X) or 0) / 1920, (tonumber(Y) or 0) / 1080 + + SetTextFont(Font or 0) + SetTextScale(1.0, Scale or 0) + SetTextColour(tonumber(R) or 255, tonumber(G) or 255, tonumber(B) or 255, tonumber(A) or 255) + + if DropShadow then + SetTextDropShadow() + end + + if Outline then + SetTextOutline() + end + + if Alignment ~= nil then + if Alignment == 1 or Alignment == "Center" or Alignment == "Centre" then + SetTextCentre(true) + elseif Alignment == 2 or Alignment == "Right" then + SetTextRightJustify(true) + end + end + + if tonumber(WordWrap) and tonumber(WordWrap) ~= 0 then + if Alignment == 1 or Alignment == "Center" or Alignment == "Centre" then + SetTextWrap(X - ((WordWrap / 1920) / 2), X + ((WordWrap / 1920) / 2)) + elseif Alignment == 2 or Alignment == "Right" then + SetTextWrap(0, X) + else + SetTextWrap(X, X + (WordWrap / 1920)) + end + else + if Alignment == 2 or Alignment == "Right" then + SetTextWrap(0, X) + end + end + + BeginTextCommandLineCount("CELL_EMAIL_BCON") + AddText(Text) + return EndTextCommandGetLineCount(X, Y) +end + +---RenderText +---@param Text string +---@param X number +---@param Y number +---@param Font number +---@param Scale number +---@param R number +---@param G number +---@param B number +---@param A number +---@param Alignment string +---@param DropShadow boolean +---@param Outline boolean +---@param WordWrap number +---@return void +---@public +function RenderText(Text, X, Y, Font, Scale, R, G, B, A, Alignment, DropShadow, Outline, WordWrap) + ---@type table + local Text, X, Y = tostring(Text), (tonumber(X) or 0) / 1920, (tonumber(Y) or 0) / 1080 + + SetTextFont(Font or 0) + SetTextScale(1.0, Scale or 0) + SetTextColour(tonumber(R) or 255, tonumber(G) or 255, tonumber(B) or 255, tonumber(A) or 255) + + if DropShadow then + SetTextDropShadow() + end + + if Outline then + SetTextOutline() + end + + if Alignment ~= nil then + if Alignment == 1 or Alignment == "Center" or Alignment == "Centre" then + SetTextCentre(true) + elseif Alignment == 2 or Alignment == "Right" then + SetTextRightJustify(true) + end + end + + if tonumber(WordWrap) and tonumber(WordWrap) ~= 0 then + if Alignment == 1 or Alignment == "Center" or Alignment == "Centre" then + SetTextWrap(X - ((WordWrap / 1920) / 2), X + ((WordWrap / 1920) / 2)) + elseif Alignment == 2 or Alignment == "Right" then + SetTextWrap(0, X) + else + SetTextWrap(X, X + (WordWrap / 1920)) + end + else + if Alignment == 2 or Alignment == "Right" then + SetTextWrap(0, X) + end + end + + BeginTextCommandDisplayText("CELL_EMAIL_BCON") + AddText(Text) + EndTextCommandDisplayText(X, Y) +end + ---round ---@param num number ---@param numDecimalPlaces number @@ -343,10 +577,10 @@ function RageUI.PlaySound(Library, Sound, IsLooped) PlaySoundFrontend(-1, Sound, Library, true) else if not audioId then - CreateThread(function() + Citizen.CreateThread(function() audioId = GetSoundId() PlaySoundFrontend(audioId, Sound, Library, true) - Wait(0) + Citizen.Wait(0) StopSound(audioId) ReleaseSoundId(audioId) @@ -623,14 +857,14 @@ end ---@return void ---@public function RageUI.CreateWhile(wait, closure, beforeWait) - CreateThread(function() + Citizen.CreateThread(function() while true do if (beforeWait or beforeWait == nil) then - Wait(wait or 0.1) + Citizen.Wait(wait or 0.1) closure() else closure() - Wait(wait or 0.1) + Citizen.Wait(wait or 0.1) end end end) diff --git a/server-data/resources/[bpt_addons]/bpt_menu/dependencies/menu/items/UIButton.lua b/server-data/resources/[bpt_addons]/bpt_menu/dependencies/menu/items/UIButton.lua index c12fc6102..9eaadcdae 100644 --- a/server-data/resources/[bpt_addons]/bpt_menu/dependencies/menu/items/UIButton.lua +++ b/server-data/resources/[bpt_addons]/bpt_menu/dependencies/menu/items/UIButton.lua @@ -30,14 +30,12 @@ function RageUI.Button(Label, Description, Style, Enabled, Callback, Submenu) local Selected = CurrentMenu.Index == Option RageUI.ItemsSafeZone(CurrentMenu) - local LeftBadgeOffset = ((Style.LeftBadge == RageUI.BadgeStyle.None or tonumber(Style.LeftBadge) == nil) and 0 or 27) - local RightBadgeOffset = ((Style.RightBadge == RageUI.BadgeStyle.None or tonumber(Style.RightBadge) == nil) and 0 or 32) + local LeftBadgeOffset = ((Style?.LeftBadge == RageUI.BadgeStyle.None or tonumber(Style?.LeftBadge) == nil) and 0 or 27) + local RightBadgeOffset = ((Style?.RightBadge == RageUI.BadgeStyle.None or tonumber(Style?.RightBadge) == nil) and 0 or 32) local Hovered = false - if Style.Color ~= nil then - if Style.Color.BackgroundColor ~= nil then - RenderRectangle(CurrentMenu.X, CurrentMenu.Y + SettingsButton.SelectedSprite.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsButton.SelectedSprite.Width + CurrentMenu.WidthOffset, SettingsButton.SelectedSprite.Height, Style.Color.BackgroundColor[1],Style.Color.BackgroundColor[2],Style.Color.BackgroundColor[3]) - end + if Style?.Color?.BackgroundColor ~= nil then + RenderRectangle(CurrentMenu.X, CurrentMenu.Y + SettingsButton.SelectedSprite.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsButton.SelectedSprite.Width + CurrentMenu.WidthOffset, SettingsButton.SelectedSprite.Height, Style.Color.BackgroundColor[1],Style.Color.BackgroundColor[2],Style.Color.BackgroundColor[3]) end ---@type boolean @@ -46,12 +44,12 @@ function RageUI.Button(Label, Description, Style, Enabled, Callback, Submenu) end if Selected then - if Style.Color == nil then - RenderSprite(SettingsButton.SelectedSprite.Dictionary, SettingsButton.SelectedSprite.Texture, CurrentMenu.X, CurrentMenu.Y + SettingsButton.SelectedSprite.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsButton.SelectedSprite.Width + CurrentMenu.WidthOffset, SettingsButton.SelectedSprite.Height) - end - - if Style.Color ~= nil and Style.Color.HightLightColor ~= nil then - RenderRectangle(CurrentMenu.X, CurrentMenu.Y + SettingsButton.SelectedSprite.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsButton.SelectedSprite.Width + CurrentMenu.WidthOffset, SettingsButton.SelectedSprite.Height, Style.Color.HightLightColor[1],Style.Color.HightLightColor[2],Style.Color.HightLightColor[3]) + if Style?.Color then + if Style.Color.HightLightColor then + RenderRectangle(CurrentMenu.X, CurrentMenu.Y + SettingsButton.SelectedSprite.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsButton.SelectedSprite.Width + CurrentMenu.WidthOffset, SettingsButton.SelectedSprite.Height, Style.Color.HightLightColor[1],Style.Color.HightLightColor[2],Style.Color.HightLightColor[3]) + else + RenderSprite(SettingsButton.SelectedSprite.Dictionary, SettingsButton.SelectedSprite.Texture, CurrentMenu.X, CurrentMenu.Y + SettingsButton.SelectedSprite.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsButton.SelectedSprite.Width + CurrentMenu.WidthOffset, SettingsButton.SelectedSprite.Height) + end else RenderSprite(SettingsButton.SelectedSprite.Dictionary, SettingsButton.SelectedSprite.Texture, CurrentMenu.X, CurrentMenu.Y + SettingsButton.SelectedSprite.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsButton.SelectedSprite.Width + CurrentMenu.WidthOffset, SettingsButton.SelectedSprite.Height) end @@ -73,13 +71,13 @@ function RageUI.Button(Label, Description, Style, Enabled, Callback, Submenu) if (Enabled) then if Selected then - if Style.RightLabel ~= nil and Style.RightLabel ~= "" then + if Style?.RightLabel ~= nil and Style.RightLabel ~= "" then RenderText(Style.RightLabel, CurrentMenu.X + SettingsButton.RightText.X - RightBadgeOffset + CurrentMenu.WidthOffset, CurrentMenu.Y + SettingsButton.RightText.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.RightText.Scale, 0, 0, 0, 255, 2) end RenderText(Label, CurrentMenu.X + SettingsButton.Text.X + LeftBadgeOffset, CurrentMenu.Y + SettingsButton.Text.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.Text.Scale, 0, 0, 0, 255) else - if Style.RightLabel ~= nil and Style.RightLabel ~= "" then + if Style?.RightLabel ~= nil and Style.RightLabel ~= "" then RenderText(Style.RightLabel, CurrentMenu.X + SettingsButton.RightText.X - RightBadgeOffset + CurrentMenu.WidthOffset, CurrentMenu.Y + SettingsButton.RightText.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.RightText.Scale, 245, 245, 245, 255, 2) end @@ -93,7 +91,9 @@ function RageUI.Button(Label, Description, Style, Enabled, Callback, Submenu) RageUI.ItemsDescription(CurrentMenu, Description, Selected) if (Enabled) then - Callback(Hovered, Selected, ((CurrentMenu.Controls.Select.Active or (Hovered and CurrentMenu.Controls.Click.Active)) and Selected)) + if Callback then + Callback(Hovered, Selected, ((CurrentMenu.Controls.Select.Active or (Hovered and CurrentMenu.Controls.Click.Active)) and Selected)) + end end if Selected and (CurrentMenu.Controls.Select.Active or (Hovered and CurrentMenu.Controls.Click.Active)) then @@ -102,10 +102,8 @@ function RageUI.Button(Label, Description, Style, Enabled, Callback, Submenu) if (Enabled) then RageUI.PlaySound(Audio[Audio.Use].Select.audioName, Audio[Audio.Use].Select.audioRef) - if Submenu ~= nil then - if Submenu() then - RageUI.NextMenu = Submenu - end + if Submenu and Submenu() then + RageUI.NextMenu = Submenu end else RageUI.PlaySound(Audio[Audio.Use].Error.audioName, Audio[Audio.Use].Error.audioRef) @@ -113,102 +111,6 @@ function RageUI.Button(Label, Description, Style, Enabled, Callback, Submenu) end end - RageUI.Options = RageUI.Options + 1 - end - end -end - -function RageUI.CenterButton(Label, Description, Style, Enabled, Callback, Submenu) - ---@type table - local CurrentMenu = RageUI.CurrentMenu - - if CurrentMenu ~= nil then - if CurrentMenu() then - ---@type number - local Option = RageUI.Options + 1 - - if CurrentMenu.Pagination.Minimum <= Option and CurrentMenu.Pagination.Maximum >= Option then - ---@type boolean - local Selected = CurrentMenu.Index == Option - RageUI.ItemsSafeZone(CurrentMenu) - - local LeftBadgeOffset = ((Style.LeftBadge == RageUI.BadgeStyle.None or tonumber(Style.LeftBadge) == nil) and 0 or 27) - local RightBadgeOffset = ((Style.RightBadge == RageUI.BadgeStyle.None or tonumber(Style.RightBadge) == nil) and 0 or 32) - local Hovered = false - - if Style.Color ~= nil then - if Style.Color.BackgroundColor ~= nil then - RenderRectangle(CurrentMenu.X, CurrentMenu.Y + SettingsButton.SelectedSprite.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsButton.SelectedSprite.Width + CurrentMenu.WidthOffset, SettingsButton.SelectedSprite.Height, Style.Color.BackgroundColor[1],Style.Color.BackgroundColor[2],Style.Color.BackgroundColor[3]) - end - end - - ---@type boolean - if CurrentMenu.EnableMouse == true then - Hovered = RageUI.ItemsMouseBounds(CurrentMenu, Selected, Option, SettingsButton) - end - if Selected then - if Style.Color == nil then - RenderSprite(SettingsButton.SelectedSprite.Dictionary, SettingsButton.SelectedSprite.Texture, CurrentMenu.X, CurrentMenu.Y + SettingsButton.SelectedSprite.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsButton.SelectedSprite.Width + CurrentMenu.WidthOffset, SettingsButton.SelectedSprite.Height) - end - - if Style.Color ~= nil and Style.Color.HightLightColor ~= nil then - RenderRectangle(CurrentMenu.X, CurrentMenu.Y + SettingsButton.SelectedSprite.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsButton.SelectedSprite.Width + CurrentMenu.WidthOffset, SettingsButton.SelectedSprite.Height, Style.Color.HightLightColor[1],Style.Color.HightLightColor[2],Style.Color.HightLightColor[3]) - else - RenderSprite(SettingsButton.SelectedSprite.Dictionary, SettingsButton.SelectedSprite.Texture, CurrentMenu.X, CurrentMenu.Y + SettingsButton.SelectedSprite.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsButton.SelectedSprite.Width + CurrentMenu.WidthOffset, SettingsButton.SelectedSprite.Height) - end - end - - if type(Style) == 'table' then - if Style.LeftBadge ~= nil then - if Style.LeftBadge ~= RageUI.BadgeStyle.None and tonumber(Style.LeftBadge) ~= nil then - RenderSprite(RageUI.GetBadgeDictionary(Style.LeftBadge, Selected), RageUI.GetBadgeTexture(Style.LeftBadge, Selected), CurrentMenu.X, CurrentMenu.Y + SettingsButton.LeftBadge.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsButton.LeftBadge.Width, SettingsButton.LeftBadge.Height, RageUI.GetBadgeColour(Style.LeftBadge, Selected)) - end - end - - if Style.RightBadge ~= nil then - if Style.RightBadge ~= RageUI.BadgeStyle.None and tonumber(Style.RightBadge) ~= nil then - RenderSprite(RageUI.GetBadgeDictionary(Style.RightBadge, Selected), RageUI.GetBadgeTexture(Style.RightBadge, Selected), CurrentMenu.X + SettingsButton.RightBadge.X + CurrentMenu.WidthOffset, CurrentMenu.Y + SettingsButton.RightBadge.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsButton.RightBadge.Width, SettingsButton.RightBadge.Height, 0, RageUI.GetBadgeColour(Style.RightBadge, Selected)) - end - end - end - - if Enabled == true or Enabled == nil then - if Selected then - if Style.RightLabel ~= nil and Style.RightLabel ~= "" then - RenderText(Style.RightLabel, CurrentMenu.X + SettingsButton.RightText.X - RightBadgeOffset + CurrentMenu.WidthOffset, CurrentMenu.Y + SettingsButton.RightText.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.RightText.Scale, 0, 0, 0, 255, 2) - end - - RenderText(Label, CurrentMenu.X + SettingsButton.Text.X + LeftBadgeOffset+250.0, CurrentMenu.Y + SettingsButton.Text.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.Text.Scale, 0, 0, 0, 255,1) - else - if Style.RightLabel ~= nil and Style.RightLabel ~= "" then - RenderText(Style.RightLabel, CurrentMenu.X + SettingsButton.RightText.X - RightBadgeOffset + CurrentMenu.WidthOffset, CurrentMenu.Y + SettingsButton.RightText.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.RightText.Scale, 245, 245, 245, 255, 2) - end - - RenderText(Label, CurrentMenu.X + SettingsButton.Text.X + LeftBadgeOffset+250.0, CurrentMenu.Y + SettingsButton.Text.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.Text.Scale, 245, 245, 245, 255,1) - end - else - RenderText(Label, CurrentMenu.X + SettingsButton.Text.X + LeftBadgeOffset, CurrentMenu.Y + SettingsButton.Text.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.Text.Scale, 163, 159, 148, 255) - end - - RageUI.ItemOffset = RageUI.ItemOffset + SettingsButton.Rectangle.Height - RageUI.ItemsDescription(CurrentMenu, Description, Selected) - - if (Enabled) then - Callback(Hovered, Selected, ((CurrentMenu.Controls.Select.Active or (Hovered and CurrentMenu.Controls.Click.Active)) and Selected)) - end - - if Selected and (CurrentMenu.Controls.Select.Active or (Hovered and CurrentMenu.Controls.Click.Active)) then - local Audio = RageUI.Settings.Audio - RageUI.PlaySound(Audio[Audio.Use].Select.audioName, Audio[Audio.Use].Select.audioRef) - - if Submenu ~= nil then - if Submenu() then - RageUI.NextMenu = Submenu - end - end - end - end - RageUI.Options = RageUI.Options + 1 end end diff --git a/server-data/resources/[bpt_addons]/bpt_menu/dependencies/menu/items/UIList.lua b/server-data/resources/[bpt_addons]/bpt_menu/dependencies/menu/items/UIList.lua index 996260862..c3a705829 100644 --- a/server-data/resources/[bpt_addons]/bpt_menu/dependencies/menu/items/UIList.lua +++ b/server-data/resources/[bpt_addons]/bpt_menu/dependencies/menu/items/UIList.lua @@ -43,8 +43,8 @@ function RageUI.List(Label, Items, Index, Description, Style, Enabled, Callback, RageUI.ItemsSafeZone(CurrentMenu) local Hovered = false - local LeftBadgeOffset = ((Style.LeftBadge == RageUI.BadgeStyle.None or tonumber(Style.LeftBadge) == nil) and 0 or 27) - local RightBadgeOffset = ((Style.RightBadge == RageUI.BadgeStyle.None or tonumber(Style.RightBadge) == nil) and 0 or 32) + local LeftBadgeOffset = ((Style?.LeftBadge == RageUI.BadgeStyle.None or tonumber(Style?.LeftBadge) == nil) and 0 or 27) + local RightBadgeOffset = ((Style?.RightBadge == RageUI.BadgeStyle.None or tonumber(Style?.RightBadge) == nil) and 0 or 32) local RightOffset = 0 ---@type boolean @@ -53,16 +53,18 @@ function RageUI.List(Label, Items, Index, Description, Style, Enabled, Callback, end local ListText = (type(Items[Index]) == "table") and tostring(Items[Index].Name) or tostring(Items[Index]) or "NIL" + local name = ListText - local name = name:gsub("é", "e") - local name = name:gsub("â", "a") - local name = name:gsub("à", "a") - local name = name:gsub("è", "e") - local name = name:gsub("ê", "e") - local name = name:gsub("î", "i") - local name = name:gsub("ç", "c") - local name = name:gsub("ô", "o") - local name = name:gsub("É", "E") + :gsub("é", "e") + :gsub("â", "a") + :gsub("à", "a") + :gsub("è", "e") + :gsub("ê", "e") + :gsub("î", "i") + :gsub("ç", "c") + :gsub("ô", "o") + :gsub("É", "E") + local TextOffset = MeasureStringWidth(name, 0, 0.35) if Selected then @@ -73,12 +75,12 @@ function RageUI.List(Label, Items, Index, Description, Style, Enabled, Callback, if Enabled == true or Enabled == nil then if Selected then - if Style.RightLabel ~= nil and Style.RightLabel ~= "" then + if Style?.RightLabel ~= nil and Style.RightLabel ~= "" then RenderText(Style.RightLabel, CurrentMenu.X + SettingsButton.RightText.X - RightBadgeOffset + CurrentMenu.WidthOffset, CurrentMenu.Y + SettingsButton.RightText.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.RightText.Scale, 0, 0, 0, 255, 2) RightOffset = MeasureStringWidth(Style.RightLabel,0,0.35) end else - if Style.RightLabel ~= nil and Style.RightLabel ~= "" then + if Style?.RightLabel ~= nil and Style.RightLabel ~= "" then RightOffset = MeasureStringWidth(Style.RightLabel,0,0.35) RenderText(Style.RightLabel, CurrentMenu.X + SettingsButton.RightText.X - RightBadgeOffset + CurrentMenu.WidthOffset, CurrentMenu.Y + SettingsButton.RightText.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.RightText.Scale, 245, 245, 245, 255, 2) end @@ -138,8 +140,6 @@ function RageUI.List(Label, Items, Index, Description, Style, Enabled, Callback, RenderSprite(RageUI.GetBadgeDictionary(LeftBadge, Selected), RageUI.GetBadgeTexture(LeftBadge, Selected), CurrentMenu.X, CurrentMenu.Y + SettingsButton.LeftBadge.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsButton.LeftBadge.Width, SettingsButton.LeftBadge.Height, nil, CheckBoxLockBadgeColor(Selected)) end end - else - error("UICheckBox Style is not a `table`") end RageUI.ItemOffset = RageUI.ItemOffset + SettingsButton.Rectangle.Height @@ -166,17 +166,17 @@ function RageUI.List(Label, Items, Index, Description, Style, Enabled, Callback, end if (Enabled) then - Callback(Hovered, Selected, ((CurrentMenu.Controls.Select.Active or ((Hovered and CurrentMenu.Controls.Click.Active) and (not LeftArrowHovered and not RightArrowHovered))) and Selected), Index) + if Callback then + Callback(Hovered, Selected, ((CurrentMenu.Controls.Select.Active or ((Hovered and CurrentMenu.Controls.Click.Active) and (not LeftArrowHovered and not RightArrowHovered))) and Selected), Index) + end end if Selected and (CurrentMenu.Controls.Select.Active or ((Hovered and CurrentMenu.Controls.Click.Active) and (not LeftArrowHovered and not RightArrowHovered))) then local Audio = RageUI.Settings.Audio RageUI.PlaySound(Audio[Audio.Use].Select.audioName, Audio[Audio.Use].Select.audioRef) - if Submenu ~= nil then - if Submenu() then - RageUI.NextMenu = Submenu - end + if Submenu and Submenu() then + RageUI.NextMenu = Submenu end end end diff --git a/server-data/resources/[bpt_addons]/bpt_menu/fxmanifest.lua b/server-data/resources/[bpt_addons]/bpt_menu/fxmanifest.lua index 8f8efa673..f99f546bd 100644 --- a/server-data/resources/[bpt_addons]/bpt_menu/fxmanifest.lua +++ b/server-data/resources/[bpt_addons]/bpt_menu/fxmanifest.lua @@ -19,15 +19,12 @@ server_scripts { } client_scripts { - "dependencies/RMenu.lua", - "dependencies/components/*.lua", "dependencies/menu/RageUI.lua", "dependencies/menu/Menu.lua", "dependencies/menu/MenuController.lua", "dependencies/menu/elements/*.lua", "dependencies/menu/items/*.lua", - 'client/main.lua', - 'client/other.lua' + 'client/*.lua' } shared_script '@es_extended/imports.lua' From e2deef0bb3e3aa90bf29f7ae00565c8dbd25eab4 Mon Sep 17 00:00:00 2001 From: bitpredator <67551273+bitpredator@users.noreply.github.com> Date: Sun, 31 Dec 2023 22:37:16 +0100 Subject: [PATCH 2/4] fix: unused argument grade2 --- server-data/resources/[bpt_addons]/bpt_menu/server/main.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server-data/resources/[bpt_addons]/bpt_menu/server/main.lua b/server-data/resources/[bpt_addons]/bpt_menu/server/main.lua index 7e465c996..79798d0de 100644 --- a/server-data/resources/[bpt_addons]/bpt_menu/server/main.lua +++ b/server-data/resources/[bpt_addons]/bpt_menu/server/main.lua @@ -316,7 +316,7 @@ AddEventHandler('bpt_menu:Boss_dismissplayer2', makeTargetedEventFunction(functi end)) RegisterServerEvent('bpt_menu:Boss_recruitplayer2') -AddEventHandler('bpt_menu:Boss_recruitplayer2', makeTargetedEventFunction(function(target, grade2) +AddEventHandler('bpt_menu:Boss_recruitplayer2', makeTargetedEventFunction(function(target) local sourceXPlayer = ESX.GetPlayerFromId(source) local sourceJob2 = sourceXPlayer.getJob2() From c3150f25e1039aeedf0b42e37ce491f0ed1ec07e Mon Sep 17 00:00:00 2001 From: bitpredator <67551273+bitpredator@users.noreply.github.com> Date: Sun, 31 Dec 2023 22:43:12 +0100 Subject: [PATCH 3/4] fix --- .../[bpt_addons]/bpt_menu/client/main.lua | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/server-data/resources/[bpt_addons]/bpt_menu/client/main.lua b/server-data/resources/[bpt_addons]/bpt_menu/client/main.lua index b5b13d7d1..2919c033a 100644 --- a/server-data/resources/[bpt_addons]/bpt_menu/client/main.lua +++ b/server-data/resources/[bpt_addons]/bpt_menu/client/main.lua @@ -56,17 +56,17 @@ CreateThread(function() end local weaponsData = ESX.GetWeaponList() - + for i = #weaponsData, 1, -1 do local weaponData = weaponsData[i] - + if weaponData.name == 'WEAPON_UNARMED' then table.remove(weaponsData, i) else weaponData.hash = GetHashKey(weaponData.name) end end - + PersonalMenu.WeaponData = weaponsData end end) @@ -661,12 +661,12 @@ getPersonalMenuCategory('wallet').drawer = function() end end) - RageUI.Button(_U('wallet_check_idcard_button'), nil, nil, true, function(Hovered, Active, Selected) + RageUI.Button(_U('wallet_check_idcard_button'), nil, nil, true, function(_, _, Selected) if not Selected then return end TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(PlayerId())) end) - RageUI.Button(_U('wallet_show_driver_button'), nil, nil, true, function(Hovered, Active, Selected) + RageUI.Button(_U('wallet_show_driver_button'), nil, nil, true, function(_, _, Selected) if not Selected then return end local closestPlayer, closestDistance = GetClosestPlayer() @@ -678,12 +678,12 @@ getPersonalMenuCategory('wallet').drawer = function() end end) - RageUI.Button(_U('wallet_check_driver_button'), nil, nil, true, function(Hovered, Active, Selected) + RageUI.Button(_U('wallet_check_driver_button'), nil, nil, true, function(_, _, Selected) if not Selected then return end TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(PlayerId()), 'driver') end) - RageUI.Button(_U('wallet_show_firearms_button'), nil, nil, true, function(Hovered, Active, Selected) + RageUI.Button(_U('wallet_show_firearms_button'), nil, nil, true, function(_, _, Selected) if not Selected then return end local closestPlayer, closestDistance = GetClosestPlayer() @@ -695,7 +695,7 @@ getPersonalMenuCategory('wallet').drawer = function() end end) - RageUI.Button(_U('wallet_check_firearms_button'), nil, nil, true, function(Hovered, Active, Selected) + RageUI.Button(_U('wallet_check_firearms_button'), nil, nil, true, function(_, _, Selected) if not Selected then return end TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(PlayerId()), 'weapon') end) @@ -706,7 +706,7 @@ getPersonalMenuCategory('billing').drawer = function() for i = 1, #PersonalMenu.BillData do local billData = PersonalMenu.BillData[i] - RageUI.Button(billData.label, nil, { RightLabel = ('$%s'):format(GroupDigits(billData.amount)) }, true, function(Hovered, Active, Selected) + RageUI.Button(billData.label, nil, { RightLabel = ('$%s'):format(GroupDigits(billData.amount)) }, true, function(_, _, Selected) if not Selected then return end TriggerServerCallback('esx_billing:payBill', function() @@ -720,7 +720,7 @@ getPersonalMenuCategory('clothes').drawer = function() for i = 1, #PersonalMenu.ClothesButtons do local clotheId = PersonalMenu.ClothesButtons[i] - RageUI.Button(_U(('clothes_%s'):format(clotheId)), nil, {RightBadge = RageUI.BadgeStyle.Clothes}, true, function(Hovered, Active, Selected) + RageUI.Button(_U(('clothes_%s'):format(clotheId)), nil, {RightBadge = RageUI.BadgeStyle.Clothes}, true, function(_, _, Selected) if not Selected then return end setClothes(clotheId) end) @@ -731,7 +731,7 @@ getPersonalMenuCategory('accessories').drawer = function() for i = 1, #PersonalMenu.AccessoriesButtons do local accessoryId = PersonalMenu.AccessoriesButtons[i] - RageUI.Button(_U(('accessories_%s'):format(accessoryId)), nil, {RightBadge = RageUI.BadgeStyle.Clothes}, true, function(Hovered, Active, Selected) + RageUI.Button(_U(('accessories_%s'):format(accessoryId)), nil, {RightBadge = RageUI.BadgeStyle.Clothes}, true, function(_, _, Selected) if not Selected then return end setAccessory(accessoryId) end) @@ -750,7 +750,7 @@ function DrawAnimationsCategory(animationCfg) for i = 1, #animationCfg.items do local animItemCfg = animationCfg.items[i] - RageUI.Button(animItemCfg.name, nil, nil, true, function(Hovered, Active, Selected) + RageUI.Button(animItemCfg.name, nil, nil, true, function(_, _, Selected) if not Selected then return end if animItemCfg.type == 'anim' then From bfebfc46de7dc07fa368fbb5d113443c11dd293d Mon Sep 17 00:00:00 2001 From: bitpredator <67551273+bitpredator@users.noreply.github.com> Date: Thu, 4 Jan 2024 21:41:28 +0100 Subject: [PATCH 4/4] refactor + fix --- .../[bpt_addons]/bpt_menu/client/main.lua | 367 +----------------- .../[bpt_addons]/bpt_menu/client/utils.lua | 19 +- .../[bpt_addons]/bpt_menu/locales/it.lua | 29 -- .../[bpt_addons]/bpt_menu/server/main.lua | 8 - 4 files changed, 6 insertions(+), 417 deletions(-) diff --git a/server-data/resources/[bpt_addons]/bpt_menu/client/main.lua b/server-data/resources/[bpt_addons]/bpt_menu/client/main.lua index 2919c033a..af35b59a6 100644 --- a/server-data/resources/[bpt_addons]/bpt_menu/client/main.lua +++ b/server-data/resources/[bpt_addons]/bpt_menu/client/main.lua @@ -1,9 +1,8 @@ local PersonalMenu = { ItemSelected = {}, ItemIndex = {}, - WeaponData = {}, WalletIndex = {}, - WalletList = {_U('wallet_option_give'), _U('wallet_option_drop')}, + WalletList = {}, BillData = {}, ClothesButtons = {'torso', 'pants', 'shoes', 'bag', 'bproof'}, AccessoriesButtons = {'ears', 'glasses', 'helmet', 'mask'}, @@ -54,20 +53,6 @@ CreateThread(function() while not ESX do Wait(100) end - - local weaponsData = ESX.GetWeaponList() - - for i = #weaponsData, 1, -1 do - local weaponData = weaponsData[i] - - if weaponData.name == 'WEAPON_UNARMED' then - table.remove(weaponsData, i) - else - weaponData.hash = GetHashKey(weaponData.name) - end - end - - PersonalMenu.WeaponData = weaponsData end end) @@ -103,10 +88,7 @@ local function getPersonalMenuCategory(id) return personalMenuCategoriesById[id] end -local inventoryCategory = addPersonalMenuCategory('inventory', _U('inventory_title')) -local loadoutCategory = addPersonalMenuCategory('loadout', _U('loadout_title')) -addPersonalMenuCategory('wallet', _U('wallet_title')) -addPersonalMenuCategory('billing', _U('bills_title')) +local billingCategory = addPersonalMenuCategory('billing', _U('bills_title')) addPersonalMenuCategory('clothes', _U('clothes_title')) addPersonalMenuCategory('accessories', _U('accessories_title')) local animationCategory = addPersonalMenuCategory('animation', _U('animation_title')) @@ -129,16 +111,6 @@ addPersonalMenuCategory('admin', _U('admin_title'), function() return adminGroups[PlayerVars.group] ~= nil end) -local inventoryActionsMenu = RageUI.CreateSubMenu(inventoryCategory.menu, _U('inventory_actions_title')) -inventoryActionsMenu.Closed = function() - PersonalMenu.ItemSelected = nil -end - -local loadoutActionsMenu = RageUI.CreateSubMenu(loadoutCategory.menu, _U('loadout_actions_title')) -loadoutActionsMenu.Closed = function() - PersonalMenu.ItemSelected = nil -end - for i = 1, #Config.Animations do local animationCfg = Config.Animations[i] animationCfg.menu = RageUI.CreateSubMenu(animationCategory.menu, animationCfg.name) @@ -156,21 +128,12 @@ AddEventHandler('playerSpawned', function() PlayerVars.isDead = false end) --- Weapon Menu -- -RegisterNetEvent('bpt_menu:Weapon_addAmmoToPedC', function(value, quantity) - local weaponHash = GetHashKey(value) - - if HasPedGotWeapon(plyPed, weaponHash, false) and value ~= 'WEAPON_UNARMED' then - AddAmmoToPed(plyPed, value, quantity) - end -end) - --- Admin Menu -- +-- Admin Menu RegisterNetEvent('bpt_menu:Admin_BringC', function(plyCoords) SetEntityCoords(plyPed, plyCoords) end) ---Message text joueur +-- Player text message local function Text(text) SetTextColour(186, 186, 186, 255) SetTextFont(0) @@ -392,316 +355,6 @@ function DrawPersonalMenu() end) end -function DrawActionsMenu(_type) - ruiDrawContent(drawContentOptions, function() - if _type == 'inventory' then - RageUI.Button(_U('inventory_use_button'), "", nil, true, function(Hovered, Active, Selected) - if not Selected then return end - - local itemSelected = PersonalMenu.ItemSelected - - if not itemSelected.usable then - GameNotification(_U('not_usable', itemSelected.label)) - return - end - - TriggerServerEvent('esx:useItem', itemSelected.name) - end) - - RageUI.Button(_U('inventory_give_button'), "", nil, true, function(Hovered, Active, Selected) - if not Selected then return end - - local closestPlayer, closestDistance = GetClosestPlayer() - - if closestDistance == -1 or closestDistance > 3 then - GameNotification(_U('players_nearby')) - return - end - - local itemSelected = PersonalMenu.ItemSelected - - local closestPed = GetPlayerPed(closestPlayer) - if not IsPedOnFoot(closestPed) then - GameNotification(_U('in_vehicle_give', itemSelected.label)) - return - end - - if not PersonalMenu.ItemIndex[itemSelected.name] or itemSelected.count <= 0 then - GameNotification(_U('amount_invalid')) - return - end - - TriggerServerEvent('esx:giveInventoryItem', GetPlayerServerId(closestPlayer), 'item_standard', itemSelected.name, PersonalMenu.ItemIndex[itemSelected.name]) - RageUI.CloseAll() - end) - - RageUI.Button(_U('inventory_drop_button'), "", {RightBadge = RageUI.BadgeStyle.Alert}, true, function(Hovered, Active, Selected) - if not Selected then return end - - local itemSelected = PersonalMenu.ItemSelected - - if not itemSelected.canRemove then - GameNotification(_U('not_droppable', itemSelected.label)) - return - end - - if not IsPedOnFoot(plyPed) then - GameNotification(_U('in_vehicle_drop', itemSelected.label)) - return - end - - if not PersonalMenu.ItemIndex[itemSelected.name] then - GameNotification(_U('amount_invalid')) - return - end - - TriggerServerEvent('esx:removeInventoryItem', 'item_standard', itemSelected.name, PersonalMenu.ItemIndex[itemSelected.name]) - RageUI.CloseAll() - end) - elseif _type == 'loadout' then - if not HasPedGotWeapon(plyPed, PersonalMenu.ItemSelected.hash, false) then - RageUI.GoBack() - return - end - - RageUI.Button(_U('loadout_give_button'), "", nil, true, function(Hovered, Active, Selected) - if not Selected then return end - - local closestPlayer, closestDistance = GetClosestPlayer() - if closestDistance == -1 or closestDistance > 3 then - GameNotification(_U('players_nearby')) - return - end - - local itemSelected = PersonalMenu.ItemSelected - - local closestPed = GetPlayerPed(closestPlayer) - if not IsPedOnFoot(closestPed) then - GameNotification(_U('in_vehicle_give', itemSelected.label)) - return - end - - local ammo = GetAmmoInPedWeapon(plyPed, itemSelected.hash) - TriggerServerEvent('esx:giveInventoryItem', GetPlayerServerId(closestPlayer), 'item_weapon', itemSelected.name, ammo) - RageUI.CloseAll() - end) - - RageUI.Button(_U('loadout_givemun_button'), "", {RightBadge = RageUI.BadgeStyle.Ammo}, true, function(Hovered, Active, Selected) - if not Selected then return end - - local post, quantity = CheckQuantity(KeyboardInput('PM_BOX_AMMO_AMOUNT', _U('dialogbox_amount_ammo'), '', 8)) - if not post then - GameNotification(_U('amount_invalid')) - return - end - - local closestPlayer, closestDistance = GetClosestPlayer() - if closestDistance == -1 or closestDistance > 3 then - GameNotification(_U('players_nearby')) - return - end - - local itemSelected = PersonalMenu.ItemSelected - - local closestPed = GetPlayerPed(closestPlayer) - if not IsPedOnFoot(closestPed) then - GameNotification(_U('in_vehicle_give', itemSelected.label)) - return - end - - local ammo = GetAmmoInPedWeapon(plyPed, itemSelected.hash) - - if ammo <= 0 then - GameNotification(_U('no_ammo')) - return - end - - if quantity > ammo then - GameNotification(_U('not_enough_ammo')) - return - end - - local finalAmmo = math.floor(ammo - quantity) - SetPedAmmo(plyPed, itemSelected.name, finalAmmo) - - TriggerServerEvent('bpt_menu:Weapon_addAmmoToPedS', GetPlayerServerId(closestPlayer), itemSelected.name, quantity) - GameNotification(_U('gave_ammo', quantity, GetPlayerName(closestPlayer))) - RageUI.CloseAll() - end) - - RageUI.Button(_U('loadout_drop_button'), "", {RightBadge = RageUI.BadgeStyle.Alert}, true, function(Hovered, Active, Selected) - if not Selected then return end - - local itemSelected = PersonalMenu.ItemSelected - - if not IsPedOnFoot(plyPed) then - GameNotification(_U('in_vehicle_drop', itemSelected.label)) - return - end - - TriggerServerEvent('esx:removeInventoryItem', 'item_weapon', itemSelected.name) - RageUI.CloseAll() - end) - end - end) -end - -getPersonalMenuCategory('inventory').drawer = function() - local inventory = GetPlayerInventory() - - for i = 1, #inventory do - local invItem = inventory[i] - - if invItem.count > 0 then - local invCount = {} - for j = 1, invItem.count do invCount[j] = j end - - RageUI.List(('%s (%u)'):format(invItem.label, invItem.count), invCount, PersonalMenu.ItemIndex[invItem.name] or 1, nil, nil, true, function(Hovered, Active, Selected, Index) - PersonalMenu.ItemIndex[invItem.name] = Index - - if not Selected then return end - PersonalMenu.ItemSelected = invItem - end, inventoryActionsMenu) - end - end -end - -getPersonalMenuCategory('loadout').drawer = function() - for i = 1, #PersonalMenu.WeaponData do - local weaponData = PersonalMenu.WeaponData[i] - - if HasPedGotWeapon(plyPed, weaponData.hash, false) then - local ammo = GetAmmoInPedWeapon(plyPed, weaponData.hash) - - RageUI.Button(('%s [%u]'):format(weaponData.label, ammo), nil, {RightLabel = "→→→"}, true, function(Hovered, Active, Selected) - if not Selected then return end - PersonalMenu.ItemSelected = weaponData - end, loadoutActionsMenu) - end - end -end - -local accountInPockets = { - ['money'] = 'wallet_money_button', - ['black_money'] = 'wallet_blackmoney_button' -} - -getPersonalMenuCategory('wallet').drawer = function() - local playerJob = GetPlayerJob() - RageUI.Button(_U('wallet_job_button', playerJob.name, playerJob.gradeName), nil, nil, true, nil) - - if Config.DoubleJob then - local playerJob2 = GetPlayerJob2() - RageUI.Button(_U('wallet_job2_button', playerJob2.name, playerJob2.gradeName), nil, nil, true, nil) - end - - local playerAccounts = GetPlayerAccounts() - for i = 1, #playerAccounts do - local account = playerAccounts[i] - - if accountInPockets[account.name] then - if PersonalMenu.WalletIndex[account.name] == nil then PersonalMenu.WalletIndex[account.name] = 1 end - - RageUI.List(_U(accountInPockets[account.name], GroupDigits(account.money)), PersonalMenu.WalletList, PersonalMenu.WalletIndex[account.name] or 1, nil, nil, true, function(Hovered, Active, Selected, Index) - if not Selected then return end - - if Index == 1 then - local post, quantity = CheckQuantity(KeyboardInput('PM_BOX_AMOUNT', _U('dialogbox_amount'), '', 8)) - - if post then - local closestPlayer, closestDistance = GetClosestPlayer() - if closestDistance == -1 or closestDistance > 3 then - GameNotification(_U('players_nearby')) - return - end - - local closestPed = GetPlayerPed(closestPlayer) - - if not IsPedSittingInAnyVehicle(closestPed) then - TriggerServerEvent('esx:giveInventoryItem', GetPlayerServerId(closestPlayer), 'item_account', account.name, quantity) - RageUI.CloseAll() - else - GameNotification(_U('in_vehicle_give', 'de l\'argent')) - end - else - GameNotification(_U('amount_invalid')) - end - elseif Index == 2 then - local post, quantity = CheckQuantity(KeyboardInput('PM_BOX_AMOUNT', _U('dialogbox_amount'), '', 8)) - - if post then - if not IsPedSittingInAnyVehicle(plyPed) then - TriggerServerEvent('esx:removeInventoryItem', 'item_account', account.name, quantity) - RageUI.CloseAll() - else - GameNotification(_U('in_vehicle_drop', 'de l\'argent')) - end - else - GameNotification(_U('amount_invalid')) - end - end - - PersonalMenu.WalletIndex[account.name] = Index - end) - elseif account.name == 'bank' then - RageUI.Button(_U('wallet_bankmoney_button', GroupDigits(account.money)), nil, nil, true, nil) - end - end - - if Config.JSFourIDCard then - RageUI.Button(_U('wallet_show_idcard_button'), nil, nil, true, function(Hovered, Active, Selected) - if not Selected then return end - - local closestPlayer, closestDistance = GetClosestPlayer() - - if closestDistance ~= -1 and closestDistance <= 3.0 then - TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(closestPlayer)) - else - GameNotification(_U('players_nearby')) - end - end) - - RageUI.Button(_U('wallet_check_idcard_button'), nil, nil, true, function(_, _, Selected) - if not Selected then return end - TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(PlayerId())) - end) - - RageUI.Button(_U('wallet_show_driver_button'), nil, nil, true, function(_, _, Selected) - if not Selected then return end - - local closestPlayer, closestDistance = GetClosestPlayer() - - if closestDistance ~= -1 and closestDistance <= 3.0 then - TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(closestPlayer), 'driver') - else - GameNotification(_U('players_nearby')) - end - end) - - RageUI.Button(_U('wallet_check_driver_button'), nil, nil, true, function(_, _, Selected) - if not Selected then return end - TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(PlayerId()), 'driver') - end) - - RageUI.Button(_U('wallet_show_firearms_button'), nil, nil, true, function(_, _, Selected) - if not Selected then return end - - local closestPlayer, closestDistance = GetClosestPlayer() - - if closestDistance ~= -1 and closestDistance <= 3.0 then - TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(closestPlayer), 'weapon') - else - GameNotification(_U('players_nearby')) - end - end) - - RageUI.Button(_U('wallet_check_firearms_button'), nil, nil, true, function(_, _, Selected) - if not Selected then return end - TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(PlayerId()), 'weapon') - end) - end -end - getPersonalMenuCategory('billing').drawer = function() for i = 1, #PersonalMenu.BillData do local billData = PersonalMenu.BillData[i] @@ -1071,7 +724,7 @@ end, false) RegisterCommand('-openpersonal', function() end, false) -RegisterKeyMapping('+openpersonal', 'Ouvrir le menu personnel', 'KEYBOARD', Config.Controls.OpenMenu.keyboard) +RegisterKeyMapping('+openpersonal', 'Open personal menu', 'KEYBOARD', Config.Controls.OpenMenu.keyboard) TriggerEvent('chat:removeSuggestion', '/+openpersonal') TriggerEvent('chat:removeSuggestion', '/-openpersonal') @@ -1084,16 +737,6 @@ CreateThread(function() goto continue end - if ruiVisible(inventoryActionsMenu) then - DrawActionsMenu('inventory') - goto continue - end - - if ruiVisible(loadoutActionsMenu) then - DrawActionsMenu('loadout') - goto continue - end - for i = 1, #personalMenuCategories do local pmCategory = personalMenuCategories[i] diff --git a/server-data/resources/[bpt_addons]/bpt_menu/client/utils.lua b/server-data/resources/[bpt_addons]/bpt_menu/client/utils.lua index 7b05d8417..40e744dc9 100644 --- a/server-data/resources/[bpt_addons]/bpt_menu/client/utils.lua +++ b/server-data/resources/[bpt_addons]/bpt_menu/client/utils.lua @@ -27,7 +27,6 @@ end if Config.Framework == 'esx' then local playerData = { - inventory = {}, accounts = {}, job = {} } @@ -45,20 +44,6 @@ if Config.Framework == 'esx' then job.isBoss = xPlayerJob.grade_name == 'boss' end - local function parsePlayerData(xPlayer) - playerData.inventory = xPlayer.inventory - playerData.accounts = xPlayer.accounts - parsePlayerJob(playerData.job, xPlayer.job) - - if Config.DoubleJob then - parsePlayerJob(playerData.job2, xPlayer.job2) - end - end - - function GetPlayerInventory() - return playerData.inventory - end - function GetPlayerAccounts() return playerData.accounts end @@ -122,7 +107,7 @@ if Config.Framework == 'esx' then end) AddEventHandler('bpt_menu:menuOpening', function() - parsePlayerData(ESX.GetPlayerData()) + ESX.GetPlayerData() end) RegisterNetEvent('esx_addonaccount:setMoney', function(societyId, money) @@ -167,7 +152,5 @@ if Config.Framework == 'esx' then Wait(100) end end - - parsePlayerData(ESX.GetPlayerData()) end) end \ No newline at end of file diff --git a/server-data/resources/[bpt_addons]/bpt_menu/locales/it.lua b/server-data/resources/[bpt_addons]/bpt_menu/locales/it.lua index 3b1f47a2d..aa592850d 100644 --- a/server-data/resources/[bpt_addons]/bpt_menu/locales/it.lua +++ b/server-data/resources/[bpt_addons]/bpt_menu/locales/it.lua @@ -32,34 +32,6 @@ Locales['it'] = { ['admin_nomarker'] = 'Nessun indicatore sulla mappa!', ['mainmenu_subtitle'] = 'MENU INTERAZIONE', ['approach'] = 'Approccio: ~b~%s', - ['voice'] = 'Voce: ~b~%s', - ['voice_whisper'] = 'Sussurro', - ['voice_normal'] = 'Normale', - ['voice_cry'] = 'Urlo', - ['inventory_title'] = 'Inventario', - ['inventory_actions_title'] = 'Inventario: Azioni', - ['inventory_use_button'] = 'Usa', - ['inventory_give_button'] = 'Dai', - ['inventory_drop_button'] = 'Butta', - ['loadout_title'] = 'Gestione armi', - ['loadout_actions_title'] = 'Armi: Azioni', - ['loadout_give_button'] = 'Dai', - ['loadout_givemun_button'] = 'Dai munizioni', - ['loadout_drop_button'] = 'Butta', - ['wallet_title'] = 'Portafoglio', - ['wallet_option_give'] = 'Dai', - ['wallet_option_drop'] = 'Butta', - ['wallet_job_button'] = 'Attività commerciale:%s -%s', - ['wallet_job2_button'] = 'Organizzazione:%s -%s', - ['wallet_money_button'] = 'Denaro: €%s', - ['wallet_bankmoney_button'] = 'Banca: €%s', - ['wallet_blackmoney_button'] = 'Soldi sporchi: €%s', - ['wallet_show_idcard_button'] = 'Mostra carta d\'identità', - ['wallet_check_idcard_button'] = 'Guarda la carta d\'identità', - ['wallet_show_driver_button'] = 'Mostra patente di guida', - ['wallet_check_driver_button'] = 'Guarda patente di guida', - ['wallet_show_firearms_button'] = 'Mostra porto d\'armi', - ['wallet_check_firearms_button'] = 'Guarda porto d\'armi', ['bills_title'] = 'Fatture', ['clothes_title'] = 'Capi di abbigliamento', ['clothes_torso'] = 'Torso', @@ -180,7 +152,6 @@ Locales['it'] = { ['bossmanagement2_promote_button'] = 'Promuovi dipendente', ['bossmanagement2_demote_button'] = 'Degrada dipendente', ['mainmenu_gps_button'] = 'GPS', - ['mainmenu_voice_button'] = 'Voce', ['gps'] = 'GPS: ~b~%s', ['admin_title'] = 'Amministrazione', ['admin_goto_button'] = 'TP su Player', diff --git a/server-data/resources/[bpt_addons]/bpt_menu/server/main.lua b/server-data/resources/[bpt_addons]/bpt_menu/server/main.lua index 79798d0de..165df38f9 100644 --- a/server-data/resources/[bpt_addons]/bpt_menu/server/main.lua +++ b/server-data/resources/[bpt_addons]/bpt_menu/server/main.lua @@ -119,14 +119,6 @@ local function makeTargetedEventFunction(fn) end end --- Weapon Menu -- -RegisterServerEvent('bpt_menu:Weapon_addAmmoToPedS') -AddEventHandler('bpt_menu:Weapon_addAmmoToPedS', makeTargetedEventFunction(function(target, value, quantity) - if #(GetEntityCoords(source, false) - GetEntityCoords(target, false)) <= 3.0 then - TriggerClientEvent('bpt_menu:Weapon_addAmmoToPedC', target, value, quantity) - end -end)) - -- Admin Menu -- RegisterServerEvent('bpt_menu:Admin_BringS') AddEventHandler('bpt_menu:Admin_BringS', makeTargetedEventFunction(function(playerId, target)