SPS04

fgfg

Aug 7th, 2025
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 10.97 KB | None | 0 0
  1. -- CORE MULTIJOB
  2.  
  3. local Keys = {
  4.     ["ESC"] = 322,
  5.     ["F1"] = 288,
  6.     ["F2"] = 289,
  7.     ["F3"] = 170,
  8.     ["F5"] = 166,
  9.     ["F6"] = 167,
  10.     ["F7"] = 168,
  11.     ["F8"] = 169,
  12.     ["F9"] = 56,
  13.     ["F10"] = 57,
  14.     ["~"] = 243,
  15.     ["1"] = 157,
  16.     ["2"] = 158,
  17.     ["3"] = 160,
  18.     ["4"] = 164,
  19.     ["5"] = 165,
  20.     ["6"] = 159,
  21.     ["7"] = 161,
  22.     ["8"] = 162,
  23.     ["9"] = 163,
  24.     ["-"] = 84,
  25.     ["="] = 83,
  26.     ["BACKSPACE"] = 177,
  27.     ["TAB"] = 37,
  28.     ["Q"] = 44,
  29.     ["W"] = 32,
  30.     ["E"] = 38,
  31.     ["R"] = 45,
  32.     ["T"] = 245,
  33.     ["Y"] = 246,
  34.     ["U"] = 303,
  35.     ["P"] = 199,
  36.     ["["] = 39,
  37.     ["]"] = 40,
  38.     ["ENTER"] = 18,
  39.     ["CAPS"] = 137,
  40.     ["A"] = 34,
  41.     ["S"] = 8,
  42.     ["D"] = 9,
  43.     ["F"] = 23,
  44.     ["G"] = 47,
  45.     ["H"] = 74,
  46.     ["K"] = 311,
  47.     ["L"] = 182,
  48.     ["LEFTSHIFT"] = 21,
  49.     ["Z"] = 20,
  50.     ["X"] = 73,
  51.     ["C"] = 26,
  52.     ["V"] = 0,
  53.     ["B"] = 29,
  54.     ["N"] = 249,
  55.     ["M"] = 244,
  56.     [","] = 82,
  57.     ["."] = 81,
  58.     ["LEFTCTRL"] = 36,
  59.     ["LEFTALT"] = 19,
  60.     ["SPACE"] = 22,
  61.     ["RIGHTCTRL"] = 70,
  62.     ["HOME"] = 213,
  63.     ["PAGEUP"] = 10,
  64.     ["PAGEDOWN"] = 11,
  65.     ["DELETE"] = 178,
  66.     ["LEFT"] = 174,
  67.     ["RIGHT"] = 175,
  68.     ["TOP"] = 27,
  69.     ["DOWN"] = 173,
  70.     ["NENTER"] = 201,
  71.     ["N4"] = 108,
  72.     ["N5"] = 60,
  73.     ["N6"] = 107,
  74.     ["N+"] = 96,
  75.     ["N-"] = 97,
  76.     ["N7"] = 117,
  77.     ["N8"] = 61,
  78.     ["N9"] = 118
  79. }
  80.  
  81. local ESX = exports["es_extended"]:getSharedObject()
  82.  
  83. local job = "unemployed"
  84. local grade = 0
  85.  
  86. Citizen.CreateThread(function()
  87.     while not ESX do
  88.         Citizen.Wait(100)
  89.     end
  90.     while not ESX.GetPlayerData().job do
  91.         Citizen.Wait(100)
  92.     end
  93.     local pdata = ESX.GetPlayerData().job
  94.     job, grade = pdata.name, pdata.grade
  95. end)
  96.  
  97.  
  98. RegisterNetEvent("esx:setJob")
  99. AddEventHandler(
  100.     "esx:setJob",
  101.     function(j)
  102.         job = j.name
  103.         grade = j.grade
  104.        
  105.     end
  106. )
  107.  
  108. function openCenter()
  109.    
  110.             TriggerScreenblurFadeIn(1000)
  111.  
  112.             SetNuiFocus(true, true)
  113.             SendNUIMessage(
  114.                 {
  115.                     type = "openCenter",
  116.                     job = {job = job, grade = grade},
  117.                     center = json.encode(Config.DefaultJobsInJobCenter)
  118.                 }
  119.            
  120.     )
  121. end
  122.  
  123. function openBossMenu(j, l)
  124.     ESX.TriggerServerCallback(
  125.         "core_jobutilities:getBossMenuData",
  126.         function(grades, employees, fund, gradename)
  127.             if Config.BossMenuUsers[gradename] ~= nil and job == j then
  128.                 SetNuiFocus(true, true)
  129.                 SendNUIMessage(
  130.                     {
  131.                         type = "openBoss",
  132.                         job = {job = job, grade = grade},
  133.                         employees = employees,
  134.                         grades = grades,
  135.                         fund = fund,
  136.                         bossJob = j,
  137.                         bossLabel = l,
  138.                         perms = Config.BossMenuUsers[gradename]
  139.                     }
  140.                 )
  141.             else
  142.                 SendTextMessage(Config.Text["cant_access_bossmenu"])
  143.             end
  144.         end,
  145.         j
  146.     )
  147. end
  148.  
  149. -- RegisterCommand('bossmenu',function()
  150. --     function openBossMenu(j, l)
  151. --         ESX.TriggerServerCallback(
  152. --             "core_jobutilities:getBossMenuData",
  153. --             function(grades, employees, fund, gradename)
  154. --                 if Config.BossMenuUsers[gradename] ~= nil and job == j then
  155. --                     SetNuiFocus(true, true)
  156. --                     SendNUIMessage(
  157. --                         {
  158. --                             type = "openBoss",
  159. --                             job = {job = job, grade = grade},
  160. --                             employees = employees,
  161. --                             grades = grades,
  162. --                             fund = fund,
  163. --                             bossJob = j,
  164. --                             bossLabel = l,
  165. --                             perms = Config.BossMenuUsers[gradename]
  166. --                         }
  167. --                     )
  168. --                 else
  169. --                     SendTextMessage(Config.Text["cant_access_bossmenu"])
  170. --                 end
  171. --             end,
  172. --             j
  173. --         )
  174. --     end
  175.  
  176.    
  177. -- end)        
  178.                    
  179.  
  180.  
  181.  
  182. Citizen.CreateThread(
  183.     function()
  184.         for _, v in ipairs(Config.LocationsJobCenters) do
  185.             if v.blip then
  186.                 local blip = AddBlipForCoord(v.coords)
  187.  
  188.                 SetBlipSprite(blip, Config.BlipCenterSprite)
  189.                 SetBlipScale(blip, 0.8)
  190.                 SetBlipColour(blip, Config.BlipCenterColor)
  191.                 SetBlipAsShortRange(blip, true)
  192.  
  193.                 BeginTextCommandSetBlipName("STRING")
  194.                 AddTextComponentString(Config.BlipCenterText)
  195.                 EndTextCommandSetBlipName(blip)
  196.             end
  197.         end
  198.  
  199.         while #Config.LocationsJobCenters > 0 do
  200.             Citizen.Wait(0)
  201.             local coords = GetEntityCoords(PlayerPedId())
  202.             for _, v in ipairs(Config.LocationsJobCenters) do
  203.                 local dist = #(coords - v.coords)
  204.  
  205.                 if dist < 20 then
  206.                     DrawMarker(
  207.                         Config.MarkerSprite,
  208.                         v.coords[1],
  209.                         v.coords[2],
  210.                         v.coords[3] - 0.95,
  211.                         0.0,
  212.                         0.0,
  213.                         0.0,
  214.                         0.0,
  215.                         0.0,
  216.                         0.0,
  217.                         Config.MarkerSize,
  218.                         Config.MarkerSize,
  219.                         1.0,
  220.                         Config.MarkerColor[1],
  221.                         Config.MarkerColor[2],
  222.                         Config.MarkerColor[3],
  223.                         100,
  224.                         false,
  225.                         true,
  226.                         2,
  227.                         true,
  228.                         false,
  229.                         false,
  230.                         false
  231.                     )
  232.                 end
  233.                 if dist < Config.MarkerSize then
  234.                     DrawText3D(v.coords[1], v.coords[2], v.coords[3], Config.Text["open_jobcenter_ui_hologram"])
  235.  
  236.                     if IsControlJustReleased(0, Keys["E"]) then
  237.                         openCenter()
  238.                     end
  239.                 end
  240.             end
  241.         end
  242.     end
  243. )
  244.  
  245. Citizen.CreateThread(
  246.     function()
  247.         while #Config.BossMenuLocations > 0 do
  248.             Citizen.Wait(0)
  249.             local coords = GetEntityCoords(PlayerPedId())
  250.             for _, v in ipairs(Config.BossMenuLocations) do
  251.                 local dist = #(coords - v.coords)
  252.  
  253.                 if dist < 20 then
  254.                     DrawMarker(
  255.                         Config.MarkerSprite,
  256.                         v.coords[1],
  257.                         v.coords[2],
  258.                         v.coords[3] - 0.95,
  259.                         0.0,
  260.                         0.0,
  261.                         0.0,
  262.                         0.0,
  263.                         0.0,
  264.                         0.0,
  265.                         Config.MarkerSize,
  266.                         Config.MarkerSize,
  267.                         1.0,
  268.                         Config.MarkerColor[1],
  269.                         Config.MarkerColor[2],
  270.                         Config.MarkerColor[3],
  271.                         100,
  272.                         false,
  273.                         true,
  274.                         2,
  275.                         true,
  276.                         false,
  277.                         false,
  278.                         false
  279.                     )
  280.                 end
  281.                 if dist < Config.MarkerSize then
  282.                     DrawText3D(v.coords[1], v.coords[2], v.coords[3], Config.Text["bossmenu_hologram"])
  283.  
  284.                     if IsControlJustReleased(0, Keys["E"]) then
  285.                         openBossMenu(v.job, v.label)
  286.                     end
  287.                 end
  288.             end
  289.         end
  290.     end
  291. )
  292.  
  293.  
  294.  
  295.  
  296.  
  297. RegisterNUICallback(
  298.     "close",
  299.     function(data)
  300.         TriggerScreenblurFadeOut(1000)
  301.         SetNuiFocus(false, false)
  302.     end
  303. )
  304.  
  305. RegisterNUICallback(
  306.     "deposit",
  307.     function(data)
  308.         local job = data["job"]
  309.         local amount = data["amount"]
  310.  
  311.         TriggerServerEvent("core_jobutilities:deposit", job, amount)
  312.     end
  313. )
  314.  
  315. RegisterNUICallback(
  316.     "withdraw",
  317.     function(data)
  318.         local job = data["job"]
  319.         local amount = data["amount"]
  320.  
  321.         TriggerServerEvent("core_jobutilities:withdraw", job, amount)
  322.     end
  323. )
  324.  
  325. RegisterNUICallback(
  326.     "hire",
  327.     function(data)
  328.         local id = data["id"]
  329.         local job = data["job"]
  330.  
  331.         TriggerServerEvent("core_jobutilities:hire", id, job)
  332.     end
  333. )
  334.  
  335. RegisterNUICallback(
  336.     "fire",
  337.     function(data)
  338.         local identifier = data["identifier"]
  339.         local job = data["job"]
  340.  
  341.         TriggerServerEvent("core_jobutilities:fire", identifier, job)
  342.     end
  343. )
  344.  
  345. RegisterNUICallback(
  346.     "givebonus",
  347.     function(data)
  348.         local identifier = data["identifier"]
  349.         local amount = data["amount"]
  350.          local job = data["job"]
  351.  
  352.         TriggerServerEvent("core_jobutilities:givebonus", identifier, amount, job)
  353.     end
  354. )
  355.  
  356. RegisterNUICallback(
  357.     "setrank",
  358.     function(data)
  359.         local identifier = data["identifier"]
  360.         local job = data["job"]
  361.         local rank = data["rank"]
  362.  
  363.         TriggerServerEvent("core_jobutilities:setRank", identifier, job, rank)
  364.     end
  365. )
  366.  
  367. RegisterNUICallback(
  368.     "removejob",
  369.     function(data)
  370.         TriggerServerEvent("core_jobutilities:removeJob", data["job"], data["grade"])
  371.     end
  372. )
  373.  
  374. RegisterNUICallback(
  375.     "addjob",
  376.     function(data)
  377.         TriggerServerEvent("core_jobutilities:addJob", data["job"])
  378.     end
  379. )
  380.  
  381. RegisterNUICallback(
  382.     "changejob",
  383.     function(data)
  384.         TriggerServerEvent("core_jobutilities:changeJob", data["job"], data["grade"])
  385.     end
  386. )
  387.  
  388.  
  389. RegisterNetEvent("core_jobutilities:sendMessage")
  390. AddEventHandler(
  391.     "core_jobutilities:sendMessage",
  392.     function(msg)
  393.         SendTextMessage(msg)
  394.     end
  395. )
  396.  
  397. function DrawText3D(x, y, z, text)
  398.     local onScreen, _x, _y = World3dToScreen2d(x, y, z)
  399.     local px, py, pz = table.unpack(GetGameplayCamCoord())
  400.     local dist = GetDistanceBetweenCoords(px, py, pz, x, y, z, 1)
  401.  
  402.     local scale = ((1 / dist) * 2) * (1 / GetGameplayCamFov()) * 100
  403.  
  404.     if onScreen then
  405.         SetTextColour(255, 255, 255, 255)
  406.         SetTextScale(0.0 * scale, 0.35 * scale)
  407.         SetTextFont(4)
  408.         SetTextProportional(1)
  409.         SetTextCentre(true)
  410.  
  411.         SetTextDropshadow(1, 1, 1, 1, 255)
  412.  
  413.         BeginTextCommandWidth("STRING")
  414.         AddTextComponentString(text)
  415.         local height = GetTextScaleHeight(0.55 * scale, 4)
  416.         local width = EndTextCommandGetWidth(4)
  417.  
  418.         SetTextEntry("STRING")
  419.         AddTextComponentString(text)
  420.         EndTextCommandDisplayText(_x, _y)
  421.     end
  422. end
  423.  
Advertisement
Add Comment
Please, Sign In to add comment