diff --git a/server-data/resources/[bpt_addons]/bpt_billing/client/main.lua b/server-data/resources/[bpt_addons]/bpt_billing/client/main.lua index 145f48678..4d9e6a973 100644 --- a/server-data/resources/[bpt_addons]/bpt_billing/client/main.lua +++ b/server-data/resources/[bpt_addons]/bpt_billing/client/main.lua @@ -16,9 +16,15 @@ function ShowBillsMenu() end ESX.OpenContext("right", elements, function(menu, element) - ESX.TriggerServerCallback("bpt_billing:payBill", function() + local billId = element.billId + + ESX.TriggerServerCallback("bpt_billing:payBill", function(resp) + if resp == true then + TriggerEvent("bpt_billing:paidBill", billId) + end + ShowBillsMenu() - end, element.billId) + end, billId) end) else ESX.ShowNotification(TranslateCap("no_invoices")) diff --git a/server-data/resources/[bpt_addons]/bpt_billing/server/main.lua b/server-data/resources/[bpt_addons]/bpt_billing/server/main.lua index 3458cc6c1..ea4fa4cf7 100644 --- a/server-data/resources/[bpt_addons]/bpt_billing/server/main.lua +++ b/server-data/resources/[bpt_addons]/bpt_billing/server/main.lua @@ -1,31 +1,69 @@ -RegisterNetEvent("bpt_billing:sendBill", function(playerId, sharedAccountName, label, amount) - local xPlayer = ESX.GetPlayerFromId(source) - local xTarget = ESX.GetPlayerFromId(playerId) +function BillPlayerByIdentifier(targetIdentifier, senderIdentifier, sharedAccountName, label, amount) + local xTarget = ESX.GetPlayerFromIdentifier(targetIdentifier) amount = ESX.Math.Round(amount) - if amount > 0 and xTarget then + if amount > 0 then if string.match(sharedAccountName, "society_") then - local jobName = string.gsub(sharedAccountName, "society_", "") - if xPlayer.job.name ~= jobName then - print(("[^2ERROR^7] Player ^5%s^7 Attempted to Send bill from a society (^5%s^7), but does not have the correct Job - Possibly Cheats"):format(xPlayer.source, sharedAccountName)) - return - end TriggerEvent("bpt_addonaccount:getSharedAccount", sharedAccountName, function(account) if account then - MySQL.insert("INSERT INTO billing (identifier, sender, target_type, target, label, amount) VALUES (?, ?, ?, ?, ?, ?)", { xTarget.identifier, xPlayer.identifier, "society", sharedAccountName, label, amount }, function(rowsChanged) + MySQL.insert("INSERT INTO billing (identifier, sender, target_type, target, label, amount) VALUES (?, ?, ?, ?, ?, ?)", { targetIdentifier, senderIdentifier, "society", sharedAccountName, label, amount }, function(rowsChanged) + if not xTarget then + return + end + xTarget.showNotification(TranslateCap("received_invoice")) end) else - print(("[^2ERROR^7] Player ^5%s^7 Attempted to Send bill from invalid society - ^5%s^7"):format(xPlayer.source, sharedAccountName)) + print(("[^2ERROR^7] Player ^5%s^7 Attempted to Send bill from invalid society - ^5%s^7"):format(senderIdentifier, sharedAccountName)) end end) else - MySQL.insert("INSERT INTO billing (identifier, sender, target_type, target, label, amount) VALUES (?, ?, ?, ?, ?, ?)", { xTarget.identifier, xPlayer.identifier, "player", xPlayer.identifier, label, amount }, function(rowsChanged) + MySQL.insert("INSERT INTO billing (identifier, sender, target_type, target, label, amount) VALUES (?, ?, ?, ?, ?, ?)", { targetIdentifier, senderIdentifier, "player", senderIdentifier, label, amount }, function(rowsChanged) + if not xTarget then + return + end + xTarget.showNotification(TranslateCap("received_invoice")) end) end end +end + +function BillPlayer(targetId, senderIdentifier, sharedAccountName, label, amount) + local xTarget = ESX.GetPlayerFromId(targetId) + + if not xTarget then + return + end + + BillPlayerByIdentifier(xTarget.identifier, senderIdentifier, sharedAccountName, label, amount) +end + +RegisterNetEvent("bpt_billing:sendBill", function(targetId, sharedAccountName, label, amount) + local xPlayer = ESX.GetPlayerFromId(source) + local jobName = string.gsub(sharedAccountName, "society_", "") + + if xPlayer.job.name ~= jobName then + print(("[^2ERROR^7] Player ^5%s^7 Attempted to Send bill from a society (^5%s^7), but does not have the correct Job - Possibly Cheats"):format(xPlayer.source, sharedAccountName)) + return + end + + BillPlayer(targetId, xPlayer.identifier, sharedAccountName, label, amount) end) +exports("BillPlayer", BillPlayer) + +RegisterNetEvent("bpt_billing:sendBillToIdentifier", function(targetIdentifier, sharedAccountName, label, amount) + local xPlayer = ESX.GetPlayerFromId(source) + local jobName = string.gsub(sharedAccountName, "society_", "") + + if xPlayer.job.name ~= jobName then + print(("[^2ERROR^7] Player ^5%s^7 Attempted to Send bill from a society (^5%s^7), but does not have the correct Job - Possibly Cheats"):format(xPlayer.source, sharedAccountName)) + return + end + + BillPlayerByIdentifier(targetIdentifier, xPlayer.identifier, sharedAccountName, label, amount) +end) +exports("BillPlayerByIdentifier", BillPlayerByIdentifier) ESX.RegisterServerCallback("bpt_billing:getBills", function(source, cb) local xPlayer = ESX.GetPlayerFromId(source) @@ -62,33 +100,35 @@ ESX.RegisterServerCallback("bpt_billing:payBill", function(source, cb, billId) if rowsChanged == 1 then xPlayer.removeMoney(amount, "Bill Paid") xTarget.addMoney(amount, "Paid bill") - + TriggerEvent("bpt_billing:paidBill", source, billId) xPlayer.showNotification(TranslateCap("paid_invoice", ESX.Math.GroupDigits(amount))) xTarget.showNotification(TranslateCap("received_payment", ESX.Math.GroupDigits(amount))) + cb(true) + else + cb(false) end - - cb() end) elseif xPlayer.getAccount("bank").money >= amount then MySQL.update("DELETE FROM billing WHERE id = ?", { billId }, function(rowsChanged) if rowsChanged == 1 then xPlayer.removeAccountMoney("bank", amount, "Bill Paid") xTarget.addAccountMoney("bank", amount, "Paid bill") - + TriggerEvent("bpt_billing:paidBill", source, billId) xPlayer.showNotification(TranslateCap("paid_invoice", ESX.Math.GroupDigits(amount))) xTarget.showNotification(TranslateCap("received_payment", ESX.Math.GroupDigits(amount))) + cb(true) + else + cb(false) end - - cb() end) else xTarget.showNotification(TranslateCap("target_no_money")) xPlayer.showNotification(TranslateCap("no_money")) - cb() + cb(false) end else xPlayer.showNotification(TranslateCap("player_not_online")) - cb() + cb(false) end else TriggerEvent("bpt_addonaccount:getSharedAccount", result.target, function(account) @@ -97,14 +137,15 @@ ESX.RegisterServerCallback("bpt_billing:payBill", function(source, cb, billId) if rowsChanged == 1 then xPlayer.removeMoney(amount, "Bill Paid") account.addMoney(amount) - + TriggerEvent("bpt_billing:paidBill", source, billId) xPlayer.showNotification(TranslateCap("paid_invoice", ESX.Math.GroupDigits(amount))) if xTarget then xTarget.showNotification(TranslateCap("received_payment", ESX.Math.GroupDigits(amount))) end + cb(true) + else + cb(false) end - - cb() end) elseif xPlayer.getAccount("bank").money >= amount then MySQL.update("DELETE FROM billing WHERE id = ?", { billId }, function(rowsChanged) @@ -112,13 +153,14 @@ ESX.RegisterServerCallback("bpt_billing:payBill", function(source, cb, billId) xPlayer.removeAccountMoney("bank", amount, "Bill Paid") account.addMoney(amount) xPlayer.showNotification(TranslateCap("paid_invoice", ESX.Math.GroupDigits(amount))) - + TriggerEvent("bpt_billing:paidBill", source, billId) if xTarget then xTarget.showNotification(TranslateCap("received_payment", ESX.Math.GroupDigits(amount))) end + cb(true) + else + cb(false) end - - cb() end) else if xTarget then @@ -126,7 +168,7 @@ ESX.RegisterServerCallback("bpt_billing:payBill", function(source, cb, billId) end xPlayer.showNotification(TranslateCap("no_money")) - cb() + cb(false) end end) end diff --git a/server-data/resources/[esx_addons]/esx-qalle-jail/README.md b/server-data/resources/[esx_addons]/esx-qalle-jail/README.md index 9e646fc29..ed0d1b04c 100644 --- a/server-data/resources/[esx_addons]/esx-qalle-jail/README.md +++ b/server-data/resources/[esx_addons]/esx-qalle-jail/README.md @@ -16,9 +16,9 @@ ```lua elements = { - {label = _U('citizen_interaction'), value = 'citizen_interaction'}, - {label = _U('vehicle_interaction'), value = 'vehicle_interaction'}, - {label = _U('object_spawner'), value = 'object_spawner'}, + {label = TranslateCap('citizen_interaction'), value = 'citizen_interaction'}, + {label = TranslateCap('vehicle_interaction'), value = 'vehicle_interaction'}, + {label = TranslateCap('object_spawner'), value = 'object_spawner'}, {label = "Jail Menu", value = 'jail_menu'} -- You add this line } }, function(data, menu) diff --git a/server-data/resources/[esx_addons]/esx-qalle-jail/client/client.lua b/server-data/resources/[esx_addons]/esx-qalle-jail/client/client.lua index fce3583b2..f68d3c6ff 100644 --- a/server-data/resources/[esx_addons]/esx-qalle-jail/client/client.lua +++ b/server-data/resources/[esx_addons]/esx-qalle-jail/client/client.lua @@ -1,427 +1,393 @@ 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, - ["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, - ["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, + ["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, + ["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, } PlayerData = {} local jailTime = 0 CreateThread(function() - ESX = exports["es_extended"]:getSharedObject() - while ESX.GetPlayerData() == nil do - Wait(10) - end + ESX = exports["es_extended"]:getSharedObject() + while ESX.GetPlayerData() == nil do + Wait(10) + end - PlayerData = ESX.GetPlayerData() + PlayerData = ESX.GetPlayerData() - LoadTeleporters() + LoadTeleporters() end) RegisterNetEvent("esx:playerLoaded") AddEventHandler("esx:playerLoaded", function(newData) - PlayerData = newData - Wait(25000) + PlayerData = newData + Wait(25000) - ESX.TriggerServerCallback("esx-qalle-jail:retrieveJailTime", function(inJail, newJailTime) - if inJail then - jailTime = newJailTime + ESX.TriggerServerCallback("esx-qalle-jail:retrieveJailTime", function(inJail, newJailTime) + if inJail then + jailTime = newJailTime - JailLogin() - end - end) + JailLogin() + end + end) end) RegisterNetEvent("esx:setJob") AddEventHandler("esx:setJob", function(response) - PlayerData["job"] = response + PlayerData["job"] = response end) RegisterNetEvent("esx-qalle-jail:openJailMenu") AddEventHandler("esx-qalle-jail:openJailMenu", function() - OpenJailMenu() + OpenJailMenu() end) RegisterNetEvent("esx-qalle-jail:jailPlayer") AddEventHandler("esx-qalle-jail:jailPlayer", function(newJailTime) - jailTime = newJailTime - Cutscene() + jailTime = newJailTime + Cutscene() end) RegisterNetEvent("esx-qalle-jail:unJailPlayer") AddEventHandler("esx-qalle-jail:unJailPlayer", function() - jailTime = 0 - UnJail() + jailTime = 0 + UnJail() end) function JailLogin() - local JailPosition = Config.JailPositions["Cell"] - SetEntityCoords(PlayerPedId(), JailPosition["x"], JailPosition["y"], JailPosition["z"] - 1) - ESX.ShowNotification(_U("back_in_jail")) - InJail() + local JailPosition = Config.JailPositions["Cell"] + SetEntityCoords(PlayerPedId(), JailPosition["x"], JailPosition["y"], JailPosition["z"] - 1) + ESX.ShowNotification(TranslateCap("back_in_jail")) + InJail() end function UnJail() - InJail() - ESX.Game.Teleport(PlayerPedId(), Config.Teleports["Boiling Broke"]) + InJail() + ESX.Game.Teleport(PlayerPedId(), Config.Teleports["Boiling Broke"]) - ESX.TriggerServerCallback("esx_skin:getPlayerSkin", function(skin) - TriggerEvent("skinchanger:loadSkin", skin) - end) - ESX.ShowNotification(_U("you_released")) + ESX.TriggerServerCallback("esx_skin:getPlayerSkin", function(skin) + TriggerEvent("skinchanger:loadSkin", skin) + end) + ESX.ShowNotification(TranslateCap("you_released")) end function InJail() - --Jail Timer-- - CreateThread(function() - while jailTime > 0 do - jailTime = jailTime - 1 - ESX.ShowNotification(_U("few_minutes")) - - TriggerServerEvent("esx-qalle-jail:updateJailTime", jailTime) - if jailTime == 0 then - UnJail() - TriggerServerEvent("esx-qalle-jail:updateJailTime", 0) - end - - Wait(60000) - end - end) - --Jail Timer-- - - --Prison Work-- - CreateThread(function() - while jailTime > 0 do - local sleepThread = 500 - local Packages = Config.PrisonWork["Packages"] - local Ped = PlayerPedId() - local PedCoords = GetEntityCoords(Ped) - - for posId, v in pairs(Packages) do - local DistanceCheck = GetDistanceBetweenCoords(PedCoords, v["x"], v["y"], v["z"], true) - - if DistanceCheck <= 10.0 then - sleepThread = 5 - - local PackageText = "Pack" - - if not v["state"] then - PackageText = "Already Taken" - end - - ESX.Game.Utils.DrawText3D(v, "[E] " .. PackageText, 0.4) - - if DistanceCheck <= 1.5 then - if IsControlJustPressed(0, 38) then - if v["state"] then - PackPackage(posId) - else - ESX.ShowNotification(_U("package_taken")) - end - end - end - end - end - Wait(sleepThread) - end - end) - --Prison Work-- + --Jail Timer-- + CreateThread(function() + while jailTime > 0 do + jailTime = jailTime - 1 + ESX.ShowNotification(TranslateCap("few_minutes")) + + TriggerServerEvent("esx-qalle-jail:updateJailTime", jailTime) + if jailTime == 0 then + UnJail() + TriggerServerEvent("esx-qalle-jail:updateJailTime", 0) + end + + Wait(60000) + end + end) + --Jail Timer-- + + --Prison Work-- + CreateThread(function() + while jailTime > 0 do + local sleepThread = 500 + local Packages = Config.PrisonWork["Packages"] + local Ped = PlayerPedId() + local PedCoords = GetEntityCoords(Ped) + + for posId, v in pairs(Packages) do + local DistanceCheck = GetDistanceBetweenCoords(PedCoords, v["x"], v["y"], v["z"], true) + + if DistanceCheck <= 10.0 then + sleepThread = 5 + + local PackageText = "Pack" + + if not v["state"] then + PackageText = "Already Taken" + end + + ESX.Game.Utils.DrawText3D(v, "[E] " .. PackageText, 0.4) + + if DistanceCheck <= 1.5 then + if IsControlJustPressed(0, 38) then + if v["state"] then + PackPackage(posId) + else + ESX.ShowNotification(TranslateCap("package_taken")) + end + end + end + end + end + Wait(sleepThread) + end + end) + --Prison Work-- end function LoadTeleporters() - CreateThread(function() - while true do - local sleepThread = 500 - local Ped = PlayerPedId() - local PedCoords = GetEntityCoords(Ped) - - for _, v in pairs(Config.Teleports) do - local DistanceCheck = GetDistanceBetweenCoords(PedCoords, v["x"], v["y"], v["z"], true) - - if DistanceCheck <= 7.5 then - sleepThread = 5 - - ESX.Game.Utils.DrawText3D(v, "[E] Open Door", 0.4) - - if DistanceCheck <= 1.0 then - if IsControlJustPressed(0, 38) then - TeleportPlayer(v) - end - end - end - end - Wait(sleepThread) - end - end) + CreateThread(function() + while true do + local sleepThread = 500 + local Ped = PlayerPedId() + local PedCoords = GetEntityCoords(Ped) + + for _, v in pairs(Config.Teleports) do + local DistanceCheck = GetDistanceBetweenCoords(PedCoords, v["x"], v["y"], v["z"], true) + + if DistanceCheck <= 7.5 then + sleepThread = 5 + + ESX.Game.Utils.DrawText3D(v, "[E] Open Door", 0.4) + + if DistanceCheck <= 1.0 then + if IsControlJustPressed(0, 38) then + TeleportPlayer(v) + end + end + end + end + Wait(sleepThread) + end + end) end function PackPackage(packageId) - local Package = Config.PrisonWork["Packages"][packageId] + local Package = Config.PrisonWork["Packages"][packageId] - LoadModel("prop_cs_cardbox_01") + LoadModel("prop_cs_cardbox_01") - local PackageObject = CreateObject(GetHashKey("prop_cs_cardbox_01"), Package["x"], Package["y"], Package["z"], true) + local PackageObject = CreateObject(GetHashKey("prop_cs_cardbox_01"), Package["x"], Package["y"], Package["z"], true) - PlaceObjectOnGroundProperly(PackageObject) + PlaceObjectOnGroundProperly(PackageObject) - TaskStartScenarioInPlace(PlayerPedId(), "PROP_HUMAN_BUM_BIN", 0, false) + TaskStartScenarioInPlace(PlayerPedId(), "PROP_HUMAN_BUM_BIN", 0, false) - local Packaging = true - local StartTime = GetGameTimer() + local Packaging = true + local StartTime = GetGameTimer() - while Packaging do - Wait(1) + while Packaging do + Wait(1) - local TimeToTake = 60000 * 1.20 -- Minutes - local PackPercent = (GetGameTimer() - StartTime) / TimeToTake * 100 + local TimeToTake = 60000 * 1.20 -- Minutes + local PackPercent = (GetGameTimer() - StartTime) / TimeToTake * 100 - if not IsPedUsingScenario(PlayerPedId(), "PROP_HUMAN_BUM_BIN") then - DeleteEntity(PackageObject) - ESX.ShowNotification(_U("canceled")) - Packaging = false - end + if not IsPedUsingScenario(PlayerPedId(), "PROP_HUMAN_BUM_BIN") then + DeleteEntity(PackageObject) + ESX.ShowNotification(TranslateCap("canceled")) + Packaging = false + end - if PackPercent >= 100 then - Packaging = false - DeliverPackage(PackageObject) - Package["state"] = false - else - ESX.Game.Utils.DrawText3D(Package, "Packaging... " .. math.ceil(tonumber(PackPercent)) .. "%", 0.4) - end - end + if PackPercent >= 100 then + Packaging = false + DeliverPackage(PackageObject) + Package["state"] = false + else + ESX.Game.Utils.DrawText3D(Package, "Packaging... " .. math.ceil(tonumber(PackPercent)) .. "%", 0.4) + end + end end function DeliverPackage(packageId) - if DoesEntityExist(packageId) then - AttachEntityToEntity( - packageId, - PlayerPedId(), - GetPedBoneIndex(PlayerPedId(), 28422), - 0.0, - -0.03, - 0.0, - 5.0, - 0.0, - 0.0, - 1, - 1, - 0, - 1, - 0, - 1 - ) - - ClearPedTasks(PlayerPedId()) - else - return - end - - local Packaging = true - - LoadAnim("anim@heists@box_carry@") - - while Packaging do - Wait(5) - - if not IsEntityPlayingAnim(PlayerPedId(), "anim@heists@box_carry@", "idle", 3) then - TaskPlayAnim(PlayerPedId(), "anim@heists@box_carry@", "idle", 8.0, 8.0, -1, 50, 0, false, false, false) - end - - if not IsEntityAttachedToEntity(packageId, PlayerPedId()) then - Packaging = false - DeleteEntity(packageId) - else - local DeliverPosition = Config.PrisonWork["DeliverPackage"] - local PedPosition = GetEntityCoords(PlayerPedId()) - local DistanceCheck = GetDistanceBetweenCoords( - PedPosition, - DeliverPosition["x"], - DeliverPosition["y"], - DeliverPosition["z"], - true - ) - - ESX.Game.Utils.DrawText3D(DeliverPosition, "[E] Leave Package", 0.4) - - if DistanceCheck <= 2.0 then - if IsControlJustPressed(0, 38) then - DeleteEntity(packageId) - ClearPedTasksImmediately(PlayerPedId()) - Packaging = false - - TriggerServerEvent("esx-qalle-jail:prisonWorkReward") - end - end - end - end + if DoesEntityExist(packageId) then + AttachEntityToEntity(packageId, PlayerPedId(), GetPedBoneIndex(PlayerPedId(), 28422), 0.0, -0.03, 0.0, 5.0, 0.0, 0.0, 1, 1, 0, 1, 0, 1) + + ClearPedTasks(PlayerPedId()) + else + return + end + + local Packaging = true + + LoadAnim("anim@heists@box_carry@") + + while Packaging do + Wait(5) + + if not IsEntityPlayingAnim(PlayerPedId(), "anim@heists@box_carry@", "idle", 3) then + TaskPlayAnim(PlayerPedId(), "anim@heists@box_carry@", "idle", 8.0, 8.0, -1, 50, 0, false, false, false) + end + + if not IsEntityAttachedToEntity(packageId, PlayerPedId()) then + Packaging = false + DeleteEntity(packageId) + else + local DeliverPosition = Config.PrisonWork["DeliverPackage"] + local PedPosition = GetEntityCoords(PlayerPedId()) + local DistanceCheck = GetDistanceBetweenCoords(PedPosition, DeliverPosition["x"], DeliverPosition["y"], DeliverPosition["z"], true) + + ESX.Game.Utils.DrawText3D(DeliverPosition, "[E] Leave Package", 0.4) + + if DistanceCheck <= 2.0 then + if IsControlJustPressed(0, 38) then + DeleteEntity(packageId) + ClearPedTasksImmediately(PlayerPedId()) + Packaging = false + + TriggerServerEvent("esx-qalle-jail:prisonWorkReward") + end + end + end + end end function OpenJailMenu() - ESX.UI.Menu.Open("default", GetCurrentResourceName(), "jail_prison_menu", { - title = "Prison Menu", - align = "center", - elements = { - { label = "Jail Closest Person", value = "jail_closest_player" }, - { label = "Unjail Person", value = "unjail_player" }, - }, - }, function(data, menu) - local action = data.current.value - - if action == "jail_closest_player" then - menu.close() - - ESX.UI.Menu.Open("dialog", GetCurrentResourceName(), "jail_choose_time_menu", { - title = "Jail Time (minutes)", - }, function(data2, menu2) - local jailTime = tonumber(data2.value) - if jailTime == nil then - ESX.ShowNotification(_U("time_minutes")) - else - menu2.close() - local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() - - if closestPlayer == -1 or closestDistance > 3.0 then - ESX.ShowNotification(_U("players_nearby")) - else - ESX.UI.Menu.Open("dialog", GetCurrentResourceName(), "jail_choose_reason_menu", { - title = "Jail Reason", - }, function(data3, menu3) - local reason = data3.value - if reason == nil then - ESX.ShowNotification(_U("put_something")) - else - menu3.close() - local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() - if closestPlayer == -1 or closestDistance > 3.0 then - ESX.ShowNotification(_U("players_nearby")) - else - TriggerServerEvent( - "esx-qalle-jail:jailPlayer", - GetPlayerServerId(closestPlayer), - jailTime, - reason - ) - end - end - end, function(_, menu3) - menu3.close() - end) - end - end - end, function(_, menu2) - menu2.close() - end) - elseif action == "unjail_player" then - local elements = {} - - ESX.TriggerServerCallback("esx-qalle-jail:retrieveJailedPlayers", function(playerArray) - if #playerArray == 0 then - ESX.ShowNotification(_U("jail_empty")) - return - end - - for i = 1, #playerArray, 1 do - table.insert( - elements, - { - label = "Prisoner: " - .. playerArray[i].name - .. " | Jail Time: " - .. playerArray[i].jailTime - .. " minutes", - value = playerArray[i].identifier, - } - ) - end - - ESX.UI.Menu.Open("default", GetCurrentResourceName(), "jail_unjail_menu", { - title = "Unjail Player", - align = "center", - elements = elements, - }, function(data2, menu2) - local action = data2.current.value - - TriggerServerEvent("esx-qalle-jail:unJailPlayer", action) - - menu2.close() - end, function(_, menu2) - menu2.close() - end) - end) - end - end, function(_, menu) - menu.close() - end) + ESX.UI.Menu.Open("default", GetCurrentResourceName(), "jail_prison_menu", { + title = "Prison Menu", + align = "center", + elements = { + { label = "Jail Closest Person", value = "jail_closest_player" }, + { label = "Unjail Person", value = "unjail_player" }, + }, + }, function(data, menu) + local action = data.current.value + + if action == "jail_closest_player" then + menu.close() + + ESX.UI.Menu.Open("dialog", GetCurrentResourceName(), "jail_choose_time_menu", { + title = "Jail Time (minutes)", + }, function(data2, menu2) + local jailTime = tonumber(data2.value) + if jailTime == nil then + ESX.ShowNotification(TranslateCap("time_minutes")) + else + menu2.close() + local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() + + if closestPlayer == -1 or closestDistance > 3.0 then + ESX.ShowNotification(TranslateCap("players_nearby")) + else + ESX.UI.Menu.Open("dialog", GetCurrentResourceName(), "jail_choose_reason_menu", { + title = "Jail Reason", + }, function(data3, menu3) + local reason = data3.value + if reason == nil then + ESX.ShowNotification(TranslateCap("put_something")) + else + menu3.close() + local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() + if closestPlayer == -1 or closestDistance > 3.0 then + ESX.ShowNotification(TranslateCap("players_nearby")) + else + TriggerServerEvent("esx-qalle-jail:jailPlayer", GetPlayerServerId(closestPlayer), jailTime, reason) + end + end + end, function(_, menu3) + menu3.close() + end) + end + end + end, function(_, menu2) + menu2.close() + end) + elseif action == "unjail_player" then + local elements = {} + + ESX.TriggerServerCallback("esx-qalle-jail:retrieveJailedPlayers", function(playerArray) + if #playerArray == 0 then + ESX.ShowNotification(TranslateCap("jail_empty")) + return + end + + for i = 1, #playerArray, 1 do + table.insert(elements, { + label = "Prisoner: " .. playerArray[i].name .. " | Jail Time: " .. playerArray[i].jailTime .. " minutes", + value = playerArray[i].identifier, + }) + end + + ESX.UI.Menu.Open("default", GetCurrentResourceName(), "jailTranslateCapnjail_menu", { + title = "Unjail Player", + align = "center", + elements = elements, + }, function(data2, menu2) + local action = data2.current.value + + TriggerServerEvent("esx-qalle-jail:unJailPlayer", action) + + menu2.close() + end, function(_, menu2) + menu2.close() + end) + end) + end + end, function(_, menu) + menu.close() + end) end diff --git a/server-data/resources/[esx_addons]/esx-qalle-jail/client/utils.lua b/server-data/resources/[esx_addons]/esx-qalle-jail/client/utils.lua index a1e7e86ed..3c6992ffe 100644 --- a/server-data/resources/[esx_addons]/esx-qalle-jail/client/utils.lua +++ b/server-data/resources/[esx_addons]/esx-qalle-jail/client/utils.lua @@ -1,188 +1,176 @@ RegisterCommand("jailmenu", function() - if PlayerData.job.name == "police" then - OpenJailMenu() - else - ESX.ShowNotification(_U("not_officer")) - end + if PlayerData.job.name == "police" then + OpenJailMenu() + else + ESX.ShowNotification(TranslateCap("not_officer")) + end end) function LoadAnim(animDict) - RequestAnimDict(animDict) - while not HasAnimDictLoaded(animDict) do - Wait(10) - end + RequestAnimDict(animDict) + while not HasAnimDictLoaded(animDict) do + Wait(10) + end end function LoadModel(model) - RequestModel(model) - while not HasModelLoaded(model) do - Wait(10) - end + RequestModel(model) + while not HasModelLoaded(model) do + Wait(10) + end end function HideHUDThisFrame() - HideHelpTextThisFrame() - HideHudAndRadarThisFrame() - HideHudComponentThisFrame(1) - HideHudComponentThisFrame(2) - HideHudComponentThisFrame(3) - HideHudComponentThisFrame(4) - HideHudComponentThisFrame(6) - HideHudComponentThisFrame(7) - HideHudComponentThisFrame(8) - HideHudComponentThisFrame(9) - HideHudComponentThisFrame(13) - HideHudComponentThisFrame(11) - HideHudComponentThisFrame(12) - HideHudComponentThisFrame(15) - HideHudComponentThisFrame(18) - HideHudComponentThisFrame(19) + HideHelpTextThisFrame() + HideHudAndRadarThisFrame() + HideHudComponentThisFrame(1) + HideHudComponentThisFrame(2) + HideHudComponentThisFrame(3) + HideHudComponentThisFrame(4) + HideHudComponentThisFrame(6) + HideHudComponentThisFrame(7) + HideHudComponentThisFrame(8) + HideHudComponentThisFrame(9) + HideHudComponentThisFrame(13) + HideHudComponentThisFrame(11) + HideHudComponentThisFrame(12) + HideHudComponentThisFrame(15) + HideHudComponentThisFrame(18) + HideHudComponentThisFrame(19) end function Cutscene() - DoScreenFadeOut(100) - - Wait(250) - - local Male = GetHashKey("mp_m_freemode_01") - - TriggerEvent("skinchanger:getSkin", function(skin) - if GetHashKey(GetEntityModel(PlayerPedId())) == Male then - local clothesSkin = { - ["tshirt_1"] = 20, - ["tshirt_2"] = 15, - ["torso_1"] = 33, - ["torso_2"] = 0, - ["arms"] = 0, - ["pants_1"] = 7, - ["pants_2"] = 0, - ["shoes_1"] = 34, - ["shoes_2"] = 0, - } - TriggerEvent("skinchanger:loadClothes", skin, clothesSkin) - else - local clothesSkin = { - ["tshirt_1"] = 15, - ["tshirt_2"] = 0, - ["torso_1"] = 2, - ["torso_2"] = 6, - ["arms"] = 2, - ["pants_1"] = 2, - ["pants_2"] = 0, - ["shoes_1"] = 35, - ["shoes_2"] = 0, - } - TriggerEvent("skinchanger:loadClothes", skin, clothesSkin) - end - end) - - LoadModel(-1320879687) - - local PolicePosition = Config.Cutscene["PolicePosition"] - local Police = CreatePed( - 5, - -1320879687, - PolicePosition["x"], - PolicePosition["y"], - PolicePosition["z"], - PolicePosition["h"], - false - ) - TaskStartScenarioInPlace(Police, "WORLD_HUMAN_PAPARAZZI", 0, false) - - local PlayerPosition = Config.Cutscene["PhotoPosition"] - local PlayerPed = PlayerPedId() - SetEntityCoords(PlayerPed, PlayerPosition["x"], PlayerPosition["y"], PlayerPosition["z"] - 1) - SetEntityHeading(PlayerPed, PlayerPosition["h"]) - FreezeEntityPosition(PlayerPed, true) - - Cam() - Wait(1000) - DoScreenFadeIn(100) - Wait(10000) - DoScreenFadeOut(250) - - local JailPosition = Config.JailPositions["Cell"] - SetEntityCoords(PlayerPed, JailPosition["x"], JailPosition["y"], JailPosition["z"]) - DeleteEntity(Police) - SetModelAsNoLongerNeeded(-1320879687) - - Wait(1000) - DoScreenFadeIn(250) - TriggerServerEvent("InteractSound_SV:PlayOnSource", "cell", 0.3) - RenderScriptCams(false, false, 0, true, true) - FreezeEntityPosition(PlayerPed, false) - DestroyCam(Config.Cutscene["CameraPos"]["cameraId"]) - - InJail() + DoScreenFadeOut(100) + + Wait(250) + + local Male = GetHashKey("mp_m_freemode_01") + + TriggerEvent("skinchanger:getSkin", function(skin) + if GetHashKey(GetEntityModel(PlayerPedId())) == Male then + local clothesSkin = { + ["tshirt_1"] = 20, + ["tshirt_2"] = 15, + ["torso_1"] = 33, + ["torso_2"] = 0, + ["arms"] = 0, + ["pants_1"] = 7, + ["pants_2"] = 0, + ["shoes_1"] = 34, + ["shoes_2"] = 0, + } + TriggerEvent("skinchanger:loadClothes", skin, clothesSkin) + else + local clothesSkin = { + ["tshirt_1"] = 15, + ["tshirt_2"] = 0, + ["torso_1"] = 2, + ["torso_2"] = 6, + ["arms"] = 2, + ["pants_1"] = 2, + ["pants_2"] = 0, + ["shoes_1"] = 35, + ["shoes_2"] = 0, + } + TriggerEvent("skinchanger:loadClothes", skin, clothesSkin) + end + end) + + LoadModel(-1320879687) + + local PolicePosition = Config.Cutscene["PolicePosition"] + local Police = CreatePed(5, -1320879687, PolicePosition["x"], PolicePosition["y"], PolicePosition["z"], PolicePosition["h"], false) + TaskStartScenarioInPlace(Police, "WORLD_HUMAN_PAPARAZZI", 0, false) + + local PlayerPosition = Config.Cutscene["PhotoPosition"] + local PlayerPed = PlayerPedId() + SetEntityCoords(PlayerPed, PlayerPosition["x"], PlayerPosition["y"], PlayerPosition["z"] - 1) + SetEntityHeading(PlayerPed, PlayerPosition["h"]) + FreezeEntityPosition(PlayerPed, true) + + Cam() + Wait(1000) + DoScreenFadeIn(100) + Wait(10000) + DoScreenFadeOut(250) + + local JailPosition = Config.JailPositions["Cell"] + SetEntityCoords(PlayerPed, JailPosition["x"], JailPosition["y"], JailPosition["z"]) + DeleteEntity(Police) + SetModelAsNoLongerNeeded(-1320879687) + + Wait(1000) + DoScreenFadeIn(250) + TriggerServerEvent("InteractSound_SV:PlayOnSource", "cell", 0.3) + RenderScriptCams(false, false, 0, true, true) + FreezeEntityPosition(PlayerPed, false) + DestroyCam(Config.Cutscene["CameraPos"]["cameraId"]) + + InJail() end function Cam() - local CamOptions = Config.Cutscene["CameraPos"] + local CamOptions = Config.Cutscene["CameraPos"] - CamOptions["cameraId"] = CreateCam("DEFAULT_SCRIPTED_CAMERA", true) + CamOptions["cameraId"] = CreateCam("DEFAULT_SCRIPTED_CAMERA", true) - SetCamCoord(CamOptions["cameraId"], CamOptions["x"], CamOptions["y"], CamOptions["z"]) - SetCamRot(CamOptions["cameraId"], CamOptions["rotationX"], CamOptions["rotationY"], CamOptions["rotationZ"]) + SetCamCoord(CamOptions["cameraId"], CamOptions["x"], CamOptions["y"], CamOptions["z"]) + SetCamRot(CamOptions["cameraId"], CamOptions["rotationX"], CamOptions["rotationY"], CamOptions["rotationZ"]) - RenderScriptCams(true, false, 0, true, true) + RenderScriptCams(true, false, 0, true, true) end function TeleportPlayer(pos) - local Values = pos - - if #Values["goal"] > 1 then - local elements = {} - - for _, v in pairs(Values["goal"]) do - table.insert(elements, { label = v, value = v }) - end - - ESX.UI.Menu.Open("default", GetCurrentResourceName(), "teleport_jail", { - title = "Choose Position", - align = "center", - elements = elements, - }, function(data, menu) - local action = data.current.value - local position = Config.Teleports[action] - - if action == "Boiling Broke" or action == "Security" then - if PlayerData.job.name ~= "police" then - ESX.ShowNotification(_U("not_keys")) - return - end - end - menu.close() - DoScreenFadeOut(100) - Wait(250) - SetEntityCoords(PlayerPedId(), position["x"], position["y"], position["z"]) - Wait(250) - DoScreenFadeIn(100) - end, function(_, menu) - menu.close() - end) - else - local position = Config.Teleports[Values["goal"][1]] - DoScreenFadeOut(100) - Wait(250) - SetEntityCoords(PlayerPedId(), position["x"], position["y"], position["z"]) - Wait(250) - DoScreenFadeIn(100) - end + local Values = pos + + if #Values["goal"] > 1 then + local elements = {} + + for _, v in pairs(Values["goal"]) do + table.insert(elements, { label = v, value = v }) + end + + ESX.UI.Menu.Open("default", GetCurrentResourceName(), "teleport_jail", { + title = "Choose Position", + align = "center", + elements = elements, + }, function(data, menu) + local action = data.current.value + local position = Config.Teleports[action] + + if action == "Boiling Broke" or action == "Security" then + if PlayerData.job.name ~= "police" then + ESX.ShowNotification(TranslateCap("not_keys")) + return + end + end + menu.close() + DoScreenFadeOut(100) + Wait(250) + SetEntityCoords(PlayerPedId(), position["x"], position["y"], position["z"]) + Wait(250) + DoScreenFadeIn(100) + end, function(_, menu) + menu.close() + end) + else + local position = Config.Teleports[Values["goal"][1]] + DoScreenFadeOut(100) + Wait(250) + SetEntityCoords(PlayerPedId(), position["x"], position["y"], position["z"]) + Wait(250) + DoScreenFadeIn(100) + end end CreateThread(function() - local blip = AddBlipForCoord( - Config.Teleports["Boiling Broke"]["x"], - Config.Teleports["Boiling Broke"]["y"], - Config.Teleports["Boiling Broke"]["z"] - ) - SetBlipSprite(blip, 188) - SetBlipDisplay(blip, 4) - SetBlipScale(blip, 0.8) - SetBlipColour(blip, 49) - SetBlipAsShortRange(blip, true) - BeginTextCommandSetBlipName("STRING") - AddTextComponentString("Boilingbroke Penitentiary") - EndTextCommandSetBlipName(blip) + local blip = AddBlipForCoord(Config.Teleports["Boiling Broke"]["x"], Config.Teleports["Boiling Broke"]["y"], Config.Teleports["Boiling Broke"]["z"]) + SetBlipSprite(blip, 188) + SetBlipDisplay(blip, 4) + SetBlipScale(blip, 0.8) + SetBlipColour(blip, 49) + SetBlipAsShortRange(blip, true) + BeginTextCommandSetBlipName("STRING") + AddTextComponentString("Boilingbroke Penitentiary") + EndTextCommandSetBlipName(blip) end) diff --git a/server-data/resources/[esx_addons]/esx-qalle-jail/config.lua b/server-data/resources/[esx_addons]/esx-qalle-jail/config.lua index 0c4f84b2c..904bfe5ea 100644 --- a/server-data/resources/[esx_addons]/esx-qalle-jail/config.lua +++ b/server-data/resources/[esx_addons]/esx-qalle-jail/config.lua @@ -1,106 +1,106 @@ Config = {} Config.Locale = "it" Config.JailPositions = { - ["Cell"] = { ["x"] = 1799.8345947266, ["y"] = 2489.1350097656, ["z"] = -119.02998352051, ["h"] = 179.03021240234 }, + ["Cell"] = { ["x"] = 1799.8345947266, ["y"] = 2489.1350097656, ["z"] = -119.02998352051, ["h"] = 179.03021240234 }, } Config.Cutscene = { - ["PhotoPosition"] = { - ["x"] = 402.91567993164, - ["y"] = -996.75970458984, - ["z"] = -99.000259399414, - ["h"] = 186.22499084473, - }, - ["CameraPos"] = { - ["x"] = 402.88830566406, - ["y"] = -1003.8851318359, - ["z"] = -97.419647216797, - ["rotationX"] = -15.433070763946, - ["rotationY"] = 0.0, - ["rotationZ"] = -0.31496068835258, - ["cameraId"] = 0, - }, - ["PolicePosition"] = { - ["x"] = 402.91702270508, - ["y"] = -1000.6376953125, - ["z"] = -99.004028320313, - ["h"] = 356.88052368164, - }, + ["PhotoPosition"] = { + ["x"] = 402.91567993164, + ["y"] = -996.75970458984, + ["z"] = -99.000259399414, + ["h"] = 186.22499084473, + }, + ["CameraPos"] = { + ["x"] = 402.88830566406, + ["y"] = -1003.8851318359, + ["z"] = -97.419647216797, + ["rotationX"] = -15.433070763946, + ["rotationY"] = 0.0, + ["rotationZ"] = -0.31496068835258, + ["cameraId"] = 0, + }, + ["PolicePosition"] = { + ["x"] = 402.91702270508, + ["y"] = -1000.6376953125, + ["z"] = -99.004028320313, + ["h"] = 356.88052368164, + }, } Config.PrisonWork = { - ["DeliverPackage"] = { - ["x"] = 1027.2347412109, - ["y"] = -3101.419921875, - ["z"] = -38.999870300293, - ["h"] = 267.89135742188, - }, + ["DeliverPackage"] = { + ["x"] = 1027.2347412109, + ["y"] = -3101.419921875, + ["z"] = -38.999870300293, + ["h"] = 267.89135742188, + }, - ["Packages"] = { - [1] = { ["x"] = 1003.6661987305, ["y"] = -3108.4221191406, ["z"] = -38.999866485596, ["state"] = true }, - [2] = { ["x"] = 1006.0420532227, ["y"] = -3103.0024414063, ["z"] = -38.999866485596, ["state"] = true }, - [3] = { ["x"] = 1015.7958374023, ["y"] = -3102.8337402344, ["z"] = -38.99991607666, ["state"] = true }, - [4] = { ["x"] = 1012.8907470703, ["y"] = -3108.2907714844, ["z"] = -38.999912261963, ["state"] = true }, - [5] = { ["x"] = 1018.2017822266, ["y"] = -3109.1982421875, ["z"] = -38.999897003174, ["state"] = true }, - [6] = { ["x"] = 1018.0194091797, ["y"] = -3096.5700683594, ["z"] = -38.999897003174, ["state"] = true }, - [7] = { ["x"] = 1015.6422119141, ["y"] = -3091.7392578125, ["z"] = -38.999897003174, ["state"] = true }, - [8] = { ["x"] = 1010.7862548828, ["y"] = -3096.6135253906, ["z"] = -38.999897003174, ["state"] = true }, - [9] = { ["x"] = 1005.7819824219, ["y"] = -3096.8415527344, ["z"] = -38.999897003174, ["state"] = true }, - [10] = { ["x"] = 1003.4543457031, ["y"] = -3096.7048339844, ["z"] = -38.999897003174, ["state"] = true }, - }, + ["Packages"] = { + [1] = { ["x"] = 1003.6661987305, ["y"] = -3108.4221191406, ["z"] = -38.999866485596, ["state"] = true }, + [2] = { ["x"] = 1006.0420532227, ["y"] = -3103.0024414063, ["z"] = -38.999866485596, ["state"] = true }, + [3] = { ["x"] = 1015.7958374023, ["y"] = -3102.8337402344, ["z"] = -38.99991607666, ["state"] = true }, + [4] = { ["x"] = 1012.8907470703, ["y"] = -3108.2907714844, ["z"] = -38.999912261963, ["state"] = true }, + [5] = { ["x"] = 1018.2017822266, ["y"] = -3109.1982421875, ["z"] = -38.999897003174, ["state"] = true }, + [6] = { ["x"] = 1018.0194091797, ["y"] = -3096.5700683594, ["z"] = -38.999897003174, ["state"] = true }, + [7] = { ["x"] = 1015.6422119141, ["y"] = -3091.7392578125, ["z"] = -38.999897003174, ["state"] = true }, + [8] = { ["x"] = 1010.7862548828, ["y"] = -3096.6135253906, ["z"] = -38.999897003174, ["state"] = true }, + [9] = { ["x"] = 1005.7819824219, ["y"] = -3096.8415527344, ["z"] = -38.999897003174, ["state"] = true }, + [10] = { ["x"] = 1003.4543457031, ["y"] = -3096.7048339844, ["z"] = -38.999897003174, ["state"] = true }, + }, } Config.Teleports = { - ["Prison Work"] = { - ["x"] = 992.51770019531, - ["y"] = -3097.8413085938, - ["z"] = -38.995861053467, - ["h"] = 81.15771484375, - ["goal"] = { - "Jail", - }, - }, + ["Prison Work"] = { + ["x"] = 992.51770019531, + ["y"] = -3097.8413085938, + ["z"] = -38.995861053467, + ["h"] = 81.15771484375, + ["goal"] = { + "Jail", + }, + }, - ["Boiling Broke"] = { - ["x"] = 1845.6022949219, - ["y"] = 2585.8029785156, - ["z"] = 45.672061920166, - ["h"] = 92.469093322754, - ["goal"] = { - "Security", - }, - }, + ["Boiling Broke"] = { + ["x"] = 1845.6022949219, + ["y"] = 2585.8029785156, + ["z"] = 45.672061920166, + ["h"] = 92.469093322754, + ["goal"] = { + "Security", + }, + }, - ["Jail"] = { - ["x"] = 1800.6979980469, - ["y"] = 2483.0979003906, - ["z"] = -122.68814849854, - ["h"] = 271.75274658203, - ["goal"] = { - "Prison Work", - "Security", - "Visitor", - }, - }, + ["Jail"] = { + ["x"] = 1800.6979980469, + ["y"] = 2483.0979003906, + ["z"] = -122.68814849854, + ["h"] = 271.75274658203, + ["goal"] = { + "Prison Work", + "Security", + "Visitor", + }, + }, - ["Security"] = { - ["x"] = 1706.7625732422, - ["y"] = 2581.0793457031, - ["z"] = -69.407371520996, - ["h"] = 267.72802734375, - ["goal"] = { - "Jail", - "Boiling Broke", - }, - }, + ["Security"] = { + ["x"] = 1706.7625732422, + ["y"] = 2581.0793457031, + ["z"] = -69.407371520996, + ["h"] = 267.72802734375, + ["goal"] = { + "Jail", + "Boiling Broke", + }, + }, - ["Visitor"] = { - ["x"] = 1699.7196044922, - ["y"] = 2574.5314941406, - ["z"] = -69.403930664063, - ["h"] = 169.65020751953, - ["goal"] = { - "Jail", - }, - }, + ["Visitor"] = { + ["x"] = 1699.7196044922, + ["y"] = 2574.5314941406, + ["z"] = -69.403930664063, + ["h"] = 169.65020751953, + ["goal"] = { + "Jail", + }, + }, } diff --git a/server-data/resources/[esx_addons]/esx-qalle-jail/fxmanifest.lua b/server-data/resources/[esx_addons]/esx-qalle-jail/fxmanifest.lua index d51bfdd37..04b57106e 100644 --- a/server-data/resources/[esx_addons]/esx-qalle-jail/fxmanifest.lua +++ b/server-data/resources/[esx_addons]/esx-qalle-jail/fxmanifest.lua @@ -8,16 +8,16 @@ description("Jail Script With Working Job") shared_script("@es_extended/imports.lua") server_scripts({ - "@es_extended/locale.lua", - "@mysql-async/lib/MySQL.lua", - "config.lua", - "locales/*.lua", - "server/server.lua", + "@es_extended/locale.lua", + "@mysql-async/lib/MySQL.lua", + "config.lua", + "locales/*.lua", + "server/server.lua", }) client_scripts({ - "@es_extended/locale.lua", - "config.lua", - "client/*.lua", - "locales/*.lua", + "@es_extended/locale.lua", + "config.lua", + "client/*.lua", + "locales/*.lua", }) diff --git a/server-data/resources/[esx_addons]/esx-qalle-jail/locales/en.lua b/server-data/resources/[esx_addons]/esx-qalle-jail/locales/en.lua index f7ff3f77a..b7c2b9d05 100644 --- a/server-data/resources/[esx_addons]/esx-qalle-jail/locales/en.lua +++ b/server-data/resources/[esx_addons]/esx-qalle-jail/locales/en.lua @@ -1,16 +1,16 @@ Locales["en"] = { - ["not_keys"] = "You don't have an key to go here!", - ["back_in_jail"] = "Last time you went to sleep you were imprisoned, so now you're here again!", - ["you_released"] = "You are released, keep calm outside! Good luck", - ["few_minutes"] = "You have minutes left in jail!", - ["package_taken"] = "You've already taken this package", - ["canceled"] = "Canceled", - ["time_minutes"] = "The time needs to be in minutes!", - ["players_nearb"] = "No players nearby!", - ["put_something"] = "You need to put something here!", - ["jail_empty"] = "Your jail is empty!", - ["not_officer"] = "You are not an officer!", - ["invalid_time"] = "This time is invalid", - ["id_not_online"] = "This ID is not online", - ["money_for_food"] = "Here you have som cash for food!", + ["not_keys"] = "You don't have an key to go here!", + ["back_in_jail"] = "Last time you went to sleep you were imprisoned, so now you're here again!", + ["you_released"] = "You are released, keep calm outside! Good luck", + ["few_minutes"] = "You have minutes left in jail!", + ["package_taken"] = "You've already taken this package", + ["canceled"] = "Canceled", + ["time_minutes"] = "The time needs to be in minutes!", + ["players_nearb"] = "No players nearby!", + ["put_something"] = "You need to put something here!", + ["jail_empty"] = "Your jail is empty!", + ["not_officer"] = "You are not an officer!", + ["invalid_time"] = "This time is invalid", + ["id_not_online"] = "This ID is not online", + ["money_for_food"] = "Here you have som cash for food!", } diff --git a/server-data/resources/[esx_addons]/esx-qalle-jail/locales/it.lua b/server-data/resources/[esx_addons]/esx-qalle-jail/locales/it.lua index c6870b3f7..550d1d0c9 100644 --- a/server-data/resources/[esx_addons]/esx-qalle-jail/locales/it.lua +++ b/server-data/resources/[esx_addons]/esx-qalle-jail/locales/it.lua @@ -1,16 +1,16 @@ Locales["it"] = { - ["not_keys"] = "Non hai una chiave per andare qui!", - ["back_in_jail"] = "L'ultima volta che sei andato a dormire eri stato imprigionato, quindi ora sei di nuovo qui!", - ["you_released"] = "Sei libero, mantieni la calma li fuori! Buona fortuna", - ["few_minutes"] = "Ti restano pochi minuti di prigione!", - ["package_taken"] = "Hai già preso questo pacchetto", - ["canceled"] = "Annullata", - ["time_minutes"] = "Il tempo deve essere in minuti!", - ["players_nearb"] = "Nessun giocatore nelle vicinanze!", - ["put_something"] = "Devi mettere qualcosa qui!", - ["jail_empty"] = "La tua prigione è vuota!", - ["not_officer"] = "Non sei un ufficiale!", - ["invalid_time"] = "Questo tempo non è valido", - ["id_not_online"] = "Questo ID non è online", - ["money_for_food"] = "Eccoti un po' di soldi per il cibo!", + ["not_keys"] = "Non hai una chiave per andare qui!", + ["back_in_jail"] = "L'ultima volta che sei andato a dormire eri stato imprigionato, quindi ora sei di nuovo qui!", + ["you_released"] = "Sei libero, mantieni la calma li fuori! Buona fortuna", + ["few_minutes"] = "Ti restano pochi minuti di prigione!", + ["package_taken"] = "Hai già preso questo pacchetto", + ["canceled"] = "Annullata", + ["time_minutes"] = "Il tempo deve essere in minuti!", + ["players_nearb"] = "Nessun giocatore nelle vicinanze!", + ["put_something"] = "Devi mettere qualcosa qui!", + ["jail_empty"] = "La tua prigione è vuota!", + ["not_officer"] = "Non sei un ufficiale!", + ["invalid_time"] = "Questo tempo non è valido", + ["id_not_online"] = "Questo ID non è online", + ["money_for_food"] = "Eccoti un po' di soldi per il cibo!", } diff --git a/server-data/resources/[esx_addons]/esx-qalle-jail/server/server.lua b/server-data/resources/[esx_addons]/esx-qalle-jail/server/server.lua index 3fe5a2cc8..714ab5900 100644 --- a/server-data/resources/[esx_addons]/esx-qalle-jail/server/server.lua +++ b/server-data/resources/[esx_addons]/esx-qalle-jail/server/server.lua @@ -1,200 +1,169 @@ ESX = exports["es_extended"]:getSharedObject() RegisterCommand("jail", function(src, args) - local xPlayer = ESX.GetPlayerFromId(src) - - if xPlayer["job"]["name"] == "police" then - local jailPlayer = args[1] - local jailTime = tonumber(args[2]) - local jailReason = args[3] - - if GetPlayerName(jailPlayer) ~= nil then - if jailTime ~= nil then - JailPlayer(jailPlayer, jailTime) - - TriggerClientEvent( - "esx:showNotification", - src, - GetPlayerName(jailPlayer) .. " Jailed for " .. jailTime .. " minutes!" - ) - - if args[3] ~= nil then - GetRPName(jailPlayer, function(Firstname, Lastname) - TriggerClientEvent( - "chat:addMessage", - -1, - { - args = { - "JUDGE", - Firstname .. " " .. Lastname .. " Is now in jail for the reason: " .. args[3], - }, - color = { 249, 166, 0 }, - } - ) - end) - end - else - TriggerClientEvent("esx:showNotification", src, _U("invalid_time")) - end - else - TriggerClientEvent("esx:showNotification", src, _U("id_not_online")) - end - else - TriggerClientEvent("esx:showNotification", src, _U("not_officer")) - end + local xPlayer = ESX.GetPlayerFromId(src) + + if xPlayer["job"]["name"] == "police" then + local jailPlayer = args[1] + local jailTime = tonumber(args[2]) + local jailReason = args[3] + + if GetPlayerName(jailPlayer) ~= nil then + if jailTime ~= nil then + JailPlayer(jailPlayer, jailTime) + + TriggerClientEvent("esx:showNotification", src, GetPlayerName(jailPlayer) .. " Jailed for " .. jailTime .. " minutes!") + + if args[3] ~= nil then + GetRPName(jailPlayer, function(Firstname, Lastname) + TriggerClientEvent("chat:addMessage", -1, { + args = { + "JUDGE", + Firstname .. " " .. Lastname .. " Is now in jail for the reason: " .. args[3], + }, + color = { 249, 166, 0 }, + }) + end) + end + else + TriggerClientEvent("esx:showNotification", src, TranslateCap("invalid_time")) + end + else + TriggerClientEvent("esx:showNotification", src, TranslateCap("id_not_online")) + end + else + TriggerClientEvent("esx:showNotification", src, TranslateCap("not_officer")) + end end) RegisterCommand("unjail", function(src, args) - local xPlayer = ESX.GetPlayerFromId(src) - - if xPlayer["job"]["name"] == "police" then - local jailPlayer = args[1] - - if GetPlayerName(jailPlayer) ~= nil then - UnJail(jailPlayer) - else - TriggerClientEvent("esx:showNotification", src, _U("id_not_online")) - end - else - TriggerClientEvent("esx:showNotification", src, _U("not_officer")) - end + local xPlayer = ESX.GetPlayerFromId(src) + + if xPlayer["job"]["name"] == "police" then + local jailPlayer = args[1] + + if GetPlayerName(jailPlayer) ~= nil then + UnJail(jailPlayer) + else + TriggerClientEvent("esx:showNotification", src, TranslateCap("id_not_online")) + end + else + TriggerClientEvent("esx:showNotification", src, TranslateCap("not_officer")) + end end) RegisterServerEvent("esx-qalle-jail:jailPlayer") AddEventHandler("esx-qalle-jail:jailPlayer", function(targetSrc, jailTime, jailReason) - local src = source - local targetSrc = tonumber(targetSrc) - local xPlayer = ESX.GetPlayerFromId(src) - - if xPlayer.job.name == "police" then - JailPlayer(targetSrc, jailTime) - - GetRPName(targetSrc, function(Firstname, Lastname) - TriggerClientEvent( - "chat:addMessage", - -1, - { - args = { "JUDGE", Firstname .. " " .. Lastname .. " Is now in jail for the reason: " .. jailReason }, - color = { 249, 166, 0 }, - } - ) - end) - else - DropPlayer(src, "[esx-qalle-jail]: You have been kicked for trying to exploit a server event.") - end - - TriggerClientEvent( - "esx:showNotification", - src, - GetPlayerName(targetSrc) .. " Jailed for " .. jailTime .. " minutes!" - ) + local src = source + local targetSrc = tonumber(targetSrc) + local xPlayer = ESX.GetPlayerFromId(src) + + if xPlayer.job.name == "police" then + JailPlayer(targetSrc, jailTime) + + GetRPName(targetSrc, function(Firstname, Lastname) + TriggerClientEvent("chat:addMessage", -1, { + args = { "JUDGE", Firstname .. " " .. Lastname .. " Is now in jail for the reason: " .. jailReason }, + color = { 249, 166, 0 }, + }) + end) + else + DropPlayer(src, "[esx-qalle-jail]: You have been kicked for trying to exploit a server event.") + end + + TriggerClientEvent("esx:showNotification", src, GetPlayerName(targetSrc) .. " Jailed for " .. jailTime .. " minutes!") end) RegisterServerEvent("esx-qalle-jail:unJailPlayer") AddEventHandler("esx-qalle-jail:unJailPlayer", function(targetIdentifier) - local src = source - local xPlayer = ESX.GetPlayerFromIdentifier(targetIdentifier) - - if xPlayer ~= nil then - UnJail(xPlayer.source) - else - MySQL.Async.execute("UPDATE users SET jail = @newJailTime WHERE identifier = @identifier", { - ["@identifier"] = targetIdentifier, - ["@newJailTime"] = 0, - }) - end - - TriggerClientEvent("esx:showNotification", src, xPlayer.name .. " Unjailed!") + local src = source + local xPlayer = ESX.GetPlayerFromIdentifier(targetIdentifier) + + if xPlayer ~= nil then + UnJail(xPlayer.source) + else + MySQL.Async.execute("UPDATE users SET jail = @newJailTime WHERE identifier = @identifier", { + ["@identifier"] = targetIdentifier, + ["@newJailTime"] = 0, + }) + end + + TriggerClientEvent("esx:showNotification", src, xPlayer.name .. " Unjailed!") end) RegisterServerEvent("esx-qalle-jail:updateJailTime") AddEventHandler("esx-qalle-jail:updateJailTime", function(newJailTime) - local src = source + local src = source - EditJailTime(src, newJailTime) + EditJailTime(src, newJailTime) end) RegisterServerEvent("esx-qalle-jail:prisonWorkReward") AddEventHandler("esx-qalle-jail:prisonWorkReward", function() - local src = source - local xPlayer = ESX.GetPlayerFromId(src) - xPlayer.addMoney(math.random(13, 21)) - TriggerClientEvent("esx:showNotification", src, _U("money_for_food")) + local src = source + local xPlayer = ESX.GetPlayerFromId(src) + xPlayer.addMoney(math.random(13, 21)) + TriggerClientEvent("esx:showNotification", src, TranslateCap("money_for_food")) end) function JailPlayer(jailPlayer, jailTime) - TriggerClientEvent("esx-qalle-jail:jailPlayer", jailPlayer, jailTime) + TriggerClientEvent("esx-qalle-jail:jailPlayer", jailPlayer, jailTime) - EditJailTime(jailPlayer, jailTime) + EditJailTime(jailPlayer, jailTime) end function UnJail(jailPlayer) - TriggerClientEvent("esx-qalle-jail:unJailPlayer", jailPlayer) + TriggerClientEvent("esx-qalle-jail:unJailPlayer", jailPlayer) - EditJailTime(jailPlayer, 0) + EditJailTime(jailPlayer, 0) end function EditJailTime(source, jailTime) - local src = source - local xPlayer = ESX.GetPlayerFromId(src) - local Identifier = xPlayer.identifier - - MySQL.Async.execute("UPDATE users SET jail = @newJailTime WHERE identifier = @identifier", { - ["@identifier"] = Identifier, - ["@newJailTime"] = tonumber(jailTime), - }) + local src = source + local xPlayer = ESX.GetPlayerFromId(src) + local Identifier = xPlayer.identifier + + MySQL.Async.execute("UPDATE users SET jail = @newJailTime WHERE identifier = @identifier", { + ["@identifier"] = Identifier, + ["@newJailTime"] = tonumber(jailTime), + }) end function GetRPName(playerId, data) - local Identifier = ESX.GetPlayerFromId(playerId).identifier - - MySQL.Async.fetchAll( - "SELECT firstname, lastname FROM users WHERE identifier = @identifier", - { ["@identifier"] = Identifier }, - function(result) - data(result[1].firstname, result[1].lastname) - end - ) + local Identifier = ESX.GetPlayerFromId(playerId).identifier + + MySQL.Async.fetchAll("SELECT firstname, lastname FROM users WHERE identifier = @identifier", { ["@identifier"] = Identifier }, function(result) + data(result[1].firstname, result[1].lastname) + end) end ESX.RegisterServerCallback("esx-qalle-jail:retrieveJailedPlayers", function(_, cb) - local jailedPersons = {} - - MySQL.Async.fetchAll( - "SELECT firstname, lastname, jail, identifier FROM users WHERE jail > @jail", - { ["@jail"] = 0 }, - function(result) - for i = 1, #result, 1 do - table.insert( - jailedPersons, - { - name = result[i].firstname .. " " .. result[i].lastname, - jailTime = result[i].jail, - identifier = result[i].identifier, - } - ) - end - cb(jailedPersons) - end - ) + local jailedPersons = {} + + MySQL.Async.fetchAll("SELECT firstname, lastname, jail, identifier FROM users WHERE jail > @jail", { ["@jail"] = 0 }, function(result) + for i = 1, #result, 1 do + table.insert(jailedPersons, { + name = result[i].firstname .. " " .. result[i].lastname, + jailTime = result[i].jail, + identifier = result[i].identifier, + }) + end + cb(jailedPersons) + end) end) ESX.RegisterServerCallback("esx-qalle-jail:retrieveJailTime", function(source, cb) - local src = source - local xPlayer = ESX.GetPlayerFromId(src) - local Identifier = xPlayer.identifier - - MySQL.Async.fetchAll( - "SELECT jail FROM users WHERE identifier = @identifier", - { ["@identifier"] = Identifier }, - function(result) - local JailTime = tonumber(result[1].jail) - - if JailTime > 0 then - cb(true, JailTime) - else - cb(false, 0) - end - end - ) + local src = source + local xPlayer = ESX.GetPlayerFromId(src) + local Identifier = xPlayer.identifier + + MySQL.Async.fetchAll("SELECT jail FROM users WHERE identifier = @identifier", { ["@identifier"] = Identifier }, function(result) + local JailTime = tonumber(result[1].jail) + + if JailTime > 0 then + cb(true, JailTime) + else + cb(false, 0) + end + end) end) diff --git a/server-data/resources/[esx_addons]/esx_RealisticVehicleFailure/client.lua b/server-data/resources/[esx_addons]/esx_RealisticVehicleFailure/client.lua index e21e04bae..1def389af 100644 --- a/server-data/resources/[esx_addons]/esx_RealisticVehicleFailure/client.lua +++ b/server-data/resources/[esx_addons]/esx_RealisticVehicleFailure/client.lua @@ -1,464 +1,389 @@ -local pedInSameVehicleLast = false -local vehicle -local lastVehicle -local vehicleClass +local pedInSameVehicleLast, isBrakingForward, isBrakingReverse = false, false, false +local vehicle, lastVehicle, vehicleClass, tireBurstLuckyNumber local fCollisionDamageMult = 0.0 local fDeformationDamageMult = 0.0 local fEngineDamageMult = 0.0 local fBrakeForce = 1.0 -local isBrakingForward = false -local isBrakingReverse = false - local healthEngineLast = 1000.0 local healthEngineCurrent = 1000.0 local healthEngineNew = 1000.0 local healthEngineDelta = 0.0 local healthEngineDeltaScaled = 0.0 - local healthBodyLast = 1000.0 local healthBodyCurrent = 1000.0 local healthBodyNew = 1000.0 local healthBodyDelta = 0.0 local healthBodyDeltaScaled = 0.0 - local healthPetrolTankLast = 1000.0 local healthPetrolTankCurrent = 1000.0 local healthPetrolTankNew = 1000.0 local healthPetrolTankDelta = 0.0 local healthPetrolTankDeltaScaled = 0.0 -local tireBurstLuckyNumber + +ESX = exports["es_extended"]:getSharedObject() math.randomseed(GetGameTimer()) local tireBurstMaxNumber = cfg.randomTireBurstInterval * 1200 -- the tire burst lottery runs roughly 1200 times per minute if cfg.randomTireBurstInterval ~= 0 then - tireBurstLuckyNumber = math.random(tireBurstMaxNumber) + tireBurstLuckyNumber = math.random(tireBurstMaxNumber) end -- If we hit this number again randomly, a tire will burst. Citizen.CreateThread(function() - ESX = exports["es_extended"]:getSharedObject() - - while ESX.GetPlayerData().job == nil do - Citizen.Wait(10) - end - - PlayerData = ESX.GetPlayerData() + while ESX.GetPlayerData().job == nil do + Citizen.Wait(10) + end + PlayerData = ESX.GetPlayerData() end) RegisterNetEvent("esx:setJob") AddEventHandler("esx:setJob", function(job) - PlayerData.job = job + PlayerData.job = job end) -local function notification(msg) - SetNotificationTextEntry("STRING") - AddTextComponentString(msg) - DrawNotification(false, false) -end - local function isPedDrivingAVehicle() - local ped = GetPlayerPed(-1) - vehicle = GetVehiclePedIsIn(ped, false) - if IsPedInAnyVehicle(ped, false) then - -- Check if ped is in driver seat - if GetPedInVehicleSeat(vehicle, -1) == ped then - local class = GetVehicleClass(vehicle) - -- We don't want planes, helicopters, bicycles and trains - if class ~= 15 and class ~= 16 and class ~= 21 and class ~= 13 then - return true - end - end - end - return false + local ped = GetPlayerPed(-1) + vehicle = GetVehiclePedIsIn(ped, false) + if IsPedInAnyVehicle(ped, false) then + -- Check if ped is in driver seat + if GetPedInVehicleSeat(vehicle, -1) == ped then + local class = GetVehicleClass(vehicle) + -- We don't want planes, helicopters, bicycles and trains + if class ~= 15 and class ~= 16 and class ~= 21 and class ~= 13 then + return true + end + end + end + return false end local function fscale(inputValue, originalMin, originalMax, newBegin, newEnd, curve) - local OriginalRange = 0.0 - local NewRange = 0.0 - local zeroRefCurVal = 0.0 - local normalizedCurVal = 0.0 - local rangedValue = 0.0 - local invFlag = 0 - - if curve > 10.0 then - curve = 10.0 - end - if curve < -10.0 then - curve = -10.0 - end - - curve = (curve * -0.1) - curve = 10.0 ^ curve - - if inputValue < originalMin then - inputValue = originalMin - end - if inputValue > originalMax then - inputValue = originalMax - end - - OriginalRange = originalMax - originalMin - - if newEnd > newBegin then - NewRange = newEnd - newBegin - else - NewRange = newBegin - newEnd - invFlag = 1 - end - - zeroRefCurVal = inputValue - originalMin - normalizedCurVal = zeroRefCurVal / OriginalRange - - if originalMin > originalMax then - return 0 - end - - if invFlag == 0 then - rangedValue = ((normalizedCurVal ^ curve) * NewRange) + newBegin - else - rangedValue = newBegin - ((normalizedCurVal ^ curve) * NewRange) - end - - return rangedValue + local OriginalRange = 0.0 + local NewRange = 0.0 + local zeroRefCurVal = 0.0 + local normalizedCurVal = 0.0 + local rangedValue = 0.0 + local invFlag = 0 + + if curve > 10.0 then + curve = 10.0 + end + if curve < -10.0 then + curve = -10.0 + end + + curve = (curve * -0.1) + curve = 10.0 ^ curve + + if inputValue < originalMin then + inputValue = originalMin + end + if inputValue > originalMax then + inputValue = originalMax + end + + OriginalRange = originalMax - originalMin + + if newEnd > newBegin then + NewRange = newEnd - newBegin + else + NewRange = newBegin - newEnd + invFlag = 1 + end + + zeroRefCurVal = inputValue - originalMin + normalizedCurVal = zeroRefCurVal / OriginalRange + + if originalMin > originalMax then + return 0 + end + + if invFlag == 0 then + rangedValue = ((normalizedCurVal ^ curve) * NewRange) + newBegin + else + rangedValue = newBegin - ((normalizedCurVal ^ curve) * NewRange) + end + + return rangedValue end local function tireBurstLottery() - local tireBurstNumber = math.random(tireBurstMaxNumber) - if tireBurstNumber == tireBurstLuckyNumber then - -- We won the lottery, lets burst a tire. - if GetVehicleTyresCanBurst(vehicle) == false then - return - end - local numWheels = GetVehicleNumberOfWheels(vehicle) - local affectedTire - if numWheels == 2 then - affectedTire = (math.random(2) - 1) * 4 -- wheel 0 or 4 - elseif numWheels == 4 then - affectedTire = (math.random(4) - 1) - if affectedTire > 1 then - affectedTire = affectedTire + 2 - end -- 0, 1, 4, 5 - elseif numWheels == 6 then - affectedTire = (math.random(6) - 1) - else - affectedTire = 0 - end - SetVehicleTyreBurst(vehicle, affectedTire, false, 1000.0) - tireBurstLuckyNumber = math.random(tireBurstMaxNumber) -- Select a new number to hit, just in case some numbers occur more often than others - end + local tireBurstNumber = math.random(tireBurstMaxNumber) + if tireBurstNumber == tireBurstLuckyNumber then + -- We won the lottery, lets burst a tire. + if GetVehicleTyresCanBurst(vehicle) == false then + return + end + local numWheels = GetVehicleNumberOfWheels(vehicle) + local affectedTire + if numWheels == 2 then + affectedTire = (math.random(2) - 1) * 4 -- wheel 0 or 4 + elseif numWheels == 4 then + affectedTire = (math.random(4) - 1) + if affectedTire > 1 then + affectedTire = affectedTire + 2 + end -- 0, 1, 4, 5 + elseif numWheels == 6 then + affectedTire = (math.random(6) - 1) + else + affectedTire = 0 + end + SetVehicleTyreBurst(vehicle, affectedTire, false, 1000.0) + tireBurstLuckyNumber = math.random(tireBurstMaxNumber) -- Select a new number to hit, just in case some numbers occur more often than others + end end if cfg.torqueMultiplierEnabled or cfg.preventVehicleFlip or cfg.limpMode then - Citizen.CreateThread(function() - while true do - Citizen.Wait(0) - if cfg.torqueMultiplierEnabled or cfg.sundayDriver or cfg.limpMode then - if pedInSameVehicleLast then - local factor = 1.0 - if cfg.torqueMultiplierEnabled and healthEngineNew < 900 then - factor = (healthEngineNew + 200.0) / 1100 - end - if cfg.sundayDriver and GetVehicleClass(vehicle) ~= 14 then -- Not for boats - local accelerator = GetControlValue(2, 71) - local brake = GetControlValue(2, 72) - local speed = GetEntitySpeedVector(vehicle, true)["y"] - -- Change Braking force - local brk = fBrakeForce - if speed >= 1.0 then - -- Going forward - if accelerator > 127 then - -- Forward and accelerating - local acc = fscale( - accelerator, - 127.0, - 254.0, - 0.1, - 1.0, - 10.0 - (cfg.sundayDriverAcceleratorCurve * 2.0) - ) - factor = factor * acc - end - if brake > 127 then - -- Forward and braking - isBrakingForward = true - brk = fscale( - brake, - 127.0, - 254.0, - 0.01, - fBrakeForce, - 10.0 - (cfg.sundayDriverBrakeCurve * 2.0) - ) - end - elseif speed <= -1.0 then - -- Going reverse - if brake > 127 then - -- Reversing and accelerating (using the brake) - local rev = fscale( - brake, - 127.0, - 254.0, - 0.1, - 1.0, - 10.0 - (cfg.sundayDriverAcceleratorCurve * 2.0) - ) - factor = factor * rev - end - if accelerator > 127 then - -- Reversing and braking (Using the accelerator) - isBrakingReverse = true - brk = fscale( - accelerator, - 127.0, - 254.0, - 0.01, - fBrakeForce, - 10.0 - (cfg.sundayDriverBrakeCurve * 2.0) - ) - end - else - -- Stopped or almost stopped or sliding sideways - local entitySpeed = GetEntitySpeed(vehicle) - if entitySpeed < 1 then - -- Not sliding sideways - if isBrakingForward == true then - --Stopped or going slightly forward while braking - DisableControlAction(2, 72, true) -- Disable Brake until user lets go of brake - SetVehicleForwardSpeed(vehicle, speed * 0.98) - SetVehicleBrakeLights(vehicle, true) - end - if isBrakingReverse == true then - --Stopped or going slightly in reverse while braking - DisableControlAction(2, 71, true) -- Disable reverse Brake until user lets go of reverse brake (Accelerator) - SetVehicleForwardSpeed(vehicle, speed * 0.98) - SetVehicleBrakeLights(vehicle, true) - end - if isBrakingForward == true and GetDisabledControlNormal(2, 72) == 0 then - -- We let go of the brake - isBrakingForward = false - end - if isBrakingReverse == true and GetDisabledControlNormal(2, 71) == 0 then - -- We let go of the reverse brake (Accelerator) - isBrakingReverse = false - end - end - end - if brk > fBrakeForce - 0.02 then - brk = fBrakeForce - end -- Make sure we can brake max. - SetVehicleHandlingFloat(vehicle, "CHandlingData", "fBrakeForce", brk) -- Set new Brake Force multiplier - end - if cfg.limpMode == true and healthEngineNew < cfg.engineSafeGuard + 5 then - factor = cfg.limpModeMultiplier - end - SetVehicleEngineTorqueMultiplier(vehicle, factor) - end - end - if cfg.preventVehicleFlip then - local roll = GetEntityRoll(vehicle) - if (roll > 75.0 or roll < -75.0) and GetEntitySpeed(vehicle) < 2 then - DisableControlAction(2, 59, true) -- Disable left/right - DisableControlAction(2, 60, true) -- Disable up/down - end - end - end - end) + Citizen.CreateThread(function() + while true do + Citizen.Wait(0) + if cfg.torqueMultiplierEnabled or cfg.sundayDriver or cfg.limpMode then + if pedInSameVehicleLast then + local factor = 1.0 + if cfg.torqueMultiplierEnabled and healthEngineNew < 900 then + factor = (healthEngineNew + 200.0) / 1100 + end + if cfg.sundayDriver and GetVehicleClass(vehicle) ~= 14 then -- Not for boats + local accelerator = GetControlValue(2, 71) + local brake = GetControlValue(2, 72) + local speed = GetEntitySpeedVector(vehicle, true)["y"] + -- Change Braking force + local brk = fBrakeForce + if speed >= 1.0 then + -- Going forward + if accelerator > 127 then + -- Forward and accelerating + local acc = fscale(accelerator, 127.0, 254.0, 0.1, 1.0, 10.0 - (cfg.sundayDriverAcceleratorCurve * 2.0)) + factor = factor * acc + end + if brake > 127 then + -- Forward and braking + isBrakingForward = true + brk = fscale(brake, 127.0, 254.0, 0.01, fBrakeForce, 10.0 - (cfg.sundayDriverBrakeCurve * 2.0)) + end + elseif speed <= -1.0 then + -- Going reverse + if brake > 127 then + -- Reversing and accelerating (using the brake) + local rev = fscale(brake, 127.0, 254.0, 0.1, 1.0, 10.0 - (cfg.sundayDriverAcceleratorCurve * 2.0)) + factor = factor * rev + end + if accelerator > 127 then + -- Reversing and braking (Using the accelerator) + isBrakingReverse = true + brk = fscale(accelerator, 127.0, 254.0, 0.01, fBrakeForce, 10.0 - (cfg.sundayDriverBrakeCurve * 2.0)) + end + else + -- Stopped or almost stopped or sliding sideways + local entitySpeed = GetEntitySpeed(vehicle) + if entitySpeed < 1 then + -- Not sliding sideways + if isBrakingForward == true then + --Stopped or going slightly forward while braking + DisableControlAction(2, 72, true) -- Disable Brake until user lets go of brake + SetVehicleForwardSpeed(vehicle, speed * 0.98) + SetVehicleBrakeLights(vehicle, true) + end + if isBrakingReverse == true then + --Stopped or going slightly in reverse while braking + DisableControlAction(2, 71, true) -- Disable reverse Brake until user lets go of reverse brake (Accelerator) + SetVehicleForwardSpeed(vehicle, speed * 0.98) + SetVehicleBrakeLights(vehicle, true) + end + if isBrakingForward == true and GetDisabledControlNormal(2, 72) == 0 then + -- We let go of the brake + isBrakingForward = false + end + if isBrakingReverse == true and GetDisabledControlNormal(2, 71) == 0 then + -- We let go of the reverse brake (Accelerator) + isBrakingReverse = false + end + end + end + if brk > fBrakeForce - 0.02 then + brk = fBrakeForce + end -- Make sure we can brake max. + SetVehicleHandlingFloat(vehicle, "CHandlingData", "fBrakeForce", brk) -- Set new Brake Force multiplier + end + if cfg.limpMode == true and healthEngineNew < cfg.engineSafeGuard + 5 then + factor = cfg.limpModeMultiplier + end + SetVehicleEngineTorqueMultiplier(vehicle, factor) + end + end + if cfg.preventVehicleFlip then + local roll = GetEntityRoll(vehicle) + if (roll > 75.0 or roll < -75.0) and GetEntitySpeed(vehicle) < 2 then + DisableControlAction(2, 59, true) -- Disable left/right + DisableControlAction(2, 60, true) -- Disable up/down + end + end + end + end) end Citizen.CreateThread(function() - while true do - Citizen.Wait(50) - local ped = GetPlayerPed(-1) - if isPedDrivingAVehicle() then - vehicle = GetVehiclePedIsIn(ped, false) - vehicleClass = GetVehicleClass(vehicle) - healthEngineCurrent = GetVehicleEngineHealth(vehicle) - if healthEngineCurrent == 1000 then - healthEngineLast = 1000.0 - end - healthEngineNew = healthEngineCurrent - healthEngineDelta = healthEngineLast - healthEngineCurrent - healthEngineDeltaScaled = healthEngineDelta - * cfg.damageFactorEngine - * cfg.classDamageMultiplier[vehicleClass] - - healthBodyCurrent = GetVehicleBodyHealth(vehicle) - if healthBodyCurrent == 1000 then - healthBodyLast = 1000.0 - end - healthBodyNew = healthBodyCurrent - healthBodyDelta = healthBodyLast - healthBodyCurrent - healthBodyDeltaScaled = healthBodyDelta * cfg.damageFactorBody * cfg.classDamageMultiplier[vehicleClass] - - healthPetrolTankCurrent = GetVehiclePetrolTankHealth(vehicle) - if cfg.compatibilityMode and healthPetrolTankCurrent < 1 then - healthPetrolTankLast = healthPetrolTankCurrent - end - if healthPetrolTankCurrent == 1000 then - healthPetrolTankLast = 1000.0 - end - healthPetrolTankNew = healthPetrolTankCurrent - healthPetrolTankDelta = healthPetrolTankLast - healthPetrolTankCurrent - healthPetrolTankDeltaScaled = healthPetrolTankDelta - * cfg.damageFactorPetrolTank - * cfg.classDamageMultiplier[vehicleClass] - - if healthEngineCurrent > cfg.engineSafeGuard + 1 then - SetVehicleUndriveable(vehicle, false) - end - - if healthEngineCurrent <= cfg.engineSafeGuard + 1 and cfg.limpMode == false then - SetVehicleUndriveable(vehicle, true) - end - - -- If ped spawned a new vehicle while in a vehicle or teleported from one vehicle to another, handle as if we just entered the car - if vehicle ~= lastVehicle then - pedInSameVehicleLast = false - end - - if pedInSameVehicleLast == true then - -- Damage happened while in the car = can be multiplied - - -- Only do calculations if any damage is present on the car. Prevents weird behavior when fixing using trainer or other script - if - healthEngineCurrent ~= 1000.0 - or healthBodyCurrent ~= 1000.0 - or healthPetrolTankCurrent ~= 1000.0 - then - -- Combine the delta values (Get the largest of the three) - local healthEngineCombinedDelta = - math.max(healthEngineDeltaScaled, healthBodyDeltaScaled, healthPetrolTankDeltaScaled) - - -- If huge damage, scale back a bit - if healthEngineCombinedDelta > (healthEngineCurrent - cfg.engineSafeGuard) then - healthEngineCombinedDelta = healthEngineCombinedDelta * 0.7 - end - - -- If complete damage, but not catastrophic (ie. explosion territory) pull back a bit, to give a couple of seconds og engine runtime before dying - if healthEngineCombinedDelta > healthEngineCurrent then - healthEngineCombinedDelta = healthEngineCurrent - (cfg.cascadingFailureThreshold / 5) - end - - ------- Calculate new value - healthEngineNew = healthEngineLast - healthEngineCombinedDelta - - ------- Sanity Check on new values and further manipulations - - -- If somewhat damaged, slowly degrade until slightly before cascading failure sets in, then stop - - if - healthEngineNew > (cfg.cascadingFailureThreshold + 5) - and healthEngineNew < cfg.degradingFailureThreshold - then - healthEngineNew = healthEngineNew - (0.038 * cfg.degradingHealthSpeedFactor) - end - - -- If Damage is near catastrophic, cascade the failure - if healthEngineNew < cfg.cascadingFailureThreshold then - healthEngineNew = healthEngineNew - (0.1 * cfg.cascadingFailureSpeedFactor) - end - - -- Prevent Engine going to or below zero. Ensures you can reenter a damaged car. - if healthEngineNew < cfg.engineSafeGuard then - healthEngineNew = cfg.engineSafeGuard - end - - -- Prevent Explosions - if cfg.compatibilityMode == false and healthPetrolTankCurrent < 750 then - healthPetrolTankNew = 750.0 - end - - -- Prevent negative body damage. - if healthBodyNew < 0 then - healthBodyNew = 0.0 - end - end - else - -- Just got in the vehicle. Damage can not be multiplied this round - -- Set vehicle handling data - fDeformationDamageMult = GetVehicleHandlingFloat(vehicle, "CHandlingData", "fDeformationDamageMult") - fBrakeForce = GetVehicleHandlingFloat(vehicle, "CHandlingData", "fBrakeForce") - local newFDeformationDamageMult = fDeformationDamageMult ^ cfg.deformationExponent -- Pull the handling file value closer to 1 - if cfg.deformationMultiplier ~= -1 then - SetVehicleHandlingFloat( - vehicle, - "CHandlingData", - "fDeformationDamageMult", - newFDeformationDamageMult * cfg.deformationMultiplier - ) - end -- Multiply by our factor - if cfg.weaponsDamageMultiplier ~= -1 then - SetVehicleHandlingFloat( - vehicle, - "CHandlingData", - "fWeaponDamageMult", - cfg.weaponsDamageMultiplier / cfg.damageFactorBody - ) - end -- Set weaponsDamageMultiplier and compensate for damageFactorBody - - --Get the CollisionDamageMultiplier - fCollisionDamageMult = GetVehicleHandlingFloat(vehicle, "CHandlingData", "fCollisionDamageMult") - --Modify it by pulling all number a towards 1.0 - local newFCollisionDamageMultiplier = fCollisionDamageMult ^ cfg.collisionDamageExponent -- Pull the handling file value closer to 1 - SetVehicleHandlingFloat(vehicle, "CHandlingData", "fCollisionDamageMult", newFCollisionDamageMultiplier) - - --Get the EngineDamageMultiplier - fEngineDamageMult = GetVehicleHandlingFloat(vehicle, "CHandlingData", "fEngineDamageMult") - --Modify it by pulling all number a towards 1.0 - local newFEngineDamageMult = fEngineDamageMult ^ cfg.engineDamageExponent -- Pull the handling file value closer to 1 - SetVehicleHandlingFloat(vehicle, "CHandlingData", "fEngineDamageMult", newFEngineDamageMult) - - -- If body damage catastrophic, reset somewhat so we can get new damage to multiply - if healthBodyCurrent < cfg.cascadingFailureThreshold then - healthBodyNew = cfg.cascadingFailureThreshold - end - pedInSameVehicleLast = true - end - - -- set the actual new values - if healthEngineNew ~= healthEngineCurrent then - SetVehicleEngineHealth(vehicle, healthEngineNew) - end - if healthBodyNew ~= healthBodyCurrent then - SetVehicleBodyHealth(vehicle, healthBodyNew) - end - if healthPetrolTankNew ~= healthPetrolTankCurrent then - SetVehiclePetrolTankHealth(vehicle, healthPetrolTankNew) - end - - -- Store current values, so we can calculate delta next time around - healthEngineLast = healthEngineNew - healthBodyLast = healthBodyNew - healthPetrolTankLast = healthPetrolTankNew - lastVehicle = vehicle - if cfg.randomTireBurstInterval ~= 0 and GetEntitySpeed(vehicle) > 10 then - tireBurstLottery() - end - else - if pedInSameVehicleLast == true then - -- We just got out of the vehicle - lastVehicle = GetVehiclePedIsIn(ped, true) - if cfg.deformationMultiplier ~= -1 then - SetVehicleHandlingFloat( - lastVehicle, - "CHandlingData", - "fDeformationDamageMult", - fDeformationDamageMult - ) - end -- Restore deformation multiplier - SetVehicleHandlingFloat(lastVehicle, "CHandlingData", "fBrakeForce", fBrakeForce) -- Restore Brake Force multiplier - if cfg.weaponsDamageMultiplier ~= -1 then - SetVehicleHandlingFloat( - lastVehicle, - "CHandlingData", - "fWeaponDamageMult", - cfg.weaponsDamageMultiplier - ) - end -- Since we are out of the vehicle, we should no longer compensate for bodyDamageFactor - SetVehicleHandlingFloat(lastVehicle, "CHandlingData", "fCollisionDamageMult", fCollisionDamageMult) -- Restore the original CollisionDamageMultiplier - SetVehicleHandlingFloat(lastVehicle, "CHandlingData", "fEngineDamageMult", fEngineDamageMult) -- Restore the original EngineDamageMultiplier - end - pedInSameVehicleLast = false - end - end + while true do + Citizen.Wait(50) + local ped = GetPlayerPed(-1) + if isPedDrivingAVehicle() then + vehicle = GetVehiclePedIsIn(ped, false) + vehicleClass = GetVehicleClass(vehicle) + healthEngineCurrent = GetVehicleEngineHealth(vehicle) + if healthEngineCurrent == 1000 then + healthEngineLast = 1000.0 + end + healthEngineNew = healthEngineCurrent + healthEngineDelta = healthEngineLast - healthEngineCurrent + healthEngineDeltaScaled = healthEngineDelta * cfg.damageFactorEngine * cfg.classDamageMultiplier[vehicleClass] + + healthBodyCurrent = GetVehicleBodyHealth(vehicle) + if healthBodyCurrent == 1000 then + healthBodyLast = 1000.0 + end + healthBodyNew = healthBodyCurrent + healthBodyDelta = healthBodyLast - healthBodyCurrent + healthBodyDeltaScaled = healthBodyDelta * cfg.damageFactorBody * cfg.classDamageMultiplier[vehicleClass] + + healthPetrolTankCurrent = GetVehiclePetrolTankHealth(vehicle) + if cfg.compatibilityMode and healthPetrolTankCurrent < 1 then + healthPetrolTankLast = healthPetrolTankCurrent + end + if healthPetrolTankCurrent == 1000 then + healthPetrolTankLast = 1000.0 + end + healthPetrolTankNew = healthPetrolTankCurrent + healthPetrolTankDelta = healthPetrolTankLast - healthPetrolTankCurrent + healthPetrolTankDeltaScaled = healthPetrolTankDelta * cfg.damageFactorPetrolTank * cfg.classDamageMultiplier[vehicleClass] + + if healthEngineCurrent > cfg.engineSafeGuard + 1 then + SetVehicleUndriveable(vehicle, false) + end + + if healthEngineCurrent <= cfg.engineSafeGuard + 1 and cfg.limpMode == false then + SetVehicleUndriveable(vehicle, true) + end + + -- If ped spawned a new vehicle while in a vehicle or teleported from one vehicle to another, handle as if we just entered the car + if vehicle ~= lastVehicle then + pedInSameVehicleLast = false + end + + if pedInSameVehicleLast == true then + -- Damage happened while in the car = can be multiplied + + -- Only do calculations if any damage is present on the car. Prevents weird behavior when fixing using trainer or other script + if healthEngineCurrent ~= 1000.0 or healthBodyCurrent ~= 1000.0 or healthPetrolTankCurrent ~= 1000.0 then + -- Combine the delta values (Get the largest of the three) + local healthEngineCombinedDelta = math.max(healthEngineDeltaScaled, healthBodyDeltaScaled, healthPetrolTankDeltaScaled) + + -- If huge damage, scale back a bit + if healthEngineCombinedDelta > (healthEngineCurrent - cfg.engineSafeGuard) then + healthEngineCombinedDelta = healthEngineCombinedDelta * 0.7 + end + + -- If complete damage, but not catastrophic (ie. explosion territory) pull back a bit, to give a couple of seconds og engine runtime before dying + if healthEngineCombinedDelta > healthEngineCurrent then + healthEngineCombinedDelta = healthEngineCurrent - (cfg.cascadingFailureThreshold / 5) + end + + ------- Calculate new value + healthEngineNew = healthEngineLast - healthEngineCombinedDelta + + ------- Sanity Check on new values and further manipulations + + -- If somewhat damaged, slowly degrade until slightly before cascading failure sets in, then stop + + if healthEngineNew > (cfg.cascadingFailureThreshold + 5) and healthEngineNew < cfg.degradingFailureThreshold then + healthEngineNew = healthEngineNew - (0.038 * cfg.degradingHealthSpeedFactor) + end + + -- If Damage is near catastrophic, cascade the failure + if healthEngineNew < cfg.cascadingFailureThreshold then + healthEngineNew = healthEngineNew - (0.1 * cfg.cascadingFailureSpeedFactor) + end + + -- Prevent Engine going to or below zero. Ensures you can reenter a damaged car. + if healthEngineNew < cfg.engineSafeGuard then + healthEngineNew = cfg.engineSafeGuard + end + + -- Prevent Explosions + if cfg.compatibilityMode == false and healthPetrolTankCurrent < 750 then + healthPetrolTankNew = 750.0 + end + + -- Prevent negative body damage. + if healthBodyNew < 0 then + healthBodyNew = 0.0 + end + end + else + -- Just got in the vehicle. Damage can not be multiplied this round + -- Set vehicle handling data + fDeformationDamageMult = GetVehicleHandlingFloat(vehicle, "CHandlingData", "fDeformationDamageMult") + fBrakeForce = GetVehicleHandlingFloat(vehicle, "CHandlingData", "fBrakeForce") + local newFDeformationDamageMult = fDeformationDamageMult ^ cfg.deformationExponent -- Pull the handling file value closer to 1 + if cfg.deformationMultiplier ~= -1 then + SetVehicleHandlingFloat(vehicle, "CHandlingData", "fDeformationDamageMult", newFDeformationDamageMult * cfg.deformationMultiplier) + end -- Multiply by our factor + if cfg.weaponsDamageMultiplier ~= -1 then + SetVehicleHandlingFloat(vehicle, "CHandlingData", "fWeaponDamageMult", cfg.weaponsDamageMultiplier / cfg.damageFactorBody) + end -- Set weaponsDamageMultiplier and compensate for damageFactorBody + + --Get the CollisionDamageMultiplier + fCollisionDamageMult = GetVehicleHandlingFloat(vehicle, "CHandlingData", "fCollisionDamageMult") + --Modify it by pulling all number a towards 1.0 + local newFCollisionDamageMultiplier = fCollisionDamageMult ^ cfg.collisionDamageExponent -- Pull the handling file value closer to 1 + SetVehicleHandlingFloat(vehicle, "CHandlingData", "fCollisionDamageMult", newFCollisionDamageMultiplier) + + --Get the EngineDamageMultiplier + fEngineDamageMult = GetVehicleHandlingFloat(vehicle, "CHandlingData", "fEngineDamageMult") + --Modify it by pulling all number a towards 1.0 + local newFEngineDamageMult = fEngineDamageMult ^ cfg.engineDamageExponent -- Pull the handling file value closer to 1 + SetVehicleHandlingFloat(vehicle, "CHandlingData", "fEngineDamageMult", newFEngineDamageMult) + + -- If body damage catastrophic, reset somewhat so we can get new damage to multiply + if healthBodyCurrent < cfg.cascadingFailureThreshold then + healthBodyNew = cfg.cascadingFailureThreshold + end + pedInSameVehicleLast = true + end + + -- set the actual new values + if healthEngineNew ~= healthEngineCurrent then + SetVehicleEngineHealth(vehicle, healthEngineNew) + end + if healthBodyNew ~= healthBodyCurrent then + SetVehicleBodyHealth(vehicle, healthBodyNew) + end + if healthPetrolTankNew ~= healthPetrolTankCurrent then + SetVehiclePetrolTankHealth(vehicle, healthPetrolTankNew) + end + + -- Store current values, so we can calculate delta next time around + healthEngineLast = healthEngineNew + healthBodyLast = healthBodyNew + healthPetrolTankLast = healthPetrolTankNew + lastVehicle = vehicle + if cfg.randomTireBurstInterval ~= 0 and GetEntitySpeed(vehicle) > 10 then + tireBurstLottery() + end + else + if pedInSameVehicleLast == true then + -- We just got out of the vehicle + lastVehicle = GetVehiclePedIsIn(ped, true) + if cfg.deformationMultiplier ~= -1 then + SetVehicleHandlingFloat(lastVehicle, "CHandlingData", "fDeformationDamageMult", fDeformationDamageMult) + end -- Restore deformation multiplier + SetVehicleHandlingFloat(lastVehicle, "CHandlingData", "fBrakeForce", fBrakeForce) -- Restore Brake Force multiplier + if cfg.weaponsDamageMultiplier ~= -1 then + SetVehicleHandlingFloat(lastVehicle, "CHandlingData", "fWeaponDamageMult", cfg.weaponsDamageMultiplier) + end -- Since we are out of the vehicle, we should no longer compensate for bodyDamageFactor + SetVehicleHandlingFloat(lastVehicle, "CHandlingData", "fCollisionDamageMult", fCollisionDamageMult) -- Restore the original CollisionDamageMultiplier + SetVehicleHandlingFloat(lastVehicle, "CHandlingData", "fEngineDamageMult", fEngineDamageMult) -- Restore the original EngineDamageMultiplier + end + pedInSameVehicleLast = false + end + end end) diff --git a/server-data/resources/[esx_addons]/esx_RealisticVehicleFailure/config.lua b/server-data/resources/[esx_addons]/esx_RealisticVehicleFailure/config.lua index 1c056115a..54a29367c 100644 --- a/server-data/resources/[esx_addons]/esx_RealisticVehicleFailure/config.lua +++ b/server-data/resources/[esx_addons]/esx_RealisticVehicleFailure/config.lua @@ -2,69 +2,69 @@ -- IMPORTANT: Some of these values MUST be defined as a floating point number. ie. 10.0 instead of 10 cfg = { - deformationMultiplier = -1, -- How much should the vehicle visually deform from a collision. Range 0.0 to 10.0 Where 0.0 is no deformation and 10.0 is 10x deformation. -1 = Don't touch. Visual damage does not sync well to other players. - deformationExponent = 0.7, -- How much should the handling file deformation setting be compressed toward 1.0. (Make cars more similar). A value of 1=no change. Lower values will compress more, values above 1 it will expand. Dont set to zero or negative. - collisionDamageExponent = 0.6, -- How much should the handling file deformation setting be compressed toward 1.0. (Make cars more similar). A value of 1=no change. Lower values will compress more, values above 1 it will expand. Dont set to zero or negative. + deformationMultiplier = -1, -- How much should the vehicle visually deform from a collision. Range 0.0 to 10.0 Where 0.0 is no deformation and 10.0 is 10x deformation. -1 = Don't touch. Visual damage does not sync well to other players. + deformationExponent = 0.7, -- How much should the handling file deformation setting be compressed toward 1.0. (Make cars more similar). A value of 1=no change. Lower values will compress more, values above 1 it will expand. Dont set to zero or negative. + collisionDamageExponent = 0.6, -- How much should the handling file deformation setting be compressed toward 1.0. (Make cars more similar). A value of 1=no change. Lower values will compress more, values above 1 it will expand. Dont set to zero or negative. - damageFactorEngine = 10.0, -- Sane values are 1 to 100. Higher values means more damage to vehicle. A good starting point is 10 - damageFactorBody = 10.0, -- Sane values are 1 to 100. Higher values means more damage to vehicle. A good starting point is 10 - damageFactorPetrolTank = 64.0, -- Sane values are 1 to 200. Higher values means more damage to vehicle. A good starting point is 64 - engineDamageExponent = 0.6, -- How much should the handling file engine damage setting be compressed toward 1.0. (Make cars more similar). A value of 1=no change. Lower values will compress more, values above 1 it will expand. Dont set to zero or negative. - weaponsDamageMultiplier = 0.10, -- How much damage should the vehicle get from weapons fire. Range 0.0 to 10.0, where 0.0 is no damage and 10.0 is 10x damage. -1 = don't touch - degradingHealthSpeedFactor = 10, -- Speed of slowly degrading health, but not failure. Value of 10 means that it will take about 0.25 second per health point, so degradation from 800 to 305 will take about 2 minutes of clean driving. Higher values means faster degradation - cascadingFailureSpeedFactor = 15.0, -- Sane values are 1 to 100. When vehicle health drops below a certain point, cascading failure sets in, and the health drops rapidly until the vehicle dies. Higher values means faster failure. A good starting point is 8 + damageFactorEngine = 10.0, -- Sane values are 1 to 100. Higher values means more damage to vehicle. A good starting point is 10 + damageFactorBody = 10.0, -- Sane values are 1 to 100. Higher values means more damage to vehicle. A good starting point is 10 + damageFactorPetrolTank = 64.0, -- Sane values are 1 to 200. Higher values means more damage to vehicle. A good starting point is 64 + engineDamageExponent = 0.6, -- How much should the handling file engine damage setting be compressed toward 1.0. (Make cars more similar). A value of 1=no change. Lower values will compress more, values above 1 it will expand. Dont set to zero or negative. + weaponsDamageMultiplier = 0.10, -- How much damage should the vehicle get from weapons fire. Range 0.0 to 10.0, where 0.0 is no damage and 10.0 is 10x damage. -1 = don't touch + degradingHealthSpeedFactor = 10, -- Speed of slowly degrading health, but not failure. Value of 10 means that it will take about 0.25 second per health point, so degradation from 800 to 305 will take about 2 minutes of clean driving. Higher values means faster degradation + cascadingFailureSpeedFactor = 15.0, -- Sane values are 1 to 100. When vehicle health drops below a certain point, cascading failure sets in, and the health drops rapidly until the vehicle dies. Higher values means faster failure. A good starting point is 8 - degradingFailureThreshold = 800.0, -- Below this value, slow health degradation will set in - cascadingFailureThreshold = 360.0, -- Below this value, health cascading failure will set in - engineSafeGuard = 150.0, -- Final failure value. Set it too high, and the vehicle won't smoke when disabled. Set too low, and the car will catch fire from a single bullet to the engine. At health 100 a typical car can take 3-4 bullets to the engine before catching fire. + degradingFailureThreshold = 800.0, -- Below this value, slow health degradation will set in + cascadingFailureThreshold = 360.0, -- Below this value, health cascading failure will set in + engineSafeGuard = 150.0, -- Final failure value. Set it too high, and the vehicle won't smoke when disabled. Set too low, and the car will catch fire from a single bullet to the engine. At health 100 a typical car can take 3-4 bullets to the engine before catching fire. - torqueMultiplierEnabled = true, -- Decrease engine torque as engine gets more and more damaged + torqueMultiplierEnabled = true, -- Decrease engine torque as engine gets more and more damaged - limpMode = false, -- If true, the engine never fails completely, so you will always be able to get to a mechanic unless you flip your vehicle and preventVehicleFlip is set to true - limpModeMultiplier = 0.20, -- The torque multiplier to use when vehicle is limping. Sane values are 0.05 to 0.25 + limpMode = false, -- If true, the engine never fails completely, so you will always be able to get to a mechanic unless you flip your vehicle and preventVehicleFlip is set to true + limpModeMultiplier = 0.20, -- The torque multiplier to use when vehicle is limping. Sane values are 0.05 to 0.25 - preventVehicleFlip = true, -- If true, you can't turn over an upside down vehicle + preventVehicleFlip = true, -- If true, you can't turn over an upside down vehicle - sundayDriver = true, -- If true, the accelerator response is scaled to enable easy slow driving. Will not prevent full throttle. Does not work with binary accelerators like a keyboard. Set to false to disable. The included stop-without-reversing and brake-light-hold feature does also work for keyboards. - sundayDriverAcceleratorCurve = 7.5, -- The response curve to apply to the accelerator. Range 0.0 to 10.0. Higher values enables easier slow driving, meaning more pressure on the throttle is required to accelerate forward. Does nothing for keyboard drivers - sundayDriverBrakeCurve = 5.0, -- The response curve to apply to the Brake. Range 0.0 to 10.0. Higher values enables easier braking, meaning more pressure on the throttle is required to brake hard. Does nothing for keyboard drivers + sundayDriver = true, -- If true, the accelerator response is scaled to enable easy slow driving. Will not prevent full throttle. Does not work with binary accelerators like a keyboard. Set to false to disable. The included stop-without-reversing and brake-light-hold feature does also work for keyboards. + sundayDriverAcceleratorCurve = 7.5, -- The response curve to apply to the accelerator. Range 0.0 to 10.0. Higher values enables easier slow driving, meaning more pressure on the throttle is required to accelerate forward. Does nothing for keyboard drivers + sundayDriverBrakeCurve = 5.0, -- The response curve to apply to the Brake. Range 0.0 to 10.0. Higher values enables easier braking, meaning more pressure on the throttle is required to brake hard. Does nothing for keyboard drivers - displayBlips = true, -- Show blips for mechanics locations + displayBlips = true, -- Show blips for mechanics locations - compatibilityMode = false, -- prevents other scripts from modifying the fuel tank health to avoid random engine failure with BVA 2.01 (Downside is it disabled explosion prevention) + compatibilityMode = false, -- prevents other scripts from modifying the fuel tank health to avoid random engine failure with BVA 2.01 (Downside is it disabled explosion prevention) - randomTireBurstInterval = 0, -- Number of minutes (statistically, not precisely) to drive above 22 mph before you get a tire puncture. 0=feature is disabled + randomTireBurstInterval = 0, -- Number of minutes (statistically, not precisely) to drive above 22 mph before you get a tire puncture. 0=feature is disabled - chargeForRepairs = false, -- if true fixing vehicle cost money - price = 100.0, -- you may edit this to your liking. if "chargeForRepairs = false" ignore this one - DamageMultiplier = 5.0, -- you may edit this to your liking. if "chargeForRepairs = false" ignore this one + chargeForRepairs = false, -- if true fixing vehicle cost money + price = 100.0, -- you may edit this to your liking. if "chargeForRepairs = false" ignore this one + DamageMultiplier = 5.0, -- you may edit this to your liking. if "chargeForRepairs = false" ignore this one - -- Class Damagefactor Multiplier - -- The damageFactor for engine, body and Petroltank will be multiplied by this value, depending on vehicle class - -- Use it to increase or decrease damage for each class + -- Class Damagefactor Multiplier + -- The damageFactor for engine, body and Petroltank will be multiplied by this value, depending on vehicle class + -- Use it to increase or decrease damage for each class - classDamageMultiplier = { - [0] = 1.0, -- 0: Compacts - 1.0, -- 1: Sedans - 1.0, -- 2: SUVs - 1.0, -- 3: Coupes - 1.0, -- 4: Muscle - 1.0, -- 5: Sports Classics - 1.3, -- 6: Sports - 1.3, -- 7: Super - 0.25, -- 8: Motorcycles - 0.7, -- 9: Off-road - 0.25, -- 10: Industrial - 1.0, -- 11: Utility - 1.0, -- 12: Vans - 1.0, -- 13: Cycles - 10.5, -- 14: Boats - 1.0, -- 15: Helicopters - 1.0, -- 16: Planes - 1.0, -- 17: Service - 0.75, -- 18: Emergency - 0.75, -- 19: Military - 1.0, -- 20: Commercial - 1.0, -- 21: Trains - }, + classDamageMultiplier = { + [0] = 1.0, -- 0: Compacts + 1.0, -- 1: Sedans + 1.0, -- 2: SUVs + 1.0, -- 3: Coupes + 1.0, -- 4: Muscle + 1.0, -- 5: Sports Classics + 1.3, -- 6: Sports + 1.3, -- 7: Super + 0.25, -- 8: Motorcycles + 0.7, -- 9: Off-road + 0.25, -- 10: Industrial + 1.0, -- 11: Utility + 1.0, -- 12: Vans + 1.0, -- 13: Cycles + 10.5, -- 14: Boats + 1.0, -- 15: Helicopters + 1.0, -- 16: Planes + 1.0, -- 17: Service + 0.75, -- 18: Emergency + 0.75, -- 19: Military + 1.0, -- 20: Commercial + 1.0, -- 21: Trains + }, } diff --git a/server-data/resources/[esx_addons]/esx_RealisticVehicleFailure/fxmanifest.lua b/server-data/resources/[esx_addons]/esx_RealisticVehicleFailure/fxmanifest.lua index fb6df5227..b83118092 100644 --- a/server-data/resources/[esx_addons]/esx_RealisticVehicleFailure/fxmanifest.lua +++ b/server-data/resources/[esx_addons]/esx_RealisticVehicleFailure/fxmanifest.lua @@ -3,15 +3,15 @@ game("gta5") description("esx_realisticvehicle") lua54("yes") -version("1.0.0") +version("1.0.1") shared_script("@es_extended/imports.lua") client_scripts({ - "config.lua", - "client.lua", + "config.lua", + "client.lua", }) server_scripts({ - "config.lua", + "config.lua", }) diff --git a/server-data/resources/[esx_addons]/esx_joblisting/README.md b/server-data/resources/[esx_addons]/esx_joblisting/README.md index 623cca3a9..2a5e6fc33 100644 --- a/server-data/resources/[esx_addons]/esx_joblisting/README.md +++ b/server-data/resources/[esx_addons]/esx_joblisting/README.md @@ -1,3 +1,5 @@ +
Discord - Documentation + This Simple resource lets you finally contribute to Society and make a difference in the Word! How? it adds an amazing Menu where you can pick what you want to be in life - want to be a police officier? No-problem! Or maybe you want to stalk people and be a creepy reporter? We got you covered! ## Legal diff --git a/server-data/resources/[esx_addons]/esx_joblisting/client/main.lua b/server-data/resources/[esx_addons]/esx_joblisting/client/main.lua index 5e958e133..de37b63a9 100644 --- a/server-data/resources/[esx_addons]/esx_joblisting/client/main.lua +++ b/server-data/resources/[esx_addons]/esx_joblisting/client/main.lua @@ -1,81 +1,80 @@ local menuIsShowed, TextUIdrawing = false, false function ShowJobListingMenu() - menuIsShowed = true - ESX.TriggerServerCallback('esx_joblisting:getJobsList', function(jobs) - local elements = {{unselectable = "true", title = _U('job_center'), icon = "fas fa-briefcase"}} + menuIsShowed = true + ESX.TriggerServerCallback("esx_joblisting:getJobsList", function(jobs) + local elements = { { unselectable = "true", title = TranslateCap("job_center"), icon = "fas fa-briefcase" } } - for i = 1, #(jobs) do - elements[#elements + 1] = {title = jobs[i].label, name = jobs[i].name} - end + for i = 1, #jobs do + elements[#elements + 1] = { title = jobs[i].label, name = jobs[i].name } + end - ESX.OpenContext("right", elements, function(menu, SelectJob) - TriggerServerEvent('esx_joblisting:setJob', SelectJob.name) - ESX.CloseContext() - ESX.ShowNotification(_U('new_job', SelectJob.title), "success") - menuIsShowed = false - TextUIdrawing = false - end, function() - menuIsShowed = false - TextUIdrawing = false + ESX.OpenContext("right", elements, function(menu, SelectJob) + TriggerServerEvent("esx_joblisting:setJob", SelectJob.name) + ESX.CloseContext() + ESX.ShowNotification(TranslateCap("new_job", SelectJob.title), "success") + menuIsShowed = false + TextUIdrawing = false + end, function() + menuIsShowed = false + TextUIdrawing = false + end) end) - end) end -- Activate menu when player is inside marker, and draw markers CreateThread(function() - while true do - local Sleep = 1500 + while true do + local Sleep = 1500 - local coords = GetEntityCoords(ESX.PlayerData.ped) - local isInMarker = false + local coords = GetEntityCoords(ESX.PlayerData.ped) + local isInMarker = false - for i = 1, #Config.Zones, 1 do - local distance = #(coords - Config.Zones[i]) + for i = 1, #Config.Zones, 1 do + local distance = #(coords - Config.Zones[i]) - if distance < Config.DrawDistance then - Sleep = 0 - DrawMarker(Config.MarkerType, Config.Zones[i], 0.0, 0.0, 0.0, 0, 0.0, 0.0, Config.ZoneSize.x, Config.ZoneSize.y, Config.ZoneSize.z, - Config.MarkerColor.r, Config.MarkerColor.g, Config.MarkerColor.b, 100, false, true, 2, false, false, false, false) - end + if distance < Config.DrawDistance then + Sleep = 0 + DrawMarker(Config.MarkerType, Config.Zones[i], 0.0, 0.0, 0.0, 0, 0.0, 0.0, Config.ZoneSize.x, Config.ZoneSize.y, Config.ZoneSize.z, Config.MarkerColor.r, Config.MarkerColor.g, Config.MarkerColor.b, 100, false, true, 2, false, false, false, false) + end - if distance < (Config.ZoneSize.x / 2) then - isInMarker = true - if not TextUIdrawing then - ESX.TextUI(_U("access_job_center")) - TextUIdrawing = true + if distance < (Config.ZoneSize.x / 2) then + isInMarker = true + if not TextUIdrawing then + ESX.TextUI(TranslateCap("access_job_center")) + TextUIdrawing = true + end + if IsControlJustReleased(0, 38) and not menuIsShowed then + ShowJobListingMenu() + ESX.HideUI() + end + end end - if IsControlJustReleased(0, 38) and not menuIsShowed then - ShowJobListingMenu() - ESX.HideUI() + + if not isInMarker and TextUIdrawing then + ESX.HideUI() + TextUIdrawing = false end - end - end - if not isInMarker and TextUIdrawing then - ESX.HideUI() - TextUIdrawing = false + Wait(Sleep) end - - Wait(Sleep) - end end) -- Create blips if Config.Blip.Enabled then - CreateThread(function() - for i = 1, #Config.Zones, 1 do - local blip = AddBlipForCoord(Config.Zones[i]) + CreateThread(function() + for i = 1, #Config.Zones, 1 do + local blip = AddBlipForCoord(Config.Zones[i]) - SetBlipSprite(blip, Config.Blip.Sprite) - SetBlipDisplay(blip, Config.Blip.Display) - SetBlipScale(blip, Config.Blip.Scale) - SetBlipColour(blip, Config.Blip.Colour) - SetBlipAsShortRange(blip, Config.Blip.ShortRange) + SetBlipSprite(blip, Config.Blip.Sprite) + SetBlipDisplay(blip, Config.Blip.Display) + SetBlipScale(blip, Config.Blip.Scale) + SetBlipColour(blip, Config.Blip.Colour) + SetBlipAsShortRange(blip, Config.Blip.ShortRange) - BeginTextCommandSetBlipName("STRING") - AddTextComponentSubstringPlayerName(_U('blip_text')) - EndTextCommandSetBlipName(blip) - end - end) -end \ No newline at end of file + BeginTextCommandSetBlipName("STRING") + AddTextComponentSubstringPlayerName(TranslateCap("blip_text")) + EndTextCommandSetBlipName(blip) + end + end) +end diff --git a/server-data/resources/[esx_addons]/esx_joblisting/config.lua b/server-data/resources/[esx_addons]/esx_joblisting/config.lua index 6da00a446..dd2b7fb25 100644 --- a/server-data/resources/[esx_addons]/esx_joblisting/config.lua +++ b/server-data/resources/[esx_addons]/esx_joblisting/config.lua @@ -1,22 +1,22 @@ Config = {} Config.DrawDistance = 15.0 -Config.ZoneSize = {x = 2.7, y = 2.7, z = 0.5} -Config.MarkerColor = {r = 100, g = 200, b = 104} +Config.ZoneSize = { x = 2.7, y = 2.7, z = 0.5 } +Config.MarkerColor = { r = 100, g = 200, b = 104 } Config.MarkerType = 27 Config.Debug = ESX.GetConfig().EnableDebug -Config.Locale = 'en' +Config.Locale = GetConvar("esx:locale", "it") Config.Zones = { - vector3(-265.08, -964.1, 30.3) + vector3(-265.08, -964.1, 30.3), } Config.Blip = { - Enabled = true, - Sprite = 407, - Display = 4, - Scale = 0.8, - Colour = 27, - ShortRange = true -} \ No newline at end of file + Enabled = true, + Sprite = 407, + Display = 4, + Scale = 0.8, + Colour = 27, + ShortRange = true, +} diff --git a/server-data/resources/[esx_addons]/esx_joblisting/fxmanifest.lua b/server-data/resources/[esx_addons]/esx_joblisting/fxmanifest.lua index 0eff08bf1..4923ba92e 100644 --- a/server-data/resources/[esx_addons]/esx_joblisting/fxmanifest.lua +++ b/server-data/resources/[esx_addons]/esx_joblisting/fxmanifest.lua @@ -1,19 +1,20 @@ -fx_version 'bodacious' -game 'gta5' +fx_version("bodacious") +game("gta5") -description 'ESX Job Listing' -lua54 'yes' -version '1.0.0' +description("Provides a way for players to select a job") +lua54("yes") +version("1.0") +legacyversion("1.9.1") -shared_scripts { - '@es_extended/imports.lua', - '@es_extended/locale.lua', - 'locales/*.lua', - 'config.lua' -} +shared_scripts({ + "@es_extended/imports.lua", + "@es_extended/locale.lua", + "locales/*.lua", + "config.lua", +}) -server_script 'server/main.lua' +server_script("server/main.lua") -client_script 'client/main.lua' +client_script("client/main.lua") -dependency 'es_extended' +dependency("es_extended") diff --git a/server-data/resources/[esx_addons]/esx_joblisting/locales/cs.lua b/server-data/resources/[esx_addons]/esx_joblisting/locales/cs.lua deleted file mode 100644 index 8c9341768..000000000 --- a/server-data/resources/[esx_addons]/esx_joblisting/locales/cs.lua +++ /dev/null @@ -1,5 +0,0 @@ -Locales['cs'] = { - ['new_job'] = 'mate novou praci!', - ['access_job_center'] = 'stiskni ~INPUT_PICKUP~ pro pristup na Urad prace.', - ['job_center'] = 'Urad prace', -} diff --git a/server-data/resources/[esx_addons]/esx_joblisting/locales/de.lua b/server-data/resources/[esx_addons]/esx_joblisting/locales/de.lua deleted file mode 100644 index 9de572907..000000000 --- a/server-data/resources/[esx_addons]/esx_joblisting/locales/de.lua +++ /dev/null @@ -1,6 +0,0 @@ -Locales['de'] = { - ['new_job'] = 'Neuer Job: ~b~%s~s~ !', - ['access_job_center'] = 'Drücke ~b~[E]~s~ um die Jobauswahl zu öffnen!', - ['job_center'] = 'Wähle einen Job aus.', - ["blip_text"] = "Arbeitsamt" -} diff --git a/server-data/resources/[esx_addons]/esx_joblisting/locales/en.lua b/server-data/resources/[esx_addons]/esx_joblisting/locales/en.lua index 901e076f9..beda0b8ed 100644 --- a/server-data/resources/[esx_addons]/esx_joblisting/locales/en.lua +++ b/server-data/resources/[esx_addons]/esx_joblisting/locales/en.lua @@ -1,6 +1,6 @@ -Locales['en'] = { - ['new_job'] = 'New Job: ~b~%s~s~ !', - ['access_job_center'] = 'Press ~b~[E]~s~ To Open Job Selector.', - ['job_center'] = 'Select A Job.', - ["blip_text"] = "Job Centre" +Locales["en"] = { + ["new_job"] = "New Job: ~b~%s~s~ !", + ["access_job_center"] = "Press ~b~[E]~s~ To Open Job Selector.", + ["job_center"] = "Select A Job.", + ["blip_text"] = "Job Centre", } diff --git a/server-data/resources/[esx_addons]/esx_joblisting/locales/es.lua b/server-data/resources/[esx_addons]/esx_joblisting/locales/es.lua deleted file mode 100644 index 119c90cfe..000000000 --- a/server-data/resources/[esx_addons]/esx_joblisting/locales/es.lua +++ /dev/null @@ -1,6 +0,0 @@ -Locales['es'] = { - ['new_job'] = '¡Tienes un trabajo nuevo!', - ['access_job_center'] = 'Pulsa ~INPUT_PICKUP~ para entrar a la Oficina de Empleo.', - ['job_center'] = 'Oficina de Empleo', - ["blip_text"] = "Oficina de Empleo" -} diff --git a/server-data/resources/[esx_addons]/esx_joblisting/locales/fi.lua b/server-data/resources/[esx_addons]/esx_joblisting/locales/fi.lua deleted file mode 100644 index 8cd2cd514..000000000 --- a/server-data/resources/[esx_addons]/esx_joblisting/locales/fi.lua +++ /dev/null @@ -1,5 +0,0 @@ -Locales['fi'] = { - ['new_job'] = 'Sinulla on nyt uusi työ!', - ['access_job_center'] = 'Paina ~INPUT_PICKUP~ vaihtaaksesi työtä.', - ['job_center'] = 'Työkeskus', -} diff --git a/server-data/resources/[esx_addons]/esx_joblisting/locales/fr.lua b/server-data/resources/[esx_addons]/esx_joblisting/locales/fr.lua deleted file mode 100644 index f989e05c8..000000000 --- a/server-data/resources/[esx_addons]/esx_joblisting/locales/fr.lua +++ /dev/null @@ -1,6 +0,0 @@ -Locales['fr'] = { - ['new_job'] = 'Vous avez un nouveau métier: ~b~%s~s~ !', - ['access_job_center'] = 'Appuyez sur ~b~[E]~s~ pour ouvrir le sélécteur de métiers.', - ['job_center'] = 'Séléctionnez un métier.', - ["blip_text"] = "Pôle emploi" -} diff --git a/server-data/resources/[esx_addons]/esx_joblisting/locales/hu.lua b/server-data/resources/[esx_addons]/esx_joblisting/locales/hu.lua deleted file mode 100644 index 36cb83656..000000000 --- a/server-data/resources/[esx_addons]/esx_joblisting/locales/hu.lua +++ /dev/null @@ -1,5 +0,0 @@ -Locales['hu'] = { - ['new_job'] = 'Felvetted a munkát!', - ['access_job_center'] = 'Nyomj ~b~[E]~s~ hogy megnézd a munkákat', - ['job_center'] = 'Munkaügyi központ', -} diff --git a/server-data/resources/[esx_addons]/esx_joblisting/locales/it.lua b/server-data/resources/[esx_addons]/esx_joblisting/locales/it.lua index fdbb54444..991ba82d4 100644 --- a/server-data/resources/[esx_addons]/esx_joblisting/locales/it.lua +++ b/server-data/resources/[esx_addons]/esx_joblisting/locales/it.lua @@ -1,6 +1,6 @@ -Locales['it'] = { - ['new_job'] = 'Nuovo lavoro: ~b~%s~s~ !', - ['access_job_center'] = 'Premi ~b~[E]~s~ per aprire la scelta dei lavori.', - ['job_center'] = 'Seleziona un lavoro.', - ["blip_text"] = "Centro impieghi" +Locales["it"] = { + ["new_job"] = "Nuovo lavoro: ~b~%s~s~ !", + ["access_job_center"] = "Premi ~b~[E]~s~ per aprire la scelta dei lavori.", + ["job_center"] = "Seleziona un lavoro.", + ["blip_text"] = "Centro impieghi", } diff --git a/server-data/resources/[esx_addons]/esx_joblisting/locales/nl.lua b/server-data/resources/[esx_addons]/esx_joblisting/locales/nl.lua deleted file mode 100644 index 7152f0266..000000000 --- a/server-data/resources/[esx_addons]/esx_joblisting/locales/nl.lua +++ /dev/null @@ -1,6 +0,0 @@ -Locales['nl'] = { - ['new_job'] = 'Nieuwe baan: ~b~%s~s~ !', - ['access_job_center'] = 'Klik op ~b~[E]~s~ om het uitzendbureau te openen.', - ['job_center'] = 'Selecteer een baan.', - ["blip_text"] = "Uitzendbureau" -} diff --git a/server-data/resources/[esx_addons]/esx_joblisting/locales/pl.lua b/server-data/resources/[esx_addons]/esx_joblisting/locales/pl.lua deleted file mode 100644 index 9f22e657a..000000000 --- a/server-data/resources/[esx_addons]/esx_joblisting/locales/pl.lua +++ /dev/null @@ -1,5 +0,0 @@ -Locales['pl'] = { - ['new_job'] = 'masz nową pracę!', - ['access_job_center'] = 'wciśnij ~INPUT_PICKUP~ aby otworzyć urząd pracy.', - ['job_center'] = 'urząd Pracy', -} diff --git a/server-data/resources/[esx_addons]/esx_joblisting/locales/sl.lua b/server-data/resources/[esx_addons]/esx_joblisting/locales/sl.lua deleted file mode 100644 index 4e909d2fe..000000000 --- a/server-data/resources/[esx_addons]/esx_joblisting/locales/sl.lua +++ /dev/null @@ -1,8 +0,0 @@ -Locales['sl'] = { - ['new_job'] = 'imaš novo službo!', - ['access_job_center'] = 'pritisnite ~INPUT_PICKUP~ za dostop do job center.', - ['job_center'] = 'center za delovna mesta', - ['new_job'] = 'Imate novo Službo!', - ['access_job_center'] = 'Pritisni ~INPUT_PICKUP~ za dostop do Borze.', - ['job_center'] = 'Center za Zaposlovanje', -} \ No newline at end of file diff --git a/server-data/resources/[esx_addons]/esx_joblisting/locales/sr.lua b/server-data/resources/[esx_addons]/esx_joblisting/locales/sr.lua deleted file mode 100644 index bdc5869bf..000000000 --- a/server-data/resources/[esx_addons]/esx_joblisting/locales/sr.lua +++ /dev/null @@ -1,6 +0,0 @@ -Locales['sr'] = { - ['new_job'] = 'Novi Posao: ~b~%s~s~ !', - ['access_job_center'] = 'Pritisnite ~b~[E]~s~ da biste otvorili centar za zapošljavanje.', - ['job_center'] = 'Izaberite posao.', - ["blip_text"] = "Centar za Zapošljavanje" -} diff --git a/server-data/resources/[esx_addons]/esx_joblisting/locales/zh-cn.lua b/server-data/resources/[esx_addons]/esx_joblisting/locales/zh-cn.lua deleted file mode 100644 index cf9657c9f..000000000 --- a/server-data/resources/[esx_addons]/esx_joblisting/locales/zh-cn.lua +++ /dev/null @@ -1,6 +0,0 @@ -Locales['zh-cn'] = { - ['new_job'] = '新工作: ~b~%s~s~ !', - ['access_job_center'] = '摁下 ~b~[E]~s~ 打开就业中心.', - ['job_center'] = '选择工作.', - ["blip_text"] = "就业中心" -} diff --git a/server-data/resources/[esx_addons]/esx_joblisting/server/main.lua b/server-data/resources/[esx_addons]/esx_joblisting/server/main.lua index 181e02f93..b4822750f 100644 --- a/server-data/resources/[esx_addons]/esx_joblisting/server/main.lua +++ b/server-data/resources/[esx_addons]/esx_joblisting/server/main.lua @@ -1,55 +1,55 @@ function getJobs() - local jobs = ESX.GetJobs() - local availableJobs = {} - for k, v in pairs(jobs) do - if v.whitelisted == false then - availableJobs[#availableJobs + 1] = {label = v.label, name = k} + local jobs = ESX.GetJobs() + local availableJobs = {} + for k, v in pairs(jobs) do + if v.whitelisted == false then + availableJobs[#availableJobs + 1] = { label = v.label, name = k } + end end - end - return availableJobs + return availableJobs end -ESX.RegisterServerCallback('esx_joblisting:getJobsList', function(source, cb) - local jobs = getJobs() - cb(jobs) +ESX.RegisterServerCallback("esx_joblisting:getJobsList", function(source, cb) + local jobs = getJobs() + cb(jobs) end) function IsJobAvailable(job) - local jobs = ESX.GetJobs() - local JobToCheck = jobs[job] - return not JobToCheck.whitelisted + local jobs = ESX.GetJobs() + local JobToCheck = jobs[job] + return not JobToCheck.whitelisted end function IsNearCentre(player) - local Ped = GetPlayerPed(player) - local PedCoords = GetEntityCoords(Ped) - local Zones = Config.Zones - local Close = false + local Ped = GetPlayerPed(player) + local PedCoords = GetEntityCoords(Ped) + local Zones = Config.Zones + local Close = false - for i = 1, #Config.Zones, 1 do - local distance = #(PedCoords - Config.Zones[i]) + for i = 1, #Config.Zones, 1 do + local distance = #(PedCoords - Config.Zones[i]) - if distance < Config.DrawDistance then - Close = true + if distance < Config.DrawDistance then + Close = true + end end - end - return Close + return Close end -RegisterServerEvent('esx_joblisting:setJob') -AddEventHandler('esx_joblisting:setJob', function(job) - local source = source - local xPlayer = ESX.GetPlayerFromId(source) - local jobs = getJobs() - - if xPlayer and IsNearCentre(source) and IsJobAvailable(job) then - if ESX.DoesJobExist(job, 0) then - xPlayer.setJob(job, 0) +RegisterServerEvent("esx_joblisting:setJob") +AddEventHandler("esx_joblisting:setJob", function(job) + local source = source + local xPlayer = ESX.GetPlayerFromId(source) + local jobs = getJobs() + + if xPlayer and IsNearCentre(source) and IsJobAvailable(job) then + if ESX.DoesJobExist(job, 0) then + xPlayer.setJob(job, 0) + else + print("[^1ERROR^7] Tried Setting User ^5" .. source .. "^7 To Invalid Job - ^5" .. job .. "^7!") + end else - print("[^1ERROR^7] Tried Setting User ^5".. source .. "^7 To Invalid Job - ^5"..job .."^7!") + print("[^3WARNING^7] User ^5" .. source .. "^7 Attempted to Exploit ^5`esx_joblisting:setJob`^7!") end - else - print("[^3WARNING^7] User ^5".. source .. "^7 Attempted to Exploit ^5`esx_joblisting:setJob`^7!") - end -end) \ No newline at end of file +end) diff --git a/server-data/resources/[esx_addons]/esx_property/LICENSE b/server-data/resources/[esx_addons]/esx_property/LICENSE index 5c0cc6276..6559572bf 100644 --- a/server-data/resources/[esx_addons]/esx_property/LICENSE +++ b/server-data/resources/[esx_addons]/esx_property/LICENSE @@ -632,7 +632,7 @@ state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. ESX Property - Properties Made Right! - Copyright (C) 2022 ESX-Framework + Copyright (C) 2024 ESX-Framework This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -652,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: - esx-legacy Copyright (C) 2015-2022 Jérémie N'gadi + esx-legacy Copyright (C) 2015-2024 Jérémie N'gadi This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. diff --git a/server-data/resources/[esx_addons]/esx_property/README.md b/server-data/resources/[esx_addons]/esx_property/README.md index b66fde362..dfdc00201 100644 --- a/server-data/resources/[esx_addons]/esx_property/README.md +++ b/server-data/resources/[esx_addons]/esx_property/README.md @@ -1,4 +1,4 @@ -
Discord - Website - Documentation +
Discord - Documentation
## Features
@@ -40,16 +40,23 @@
* ESX Progressbar *for Raiding* *
* ESX Datastore *for wardrobe* *
* ESX Clotheshop *for wardrobe* *
+* [k4mb1 Starter Shells](https://www.k4mb1maps.com/package/5015840) *only for shell use* *
* [bob74_ipl](https://github.com/Bob74/bob74_ipl) *only for IPL use* *
> `*` = Optional
## Create A Property
+
+* [Menu Preview](https://prnt.sc/Xczb5Fs9xW-t)
* Use the command `property:create` while an admin
* Set Street Number
* Set Price of Property
* Select an Interior
+ > Note: To Use the Default Shells, you **NEED** [this Shell Pack](https://www.k4mb1maps.com/package/5015840)
+ > [Catagory Selection](https://prnt.sc/3RGaIEVTL6zw)
+
+ > [Interior Selection](https://prnt.sc/za9aOSsuqkce)
* Set The Entrance Position
> Note: Uses Player`s Current Coordinates
@@ -65,11 +72,13 @@
* From There, you can select A property
* You Can then either `Manage`, `Teleport To Entrance` or `Delete`
* Allows you to edit all options and evict users
+* [Menu Preview](https://prnt.sc/Jpxox2ZcKn9G)
+* [Menu Preview 2](https://prnt.sc/IbP-ynHgYSMA)
# Copyright
ESX Property - Properties Made Right!
- Copyright (C) 2022 ESX-Framework
+ Copyright (C) 2024 ESX-Framework
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/server-data/resources/[esx_addons]/esx_property/client/cctv.lua b/server-data/resources/[esx_addons]/esx_property/client/cctv.lua
index 29bd718cb..9a3003396 100644
--- a/server-data/resources/[esx_addons]/esx_property/client/cctv.lua
+++ b/server-data/resources/[esx_addons]/esx_property/client/cctv.lua
@@ -1,299 +1,260 @@
function CCTV(PropertyID)
- DoScreenFadeOut(500)
- Wait(500)
- local PlyCoordsBefore = GetEntityCoords(PlayerPedId())
- local Property = Properties[PropertyID]
- local CamTakePic = true
- if Property.cctv.enabled then
- ESX.TriggerServerCallback("esx_property:CCTV", function(CanCCTV)
- if CanCCTV then
- InCCTV = true
- local NightVision = false
- local function InstructionButtonMessage(text)
- BeginTextCommandScaleformString("STRING")
- AddTextComponentScaleform(text)
- EndTextCommandScaleformString()
- end
+ DoScreenFadeOut(500)
+ Wait(500)
+ local Property = Properties[PropertyID]
+ local CamTakePic = true
+ if Property.cctv.enabled then
+ ESX.TriggerServerCallback("esx_property:CCTV", function(CanCCTV)
+ if CanCCTV then
+ InCCTV = true
+ local NightVision = false
+ local function InstructionButtonMessage(text)
+ BeginTextCommandScaleformString("STRING")
+ AddTextComponentScaleform(text)
+ EndTextCommandScaleformString()
+ end
- local function CreateInstuctionScaleform(scaleform)
- local scaleform = RequestScaleformMovie(scaleform)
- while not HasScaleformMovieLoaded(scaleform) do
- Wait(0)
- end
- PushScaleformMovieFunction(scaleform, "CLEAR_ALL")
- PopScaleformMovieFunctionVoid()
+ local function CreateInstuctionScaleform(scaleform)
+ local scaleform = RequestScaleformMovie(scaleform)
+ while not HasScaleformMovieLoaded(scaleform) do
+ Wait(0)
+ end
+ PushScaleformMovieFunction(scaleform, "CLEAR_ALL")
+ PopScaleformMovieFunctionVoid()
- PushScaleformMovieFunction(scaleform, "SET_CLEAR_SPACE")
- PushScaleformMovieFunctionParameterInt(200)
- PopScaleformMovieFunctionVoid()
+ PushScaleformMovieFunction(scaleform, "SET_CLEAR_SPACE")
+ PushScaleformMovieFunctionParameterInt(200)
+ PopScaleformMovieFunctionVoid()
- if Config.CCTV.PictureWebook ~= "" then
- PushScaleformMovieFunction(scaleform, "SET_DATA_SLOT")
- PushScaleformMovieFunctionParameterInt(1)
- N_0xe83a3e3557a56640(GetControlInstructionalButton(1, Config.CCTV.Controls.Screenshot, true))
- InstructionButtonMessage(_U("take_picture"))
- PopScaleformMovieFunctionVoid()
- end
+ if Config.CCTV.PictureWebook ~= "" then
+ PushScaleformMovieFunction(scaleform, "SET_DATA_SLOT")
+ PushScaleformMovieFunctionParameterInt(1)
+ ScaleformMovieMethodAddParamPlayerNameString(GetControlInstructionalButton(1, Config.CCTV.Controls.Screenshot, true))
+ InstructionButtonMessage(TranslateCap("take_picture"))
+ PopScaleformMovieFunctionVoid()
+ end
- PushScaleformMovieFunction(scaleform, "SET_DATA_SLOT")
- PushScaleformMovieFunctionParameterInt(2)
- N_0xe83a3e3557a56640(GetControlInstructionalButton(1, Config.CCTV.Controls.Right, true))
- N_0xe83a3e3557a56640(GetControlInstructionalButton(1, Config.CCTV.Controls.Left, true))
- InstructionButtonMessage(_U("rot_left_right"))
- PopScaleformMovieFunctionVoid()
+ PushScaleformMovieFunction(scaleform, "SET_DATA_SLOT")
+ PushScaleformMovieFunctionParameterInt(2)
+ ScaleformMovieMethodAddParamPlayerNameString(GetControlInstructionalButton(1, Config.CCTV.Controls.Right, true))
+ ScaleformMovieMethodAddParamPlayerNameString(GetControlInstructionalButton(1, Config.CCTV.Controls.Left, true))
+ InstructionButtonMessage(TranslateCap("rot_left_right"))
+ PopScaleformMovieFunctionVoid()
- PushScaleformMovieFunction(scaleform, "SET_DATA_SLOT")
- PushScaleformMovieFunctionParameterInt(3)
- N_0xe83a3e3557a56640(GetControlInstructionalButton(1, Config.CCTV.Controls.Down, true))
- N_0xe83a3e3557a56640(GetControlInstructionalButton(1, Config.CCTV.Controls.Up, true))
- InstructionButtonMessage(_U("rot_up_down"))
- PopScaleformMovieFunctionVoid()
+ PushScaleformMovieFunction(scaleform, "SET_DATA_SLOT")
+ PushScaleformMovieFunctionParameterInt(3)
+ ScaleformMovieMethodAddParamPlayerNameString(GetControlInstructionalButton(1, Config.CCTV.Controls.Down, true))
+ ScaleformMovieMethodAddParamPlayerNameString(GetControlInstructionalButton(1, Config.CCTV.Controls.Up, true))
+ InstructionButtonMessage(TranslateCap("rot_up_down"))
+ PopScaleformMovieFunctionVoid()
- PushScaleformMovieFunction(scaleform, "SET_DATA_SLOT")
- PushScaleformMovieFunctionParameterInt(4)
- N_0xe83a3e3557a56640(GetControlInstructionalButton(1, Config.CCTV.Controls.ZoomOut, true))
- N_0xe83a3e3557a56640(GetControlInstructionalButton(1, Config.CCTV.Controls.ZoomIn, true))
- InstructionButtonMessage(_U("Zoom"))
- PopScaleformMovieFunctionVoid()
+ PushScaleformMovieFunction(scaleform, "SET_DATA_SLOT")
+ PushScaleformMovieFunctionParameterInt(4)
+ ScaleformMovieMethodAddParamPlayerNameString(GetControlInstructionalButton(1, Config.CCTV.Controls.ZoomOut, true))
+ ScaleformMovieMethodAddParamPlayerNameString(GetControlInstructionalButton(1, Config.CCTV.Controls.ZoomIn, true))
+ InstructionButtonMessage(TranslateCap("zoom"))
+ PopScaleformMovieFunctionVoid()
- PushScaleformMovieFunction(scaleform, "SET_DATA_SLOT")
- PushScaleformMovieFunctionParameterInt(5)
- N_0xe83a3e3557a56640(GetControlInstructionalButton(1, Config.CCTV.Controls.NightVision, true))
- InstructionButtonMessage(_U("night_vision"))
- PopScaleformMovieFunctionVoid()
+ PushScaleformMovieFunction(scaleform, "SET_DATA_SLOT")
+ PushScaleformMovieFunctionParameterInt(5)
+ ScaleformMovieMethodAddParamPlayerNameString(GetControlInstructionalButton(1, Config.CCTV.Controls.NightVision, true))
+ InstructionButtonMessage(TranslateCap("night_vision"))
+ PopScaleformMovieFunctionVoid()
- PushScaleformMovieFunction(scaleform, "SET_DATA_SLOT")
- PushScaleformMovieFunctionParameterInt(0)
- N_0xe83a3e3557a56640(GetControlInstructionalButton(1, Config.CCTV.Controls.Exit, true))
- InstructionButtonMessage(_U("exit"))
- PopScaleformMovieFunctionVoid()
+ PushScaleformMovieFunction(scaleform, "SET_DATA_SLOT")
+ PushScaleformMovieFunctionParameterInt(0)
+ ScaleformMovieMethodAddParamPlayerNameString(GetControlInstructionalButton(1, Config.CCTV.Controls.Exit, true))
+ InstructionButtonMessage(TranslateCap("exit"))
+ PopScaleformMovieFunctionVoid()
- PushScaleformMovieFunction(scaleform, "DRAW_INSTRUCTIONAL_BUTTONS")
- PopScaleformMovieFunctionVoid()
+ PushScaleformMovieFunction(scaleform, "DRAW_INSTRUCTIONAL_BUTTONS")
+ PopScaleformMovieFunctionVoid()
- PushScaleformMovieFunction(scaleform, "SET_BACKGROUND_COLOUR")
- PushScaleformMovieFunctionParameterInt(0)
- PushScaleformMovieFunctionParameterInt(0)
- PushScaleformMovieFunctionParameterInt(0)
- PushScaleformMovieFunctionParameterInt(80)
- PopScaleformMovieFunctionVoid()
+ PushScaleformMovieFunction(scaleform, "SET_BACKGROUND_COLOUR")
+ PushScaleformMovieFunctionParameterInt(0)
+ PushScaleformMovieFunctionParameterInt(0)
+ PushScaleformMovieFunctionParameterInt(0)
+ PushScaleformMovieFunctionParameterInt(80)
+ PopScaleformMovieFunctionVoid()
- return scaleform
- end
- ESX.CloseContext()
- local cctvcam = nil
- local angleZ = 0.0
- ClearFocus()
- local playerPed = PlayerPedId()
- cctvcam = CreateCamWithParams(
- "DEFAULT_SCRIPTED_CAMERA",
- vector3(Property.Entrance.x, Property.Entrance.y, Property.Entrance.z + Config.CCTV.HeightAboveDoor),
- 0,
- 0,
- 0,
- Config.CCTV.FOV
- )
- SetCamRot(cctvcam, Property.cctv.rot.x, Property.cctv.rot.y, Property.cctv.rot.z, 2)
- SetCamActive(cctvcam, true)
- SetTimecycleModifier("scanline_cam_cheap")
- TriggerServerEvent("p_instance:s:leave")
- DisableAllControlActions(0)
- FreezeEntityPosition(playerPed, true)
- SetEntityCollision(playerPed, false, true)
- local ShowButtons = true
- SetEntityVisible(playerPed, false)
- SetTimecycleModifierStrength(2.0)
- SetFocusArea(Property.Entrance.x, Property.Entrance.y, Property.Entrance.z, 0.0, 0.0, 0.0)
- PointCamAtCoord(
- cctvcam,
- vector3(Property.Entrance.x, Property.Entrance.y, Property.Entrance.z + Config.CCTV.HeightAboveDoor)
- )
- RenderScriptCams(true, false, 1, true, false)
- Wait(1000)
- DoScreenFadeIn(500)
- RequestAmbientAudioBank("Phone_Soundset_Franklin", 0, 0)
- RequestAmbientAudioBank("HintCamSounds", 0, 0)
- while IsCamActive(cctvcam) do
- Wait(5)
- DisableAllControlActions(0)
- EnableControlAction(0, 245, true)
- EnableControlAction(0, 246, true)
- EnableControlAction(0, 249, true)
- HideHudComponentThisFrame(7)
- HideHudComponentThisFrame(8)
- HideHudComponentThisFrame(9)
- HideHudComponentThisFrame(6)
- HideHudComponentThisFrame(19)
- HideHudAndRadarThisFrame()
+ return scaleform
+ end
+ ESX.CloseContext()
+ local cctvcam = nil
+ ClearFocus()
+ local playerPed = PlayerPedId()
+ cctvcam = CreateCamWithParams("DEFAULT_SCRIPTED_CAMERA", vector3(Property.Entrance.x, Property.Entrance.y, Property.Entrance.z + Config.CCTV.HeightAboveDoor), 0, 0, 0, Config.CCTV.FOV)
+ SetCamRot(cctvcam, Property.cctv.rot.x, Property.cctv.rot.y, Property.cctv.rot.z, 2)
+ SetCamActive(cctvcam, true)
+ SetTimecycleModifier("scanline_cam_cheap")
+ TriggerServerEvent("p_instance:s:leave")
+ DisableAllControlActions(0)
+ FreezeEntityPosition(playerPed, true)
+ SetEntityCollision(playerPed, false, true)
+ local ShowButtons = true
+ SetEntityVisible(playerPed, false)
+ SetTimecycleModifierStrength(2.0)
+ SetFocusArea(Property.Entrance.x, Property.Entrance.y, Property.Entrance.z, 0.0, 0.0, 0.0)
+ PointCamAtCoord(cctvcam, vector3(Property.Entrance.x, Property.Entrance.y, Property.Entrance.z + Config.CCTV.HeightAboveDoor))
+ RenderScriptCams(true, false, 1, true, false)
+ Wait(1000)
+ DoScreenFadeIn(500)
+ RequestAmbientAudioBank("Phone_Soundset_Franklin", 0, 0)
+ RequestAmbientAudioBank("HintCamSounds", 0, 0)
+ while IsCamActive(cctvcam) do
+ Wait(5)
+ DisableAllControlActions(0)
+ EnableControlAction(0, 245, true)
+ EnableControlAction(0, 246, true)
+ EnableControlAction(0, 249, true)
+ HideHudComponentThisFrame(7)
+ HideHudComponentThisFrame(8)
+ HideHudComponentThisFrame(9)
+ HideHudComponentThisFrame(6)
+ HideHudComponentThisFrame(19)
+ HideHudAndRadarThisFrame()
- if ShowButtons then
- local instructions = CreateInstuctionScaleform("instructional_buttons")
- DrawScaleformMovieFullscreen(instructions, 255, 255, 255, 255, 0)
- end
- -- ROTATE LEFT
- local getCameraRot = GetCamRot(cctvcam, 2)
+ if ShowButtons then
+ local instructions = CreateInstuctionScaleform("instructional_buttons")
+ DrawScaleformMovieFullscreen(instructions, 255, 255, 255, 255, 0)
+ end
+ -- ROTATE LEFT
+ local getCameraRot = GetCamRot(cctvcam, 2)
- if
- IsDisabledControlPressed(0, Config.CCTV.Controls.Left)
- and getCameraRot.z < Property.cctv.maxleft
- then
- PlaySoundFrontend(-1, " FocusIn", "HintCamSounds", false)
- SetCamRot(cctvcam, getCameraRot.x, 0.0, getCameraRot.z + Config.CCTV.RotateSpeed, 2)
- end
- -- ROTATE RIGHT
- if
- IsDisabledControlPressed(0, Config.CCTV.Controls.Right)
- and getCameraRot.z > Property.cctv.maxright
- then
- PlaySoundFrontend(-1, " FocusIn", "HintCamSounds", false)
- SetCamRot(cctvcam, getCameraRot.x, 0.0, getCameraRot.z - Config.CCTV.RotateSpeed, 2)
- end
+ if IsDisabledControlPressed(0, Config.CCTV.Controls.Left) and getCameraRot.z < Property.cctv.maxleft then
+ PlaySoundFrontend(-1, " FocusIn", "HintCamSounds", false)
+ SetCamRot(cctvcam, getCameraRot.x, 0.0, getCameraRot.z + Config.CCTV.RotateSpeed, 2)
+ end
+ -- ROTATE RIGHT
+ if IsDisabledControlPressed(0, Config.CCTV.Controls.Right) and getCameraRot.z > Property.cctv.maxright then
+ PlaySoundFrontend(-1, " FocusIn", "HintCamSounds", false)
+ SetCamRot(cctvcam, getCameraRot.x, 0.0, getCameraRot.z - Config.CCTV.RotateSpeed, 2)
+ end
- -- ROTATE UP
- if
- IsDisabledControlPressed(0, Config.CCTV.Controls.Up)
- and getCameraRot.x < Config.CCTV.MaxUpRotation
- then
- PlaySoundFrontend(-1, " FocusIn", "HintCamSounds", false)
- SetCamRot(cctvcam, getCameraRot.x + Config.CCTV.RotateSpeed, 0.0, getCameraRot.z, 2)
- end
+ -- ROTATE UP
+ if IsDisabledControlPressed(0, Config.CCTV.Controls.Up) and getCameraRot.x < Config.CCTV.MaxUpRotation then
+ PlaySoundFrontend(-1, " FocusIn", "HintCamSounds", false)
+ SetCamRot(cctvcam, getCameraRot.x + Config.CCTV.RotateSpeed, 0.0, getCameraRot.z, 2)
+ end
- if
- IsDisabledControlPressed(0, Config.CCTV.Controls.Down)
- and getCameraRot.x > Config.CCTV.MaxDownRotation
- then
- PlaySoundFrontend(-1, " FocusIn", "HintCamSounds", false)
- SetCamRot(cctvcam, getCameraRot.x - Config.CCTV.RotateSpeed, 0.0, getCameraRot.z, 2)
- end
+ if IsDisabledControlPressed(0, Config.CCTV.Controls.Down) and getCameraRot.x > Config.CCTV.MaxDownRotation then
+ PlaySoundFrontend(-1, " FocusIn", "HintCamSounds", false)
+ SetCamRot(cctvcam, getCameraRot.x - Config.CCTV.RotateSpeed, 0.0, getCameraRot.z, 2)
+ end
- if
- IsDisabledControlPressed(0, Config.CCTV.Controls.ZoomIn)
- and GetCamFov(cctvcam) > Config.CCTV.MaxZoom
- then
- SetCamFov(cctvcam, GetCamFov(cctvcam) - 1.0)
- end
+ if IsDisabledControlPressed(0, Config.CCTV.Controls.ZoomIn) and GetCamFov(cctvcam) > Config.CCTV.MaxZoom then
+ SetCamFov(cctvcam, GetCamFov(cctvcam) - 1.0)
+ end
- if
- IsDisabledControlPressed(0, Config.CCTV.Controls.ZoomOut)
- and GetCamFov(cctvcam) < Config.CCTV.MinZoom
- then
- SetCamFov(cctvcam, GetCamFov(cctvcam) + 1.0)
- end
+ if IsDisabledControlPressed(0, Config.CCTV.Controls.ZoomOut) and GetCamFov(cctvcam) < Config.CCTV.MinZoom then
+ SetCamFov(cctvcam, GetCamFov(cctvcam) + 1.0)
+ end
- if
- IsDisabledControlPressed(0, Config.CCTV.Controls.Down)
- and getCameraRot.x > Config.CCTV.MaxDownRotation
- then
- PlaySoundFrontend(-1, " FocusIn", "HintCamSounds", false)
- SetCamRot(cctvcam, getCameraRot.x - Config.CCTV.RotateSpeed, 0.0, getCameraRot.z, 2)
- end
+ if IsDisabledControlPressed(0, Config.CCTV.Controls.Down) and getCameraRot.x > Config.CCTV.MaxDownRotation then
+ PlaySoundFrontend(-1, " FocusIn", "HintCamSounds", false)
+ SetCamRot(cctvcam, getCameraRot.x - Config.CCTV.RotateSpeed, 0.0, getCameraRot.z, 2)
+ end
- SetTextFont(4)
- SetTextScale(0.8, 0.8)
- SetTextColour(255, 255, 255, 255)
- SetTextDropshadow(0.1, 3, 27, 27, 255)
- BeginTextCommandDisplayText("STRING")
- AddTextComponentSubstringPlayerName(Property.setName ~= "" and Property.setName or Property.Name)
- EndTextCommandDisplayText(0.01, 0.01)
+ SetTextFont(4)
+ SetTextScale(0.8, 0.8)
+ SetTextColour(255, 255, 255, 255)
+ SetTextDropshadow(0.1, 3, 27, 27, 255)
+ BeginTextCommandDisplayText("STRING")
+ AddTextComponentSubstringPlayerName(Property.setName ~= "" and Property.setName or Property.Name)
+ EndTextCommandDisplayText(0.01, 0.01)
- SetTextFont(4)
- SetTextScale(0.7, 0.7)
- SetTextColour(255, 255, 255, 255)
- SetTextDropshadow(0.1, 3, 27, 27, 255)
- BeginTextCommandDisplayText("STRING")
- local year, --[[ integer ]]
- month, --[[ integer ]]
- day, --[[ integer ]]
- hour, --[[ integer ]]
- minute, --[[ integer ]]
- second --[[ integer ]] =
- GetPosixTime()
- AddTextComponentSubstringPlayerName(
- "" .. day .. "/" .. month .. "/" .. year .. " " .. hour .. ":" .. minute .. ":" .. second
- )
- EndTextCommandDisplayText(0.01, 0.055)
+ SetTextFont(4)
+ SetTextScale(0.7, 0.7)
+ SetTextColour(255, 255, 255, 255)
+ SetTextDropshadow(0.1, 3, 27, 27, 255)
+ BeginTextCommandDisplayText("STRING")
+ local year, --[[ integer ]]
+ month, --[[ integer ]]
+ day, --[[ integer ]]
+ hour, --[[ integer ]]
+ minute, --[[ integer ]]
+ second --[[ integer ]] = GetPosixTime()
+ AddTextComponentSubstringPlayerName("" .. day .. "/" .. month .. "/" .. year .. " " .. hour .. ":" .. minute .. ":" .. second)
+ EndTextCommandDisplayText(0.01, 0.055)
- SetTextFont(4)
- SetTextScale(0.6, 0.6)
- SetTextColour(255, 255, 255, 255)
- SetTextDropshadow(0.1, 3, 27, 27, 255)
- BeginTextCommandDisplayText("STRING")
- local Zoom = ((Config.CCTV.FOV - GetCamFov(cctvcam)) / GetCamFov(cctvcam)) * 100
- AddTextComponentSubstringPlayerName(_U("zoom_level", math.floor(Zoom)))
- EndTextCommandDisplayText(0.01, 0.09)
+ SetTextFont(4)
+ SetTextScale(0.6, 0.6)
+ SetTextColour(255, 255, 255, 255)
+ SetTextDropshadow(0.1, 3, 27, 27, 255)
+ BeginTextCommandDisplayText("STRING")
+ local Zoom = ((Config.CCTV.FOV - GetCamFov(cctvcam)) / GetCamFov(cctvcam)) * 100
+ AddTextComponentSubstringPlayerName(TranslateCap("zoom_level", math.floor(Zoom)))
+ EndTextCommandDisplayText(0.01, 0.09)
- SetTextFont(4)
- SetTextScale(0.6, 0.6)
- SetTextColour(255, 255, 255, 255)
- SetTextDropshadow(0.1, 3, 27, 27, 255)
- BeginTextCommandDisplayText("STRING")
- AddTextComponentSubstringPlayerName(NightVision and "Night Vision: Active" or "CCTV System: Active")
- EndTextCommandDisplayText(0.01, 0.12)
+ SetTextFont(4)
+ SetTextScale(0.6, 0.6)
+ SetTextColour(255, 255, 255, 255)
+ SetTextDropshadow(0.1, 3, 27, 27, 255)
+ BeginTextCommandDisplayText("STRING")
+ AddTextComponentSubstringPlayerName(NightVision and "Night Vision: Active" or "CCTV System: Active")
+ EndTextCommandDisplayText(0.01, 0.12)
- if
- IsDisabledControlPressed(0, Config.CCTV.Controls.Down)
- and getCameraRot.x > Config.CCTV.MaxDownRotation
- then
- PlaySoundFrontend(-1, " FocusIn", "HintCamSounds", false)
- SetCamRot(cctvcam, getCameraRot.x - Config.CCTV.RotateSpeed, 0.0, getCameraRot.z, 2)
- end
+ if IsDisabledControlPressed(0, Config.CCTV.Controls.Down) and getCameraRot.x > Config.CCTV.MaxDownRotation then
+ PlaySoundFrontend(-1, " FocusIn", "HintCamSounds", false)
+ SetCamRot(cctvcam, getCameraRot.x - Config.CCTV.RotateSpeed, 0.0, getCameraRot.z, 2)
+ end
- if IsDisabledControlJustPressed(0, 38) then
- NightVision = not NightVision
- SetNightvision(NightVision)
- SetTimecycleModifier("scanline_cam")
- end
+ if IsDisabledControlJustPressed(0, 38) then
+ NightVision = not NightVision
+ SetNightvision(NightVision)
+ SetTimecycleModifier("scanline_cam")
+ end
- if Config.CCTV.PictureWebook ~= "" and IsDisabledControlJustPressed(0, 201) then
- if CamTakePic then
- ShowButtons = false
- Wait(1)
- PlaySoundFrontend(-1, "Camera_Shoot", "Phone_Soundset_Franklin", 1)
- ESX.TriggerServerCallback("esx_property:GetWebhook", function(hook)
- if hook then
- exports["screenshot-basic"]:requestScreenshotUpload(hook, "files[]", function(data)
- local image = json.decode(data)
- ESX.ShowNotification(_U("picture_taken"), "success")
- SendNUIMessage({ link = image.attachments[1].proxy_url })
- ESX.ShowNotification(_U("clipboard"), "success")
- ShowButtons = true
- CamTakePic = false
- SetTimeout(5000, function()
- CamTakePic = true
- end)
- end)
- end
- end)
- else
- ESX.ShowNotification(_U("please_wait"), "error")
- end
- end
+ if Config.CCTV.PictureWebook ~= "" and IsDisabledControlJustPressed(0, 201) then
+ if CamTakePic then
+ ShowButtons = false
+ Wait(1)
+ PlaySoundFrontend(-1, "Camera_Shoot", "Phone_Soundset_Franklin", 1)
+ ESX.TriggerServerCallback("esx_property:GetWebhook", function(hook)
+ if hook then
+ exports["screenshot-basic"]:requestScreenshotUpload(hook, "files[]", function(data)
+ local image = json.decode(data)
+ ESX.ShowNotification(TranslateCap("picture_taken"), "success")
+ SendNUIMessage({ link = image.attachments[1].proxy_url })
+ ESX.ShowNotification(TranslateCap("clipboard"), "success")
+ ShowButtons = true
+ CamTakePic = false
+ SetTimeout(5000, function()
+ CamTakePic = true
+ end)
+ end)
+ end
+ end)
+ else
+ ESX.ShowNotification(TranslateCap("please_wait"), "error")
+ end
+ end
- if IsDisabledControlPressed(1, Config.CCTV.Controls.Exit) then
- DoScreenFadeOut(1000)
- ESX.TriggerServerCallback("esx_property:ExitCCTV", function(CanExit)
- if CanExit then
- InCCTV = false
- Wait(1000)
- ClearFocus()
- ClearTimecycleModifier()
- ClearExtraTimecycleModifier()
- RenderScriptCams(false, false, 0, true, false)
- DestroyCam(cctvcam, false)
- SetFocusEntity(playerPed)
- SetNightvision(false)
- SetSeethrough(false)
- SetEntityCollision(playerPed, true, true)
- FreezeEntityPosition(playerPed, false)
- SetEntityVisible(playerPed, true)
- Wait(1500)
- DoScreenFadeIn(1000)
- end
- end, PropertyID)
- break
- end
- end
- end
- end, PropertyID)
- end
+ if IsDisabledControlPressed(1, Config.CCTV.Controls.Exit) then
+ DoScreenFadeOut(1000)
+ ESX.TriggerServerCallback("esx_property:ExitCCTV", function(CanExit)
+ if CanExit then
+ InCCTV = false
+ Wait(1000)
+ ClearFocus()
+ ClearTimecycleModifier()
+ ClearExtraTimecycleModifier()
+ RenderScriptCams(false, false, 0, true, false)
+ DestroyCam(cctvcam, false)
+ SetFocusEntity(playerPed)
+ SetNightvision(false)
+ SetSeethrough(false)
+ SetEntityCollision(playerPed, true, true)
+ FreezeEntityPosition(playerPed, false)
+ SetEntityVisible(playerPed, true)
+ Wait(1500)
+ DoScreenFadeIn(1000)
+ end
+ end, PropertyID)
+ break
+ end
+ end
+ end
+ end, PropertyID)
+ end
end
diff --git a/server-data/resources/[esx_addons]/esx_property/client/furniture.lua b/server-data/resources/[esx_addons]/esx_property/client/furniture.lua
index 9e9a22abc..fa3e9baf4 100644
--- a/server-data/resources/[esx_addons]/esx_property/client/furniture.lua
+++ b/server-data/resources/[esx_addons]/esx_property/client/furniture.lua
@@ -1,502 +1,428 @@
---[[
- ESX Property - Properties Made Right!
- Copyright (C) 2022 ESX-Framework
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see