From 3fbbffa86ed80a1c05f18eb989063d6af3d551e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20N=27gadi?= Date: Thu, 10 Aug 2017 18:16:54 +0200 Subject: [PATCH 001/177] Initial commit --- README.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 00000000..1d7f5960 --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# fxserver-esx_ambulancejob +FXServer ESX Ambulance Job From 5fa079bcee254db14c2ce1b02d25abce2a5e6f17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20N=27gadi?= Date: Thu, 10 Aug 2017 18:19:16 +0200 Subject: [PATCH 002/177] Update README.md --- README.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/README.md b/README.md index 1d7f5960..fb224cbe 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,28 @@ # fxserver-esx_ambulancejob FXServer ESX Ambulance Job + +[REQUIREMENTS] + +* Auto mode + - esx_skin => https://github.com/FXServer-ESX/fxserver-esx_skin + +* Player management (boss actions **There is no way to earn money for now**) + * esx_society => https://github.com/FXServer-ESX/fxserver-esx_society + +[INSTALLATION] + +1) CD in your resources/[esx] folder +2) Clone the repository +``` +git clone https://github.com/FXServer-ESX/fxserver-esx_ambulancejob esx_ambulancejob +``` +3) * Auto mode : Import esx_ambulancejob_minimal.sql in your database + * Player / Armory management : Import esx_ambulancejob_full.sql in your database + +4) Add this in your server.cfg : + +``` +start esx_ambulancejob +``` +5) * If you want player management you have to set Config.EnablePlayerManagement to true in config.lua + From 35b91603b38355ada38dbac11ab8ac77b641d292 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20N=27gadi?= Date: Thu, 10 Aug 2017 18:20:07 +0200 Subject: [PATCH 003/177] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fb224cbe..73b28889 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ FXServer ESX Ambulance Job git clone https://github.com/FXServer-ESX/fxserver-esx_ambulancejob esx_ambulancejob ``` 3) * Auto mode : Import esx_ambulancejob_minimal.sql in your database - * Player / Armory management : Import esx_ambulancejob_full.sql in your database + * Player management : Import esx_ambulancejob_full.sql in your database 4) Add this in your server.cfg : From d66c20c6772c506bb708ea794f0151031d99205d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20N=27gadi?= Date: Thu, 10 Aug 2017 19:11:31 +0200 Subject: [PATCH 004/177] Add files --- __resource.lua | 14 + client/main.lua | 675 +++++++++++++++++++++++++++++++++++ config.lua | 74 ++++ esx_ambulancejob_full.sql | 16 + esx_ambulancejob_minimal.sql | 12 + server/main.lua | 35 ++ 6 files changed, 826 insertions(+) create mode 100644 __resource.lua create mode 100644 client/main.lua create mode 100644 config.lua create mode 100644 esx_ambulancejob_full.sql create mode 100644 esx_ambulancejob_minimal.sql create mode 100644 server/main.lua diff --git a/__resource.lua b/__resource.lua new file mode 100644 index 00000000..d181aa85 --- /dev/null +++ b/__resource.lua @@ -0,0 +1,14 @@ +resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937' + +description 'ESX Ambulance Job' + +server_scripts { + '@mysql-async/lib/MySQL.lua', + 'config.lua', + 'server/main.lua' +} + +client_scripts { + 'config.lua', + 'client/main.lua' +} diff --git a/client/main.lua b/client/main.lua new file mode 100644 index 00000000..30b5ae82 --- /dev/null +++ b/client/main.lua @@ -0,0 +1,675 @@ +DoScreenFadeIn(0) + +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 +} + +ESX = nil +local GUI = {} +GUI.Time = 0 +local PlayerData = {} +local FirstSpawn = true +local IsDead = false +local HasAlreadyEnteredMarker = false +local LastZone = nil +local CurrentAction = nil +local CurrentActionMsg = '' +local CurrentActionData = {} + +Citizen.CreateThread(function() + while ESX == nil do + TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) + Citizen.Wait(0) + end +end) + +function RespawnPed(ped, coords) + SetEntityCoordsNoOffset(ped, coords.x, coords.y, coords.z, false, false, false, true) + NetworkResurrectLocalPlayer(coords.x, coords.y, coords.z, coords.heading, true, false) + SetPlayerInvincible(ped, false) + TriggerEvent('playerSpawned', coords.x, coords.y, coords.z, coords.heading) + ClearPedBloodDamage(ped) +end + +function StartRespawnTimer() + + ESX.SetTimeout(Config.RespawnDelayAfterRPDeath, function() + + if IsDead then + + Citizen.CreateThread(function() + + DoScreenFadeOut(800) + + while not IsScreenFadedOut() do + Citizen.Wait(0) + end + + ESX.TriggerServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function() + + TriggerServerEvent('esx:updateLastPosition', Config.Zones.HospitalInteriorInside1.Pos) + + RespawnPed(GetPlayerPed(-1), Config.Zones.HospitalInteriorInside1.Pos) + StopScreenEffect('DeathFailOut') + DoScreenFadeIn(800) + end) + + end) + end + + end) + +end + +function TeleportFadeEffect(entity, coords) + + Citizen.CreateThread(function() + + DoScreenFadeOut(800) + + while not IsScreenFadedOut() do + Citizen.Wait(0) + end + + ESX.Game.TeleportEntity(entity, coords, function() + DoScreenFadeIn(800) + end) + + end) + +end + +function WarpPedInClosestVehicle(ped) + + local coords = GetEntityCoords(ped) + + local vehicle, distance = ESX.Game.GetClosestVehicle({ + x = coords.x, + y = coords.y, + z = coords.z + }) + + if distance ~= -1 and distance <= 5.0 then + + local maxSeats = GetVehicleMaxNumberOfPassengers(vehicle) + local freeSeat = nil + + for i=maxSeats - 1, 0, -1 do + if IsVehicleSeatFree(vehicle, i) then + freeSeat = i + break + end + end + + if freeSeat ~= nil then + TaskWarpPedIntoVehicle(ped, vehicle, freeSeat) + end + + else + ESX.ShowNotification('Aucun véhicule à proximité') + end + +end + +function OpenAmbulanceActionsMenu() + + local elements = { + {label = 'Vestiaire', value = 'cloakroom'} + } + + if Config.EnablePlayerManagement and PlayerData.job.grade_name == 'boss' then + table.insert(elements, {label = 'Retirer argent société', value = 'withdraw_society_money'}) + table.insert(elements, {label = 'Déposer argent', value = 'deposit_society_money'}) + end + + ESX.UI.Menu.CloseAll() + + ESX.UI.Menu.Open( + 'default', GetCurrentResourceName(), 'ambulance_actions', + { + title = 'Ambulance', + elements = elements + }, + function(data, menu) + + if data.current.value == 'cloakroom' then + OpenCloakroomMenu() + end + + if data.current.value == 'withdraw_society_money' then + + ESX.UI.Menu.Open( + 'dialog', GetCurrentResourceName(), 'withdraw_society_money_amount', + { + title = 'Montant du retrait' + }, + function(data, menu) + + local amount = tonumber(data.value) + + if amount == nil then + ESX.ShowNotification('Montant invalide') + else + menu.close() + TriggerServerEvent('esx_society:withdrawMoney', 'ambulance', amount) + end + + end, + function(data, menu) + menu.close() + end + ) + + end + + if data.current.value == 'deposit_society_money' then + + ESX.UI.Menu.Open( + 'dialog', GetCurrentResourceName(), 'deposit_money_amount', + { + title = 'Montant du dépôt' + }, + function(data, menu) + + local amount = tonumber(data.value) + + if amount == nil then + ESX.ShowNotification('Montant invalide') + else + menu.close() + TriggerServerEvent('esx_society:depositMoney', 'ambulance', amount) + end + + end, + function(data, menu) + menu.close() + end + ) + + end + + end, + function(data, menu) + + menu.close() + + CurrentAction = 'ambulance_actions_menu' + CurrentActionMsg = 'Appuyez sur ~INPUT_CONTEXT~ pour ouvrir le menu' + CurrentActionData = {} + + end + ) + +end + +function OpenMobileAmbulanceActionsMenu() + + ESX.UI.Menu.CloseAll() + + ESX.UI.Menu.Open( + 'default', GetCurrentResourceName(), 'mobile_ambulance_actions', + { + title = 'Ambulance', + elements = { + {label = 'Interaction citoyen', value = 'citizen_interaction'}, + } + }, + function(data, menu) + + if data.current.value == 'citizen_interaction' then + + ESX.UI.Menu.Open( + 'default', GetCurrentResourceName(), 'citizen_interaction', + { + title = 'Ambulance - Interactions Citoyen', + elements = { + {label = 'Réanimer', value = 'revive'}, + {label = 'Mettre dans véhicule', value = 'put_in_vehicle'}, + } + }, + function(data, menu) + + if data.current.value == 'revive' then + + menu.close() + + local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() + + if closestPlayer == -1 or closestDistance > 3.0 then + ESX.ShowNotification('Aucun joueur à proximité') + else + + local ped = GetPlayerPed(closestPlayer) + local health = GetEntityHealth(ped) + + if health == 0 then + + local playerPed = GetPlayerPed(-1) + local closestPlayerPed = GetPlayerPed(closestPlayer) + + Citizen.CreateThread(function() + + ESX.ShowNotification('Réanimation en cours') + + TaskStartScenarioInPlace(playerPed, 'CODE_HUMAN_MEDIC_TEND_TO_DEAD', 0, true) + Citizen.Wait(10000) + ClearPedTasks(playerPed) + + if GetEntityHealth(closestPlayerPed) == 0 then + TriggerServerEvent('esx_ambulancejob:revive', GetPlayerServerId(closestPlayer)) + ESX.ShowNotification('Vous avez réanimé ' .. GetPlayerName(closestPlayer)) + else + ESX.ShowNotification(GetPlayerName(closestPlayer) .. ' a succombé') + end + + end) + + else + ESX.ShowNotification(GetPlayerName(closestPlayer) .. ' n\'est pas inconscient') + end + + end + + end + + if data.current.value == 'put_in_vehicle' then + menu.close() + WarpPedInClosestVehicle(GetPlayerPed(closestPlayer)) + end + + end, + function(data, menu) + menu.close() + end + ) + + end + + end, + function(data, menu) + menu.close() + end + ) + +end + +function OpenCloakroomMenu() + + ESX.UI.Menu.Open( + 'default', GetCurrentResourceName(), 'cloakroom', + { + title = 'Vestiaire', + align = 'top-left', + elements = { + {label = 'Tenue Civil', value = 'citizen_wear'}, + {label = 'Tenue Ambulancier', value = 'ambulance_wear'}, + }, + }, + function(data, menu) + + menu.close() + + if data.current.value == 'citizen_wear' then + + ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin) + TriggerEvent('skinchanger:loadSkin', skin) + end) + + end + + if data.current.value == 'ambulance_wear' then + + ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin) + + if skin.sex == 0 then + TriggerEvent('skinchanger:loadClothes', skin, jobSkin.skin_male) + else + TriggerEvent('skinchanger:loadClothes', skin, jobSkin.skin_female) + end + + end) + + end + + CurrentAction = 'ambulance_actions_menu' + CurrentActionMsg = 'Appuyez sur ~INPUT_CONTEXT~ pour ouvrir le menu' + CurrentActionData = {} + + end, + function(data, menu) + menu.close() + end + ) + +end + +function OpenVehicleSpawnerMenu() + + ESX.UI.Menu.Open( + 'default', GetCurrentResourceName(), 'cloakroom', + { + title = 'Véhicule', + align = 'top-left', + elements = { + {label = 'Ambulance', value = 'ambulance'}, + {label = 'Hélicoptère', value = 'polmav'}, + }, + }, + function(data, menu) + + menu.close() + + local model = data.current.value + + ESX.Game.SpawnVehicle(model, Config.Zones.VehicleSpawnPoint.Pos, 270.0, function(vehicle) + + local playerPed = GetPlayerPed(-1) + + if model == 'polmav' then + SetVehicleModKit(vehicle, 0) + SetVehicleLivery(vehicle, 1) + end + + TaskWarpPedIntoVehicle(playerPed, vehicle, -1) + + end) + + end, + function(data, menu) + + menu.close() + + CurrentAction = 'vehicle_spawner_menu' + CurrentActionMsg = 'Appuyez sur ~INPUT_CONTEXT~ pour sortir un véhicule' + CurrentActionData = {} + + end + ) + +end + +AddEventHandler('playerSpawned', function() + + IsDead = false + + if FirstSpawn then + exports.spawnmanager:setAutoSpawn(false) + FirstSpawn = false + end + +end) + +RegisterNetEvent('esx:playerLoaded') +AddEventHandler('esx:playerLoaded', function(xPlayer) + + PlayerData = xPlayer + + if PlayerData.job.name == 'ambulance' then + + Config.Zones.AmbulanceActions.Type = 1 + Config.Zones.VehicleSpawner.Type = 1 + Config.Zones.VehicleDeleter.Type = 1 + + else + + Config.Zones.AmbulanceActions.Type = -1 + Config.Zones.VehicleSpawner.Type = -1 + Config.Zones.VehicleDeleter.Type = -1 + + end + +end) + +RegisterNetEvent('esx:setJob') +AddEventHandler('esx:setJob', function(job) + + PlayerData.job = job + + if PlayerData.job.name == 'ambulance' then + + Config.Zones.AmbulanceActions.Type = 1 + Config.Zones.VehicleSpawner.Type = 1 + Config.Zones.VehicleDeleter.Type = 1 + + else + + Config.Zones.AmbulanceActions.Type = -1 + Config.Zones.VehicleSpawner.Type = -1 + Config.Zones.VehicleDeleter.Type = -1 + + end + +end) + +AddEventHandler('baseevents:onPlayerDied', function(killerType, coords) + TriggerEvent('esx_ambulancejob:onPlayerDeath') +end) + +AddEventHandler('baseevents:onPlayerKilled', function(killerId, data) + TriggerEvent('esx_ambulancejob:onPlayerDeath') +end) + +AddEventHandler('esx_ambulancejob:onPlayerDeath', function() + + IsDead = true + + StartRespawnTimer() + + StartScreenEffect('DeathFailOut', 0, false) +end) + +RegisterNetEvent('esx_ambulancejob:revive') +AddEventHandler('esx_ambulancejob:revive', function() + + local playerPed = GetPlayerPed(-1) + local coords = GetEntityCoords(playerPed) + + Citizen.CreateThread(function() + + DoScreenFadeOut(800) + + while not IsScreenFadedOut() do + Citizen.Wait(0) + end + + TriggerServerEvent('esx:updateLastPosition', { + x = coords.x, + y = coords.y, + z = coords.z + }) + + RespawnPed(playerPed, { + x = coords.x, + y = coords.y, + z = coords.z + }) + + StopScreenEffect('DeathFailOut') + + DoScreenFadeIn(800) + + end) + +end) + +AddEventHandler('esx_ambulancejob:hasEnteredMarker', function(zone) + + if zone == 'HospitalInteriorEntering1' then + TeleportFadeEffect(GetPlayerPed(-1), Config.Zones.HospitalInteriorInside1.Pos) + end + + if zone == 'HospitalInteriorExit1' then + TeleportFadeEffect(GetPlayerPed(-1), Config.Zones.HospitalInteriorOutside1.Pos) + end + + if zone == 'HospitalInteriorEntering2' then + TeleportFadeEffect(GetPlayerPed(-1), Config.Zones.HospitalInteriorInside2.Pos) + end + + if zone == 'HospitalInteriorExit2' then + TeleportFadeEffect(GetPlayerPed(-1), Config.Zones.HospitalInteriorOutside2.Pos) + end + + if zone == 'AmbulanceActions' and PlayerData.job ~= nil and PlayerData.job.name == 'ambulance' then + CurrentAction = 'ambulance_actions_menu' + CurrentActionMsg = 'Appuyez sur ~INPUT_CONTEXT~ pour ouvrir le menu' + CurrentActionData = {} + end + + if zone == 'VehicleSpawner' and PlayerData.job ~= nil and PlayerData.job.name == 'ambulance' then + CurrentAction = 'vehicle_spawner_menu' + CurrentActionMsg = 'Appuyez sur ~INPUT_CONTEXT~ pour sortir un véhicule' + CurrentActionData = {} + end + + if zone == 'VehicleDeleter' and PlayerData.job ~= nil and PlayerData.job.name == 'ambulance' then + + local playerPed = GetPlayerPed(-1) + local coords = GetEntityCoords(playerPed) + + if IsPedInAnyVehicle(playerPed, false) then + + local vehicle, distance = ESX.Game.GetClosestVehicle({ + x = coords.x, + y = coords.y, + z = coords.z + }) + + if distance ~= -1 and distance <= 1.0 then + + CurrentAction = 'delete_vehicle' + CurrentActionMsg = 'Appuyez sur ~INPUT_CONTEXT~ pour ranger le véhicule' + CurrentActionData = {vehicle = vehicle} + + end + + end + + end + +end) + +AddEventHandler('esx_ambulancejob:hasExitedMarker', function(zone) + CurrentAction = nil +end) + +-- Create blips +Citizen.CreateThread(function() + + local blip = AddBlipForCoord(Config.Zones.HospitalInteriorOutside1.Pos.x, Config.Zones.HospitalInteriorOutside1.Pos.y, Config.Zones.HospitalInteriorOutside1.Pos.z) + + SetBlipSprite (blip, 61) + SetBlipDisplay(blip, 4) + SetBlipScale (blip, 1.2) + SetBlipAsShortRange(blip, true) + + BeginTextCommandSetBlipName("STRING") + AddTextComponentString("Hôpital") + EndTextCommandSetBlipName(blip) + +end) + +-- Display markers +Citizen.CreateThread(function() + while true do + + Wait(0) + + local coords = GetEntityCoords(GetPlayerPed(-1)) + + for k,v in pairs(Config.Zones) do + + if(v.Type ~= -1 and GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < Config.DrawDistance) then + DrawMarker(v.Type, v.Pos.x, v.Pos.y, v.Pos.z, 0.0, 0.0, 0.0, 0, 0.0, 0.0, Config.MarkerSize.x, Config.MarkerSize.y, Config.MarkerSize.z, Config.MarkerColor.r, Config.MarkerColor.g, Config.MarkerColor.b, 100, false, true, 2, false, false, false, false) + end + end + + end +end) + +-- Activate menu when player is inside marker +Citizen.CreateThread(function() + while true do + + Wait(0) + + local coords = GetEntityCoords(GetPlayerPed(-1)) + local isInMarker = false + local currentZone = nil + + for k,v in pairs(Config.Zones) do + if(GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < Config.MarkerSize.x) then + isInMarker = true + currentZone = k + end + end + + if isInMarker and not hasAlreadyEnteredMarker then + hasAlreadyEnteredMarker = true + lastZone = currentZone + TriggerEvent('esx_ambulancejob:hasEnteredMarker', currentZone) + end + + if not isInMarker and hasAlreadyEnteredMarker then + hasAlreadyEnteredMarker = false + TriggerEvent('esx_ambulancejob:hasExitedMarker', lastZone) + end + + end +end) + +-- Key Controls +Citizen.CreateThread(function() + while true do + + Citizen.Wait(0) + + if CurrentAction ~= nil then + + SetTextComponentFormat('STRING') + AddTextComponentString(CurrentActionMsg) + DisplayHelpTextFromStringLabel(0, 0, 1, -1) + + if IsControlPressed(0, Keys['E']) and PlayerData.job ~= nil and PlayerData.job.name == 'ambulance' and (GetGameTimer() - GUI.Time) > 150 then + + if CurrentAction == 'ambulance_actions_menu' then + OpenAmbulanceActionsMenu() + end + + if CurrentAction == 'vehicle_spawner_menu' then + OpenVehicleSpawnerMenu() + end + + if CurrentAction == 'delete_vehicle' then + ESX.Game.DeleteVehicle(CurrentActionData.vehicle) + end + + CurrentAction = nil + GUI.Time = GetGameTimer() + + end + + end + + if IsControlPressed(0, Keys['F6']) and PlayerData.job ~= nil and PlayerData.job.name == 'ambulance' and (GetGameTimer() - GUI.Time) > 150 then + OpenMobileAmbulanceActionsMenu() + GUI.Time = GetGameTimer() + end + + end +end) + +-- Load unloaded IPLs +Citizen.CreateThread(function() + LoadMpDlcMaps() + EnableMpDlcMaps(true) + RequestIpl('Coroner_Int_on') -- Morgue +end) \ No newline at end of file diff --git a/config.lua b/config.lua new file mode 100644 index 00000000..391eb068 --- /dev/null +++ b/config.lua @@ -0,0 +1,74 @@ +Config = {} +Config.DrawDistance = 100.0 +Config.MarkerColor = {r = 102, g = 0, b = 102} +Config.MarkerSize = {x = 1.5, y = 1.5, z = 1.0} +Config.RespawnDelayAfterRPDeath = 5 * 1000 +Config.RemoveWeaponsAfterRPDeath = true +Config.RemoveCashAfterRPDeath = true +Config.RemoveItemsAfterRPDeath = true +Config.EnablePlayerManagement = false + +Config.Zones = { + + + HospitalInteriorEntering1 = { + Pos = {x = 1151.447, y = -1529.491, z = 34.375}, + Type = 1 + }, + + HospitalInteriorInside1 = { + Pos = {x = 251.464, y = -1369.770, z = 28.648}, + Type = -1 + }, + + HospitalInteriorOutside1 = { + Pos = {x = 1153.364, y = -1525.731, z = 33.843}, + Type = -1 + }, + + HospitalInteriorExit1 = { + Pos = {x = 253.612, y = -1371.66, z = 28.647}, + Type = 1 + }, + + HospitalInteriorEntering2 = { + Pos = {x = 1137.181, y = -1597.504, z = 33.692}, + Type = 1 + }, + + HospitalInteriorInside2 = { + Pos = {x = 240.508, y = -1360.565, z = 28.647}, + Type = -1 + }, + + HospitalInteriorOutside2 = { + Pos = {x = 1137.922, y = -1601.434, z = 33.692}, + Type = -1 + }, + + HospitalInteriorExit2 = { + Pos = {x = 238.587, y = -1359.113, z = 28.647}, + Type = 1 + }, + + AmbulanceActions = { + Pos = {x = 244.048, y = -1366.330, z = 28.647}, + Type = 1 + }, + + VehicleSpawner = { + Pos = {x = 1128.290, y = -1601.451, z = 33.893}, + Type = 1 + }, + + VehicleSpawnPoint = { + Pos = {x = 1138.061, y = -1607.882, z = 34.692}, + Type = -1 + }, + + VehicleDeleter = { + Pos = {x = 1122.436, y = -1617.600, z = 33.692}, + Type = 1 + } + +} diff --git a/esx_ambulancejob_full.sql b/esx_ambulancejob_full.sql new file mode 100644 index 00000000..7c8ecdac --- /dev/null +++ b/esx_ambulancejob_full.sql @@ -0,0 +1,16 @@ +USE `essentialmode` + +INSERT INTO `addon_account` (name, label, shared) VALUES + ('society_ambulance', 'Ambulance', 1), +; + +INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_female) VALUES + ('ambulance',0,'ambulance','Ambulancier',20,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), + ('ambulance',1,'doctor','Medecin',40,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), + ('ambulance',2,'chief_doctor','Medecin-chef',60,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), + ('ambulance',3,'boss','Chirurgien',80,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}') +; + +INSERT INTO `jobs` (name, label) VALUES + ('ambulance','Ambulance') +; \ No newline at end of file diff --git a/esx_ambulancejob_minimal.sql b/esx_ambulancejob_minimal.sql new file mode 100644 index 00000000..2f7afe36 --- /dev/null +++ b/esx_ambulancejob_minimal.sql @@ -0,0 +1,12 @@ +USE `essentialmode` + +INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_female) VALUES + ('ambulance',0,'ambulance','Ambulancier',20,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), + ('ambulance',1,'doctor','Medecin',40,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), + ('ambulance',2,'chief_doctor','Medecin-chef',60,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), + ('ambulance',3,'boss','Chirurgien',80,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}') +; + +INSERT INTO `jobs` (name, label) VALUES + ('ambulance','Ambulance') +; \ No newline at end of file diff --git a/server/main.lua b/server/main.lua new file mode 100644 index 00000000..8d3bd208 --- /dev/null +++ b/server/main.lua @@ -0,0 +1,35 @@ +ESX = nil + +TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) + +RegisterServerEvent('esx_ambulancejob:revive') +AddEventHandler('esx_ambulancejob:revive', function(target) + TriggerClientEvent('esx_ambulancejob:revive', target) +end) + +ESX.RegisterServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function(source, cb) + + local xPlayer = ESX.GetPlayerFromId(source) + + if Config.RemoveCashAfterRPDeath then + xPlayer.set('money', 0) + xPlayer.setAccountMoney('black_money', 0) + end + + if Config.RemoveItemsAfterRPDeath then + for i=1, #xPlayer.inventory, 1 do + if xPlayer.inventory[i].count > 0 then + xPlayer.setInventoryItem(xPlayer.inventory[i].name, 0) + end + end + end + + if Config.RemoveWeaponsAfterRPDeath then + for i=1, #xPlayer.loadout, 1 do + xPlayer.removeWeapon(xPlayer.loadout[i].name) + end + end + + cb() + +end) \ No newline at end of file From 190cc5cf0d513655e77970943115150d7ae8bec0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20N=27gadi?= Date: Thu, 10 Aug 2017 19:12:07 +0200 Subject: [PATCH 005/177] Update config --- config.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.lua b/config.lua index 391eb068..aa86bf2c 100644 --- a/config.lua +++ b/config.lua @@ -2,7 +2,7 @@ Config = {} Config.DrawDistance = 100.0 Config.MarkerColor = {r = 102, g = 0, b = 102} Config.MarkerSize = {x = 1.5, y = 1.5, z = 1.0} -Config.RespawnDelayAfterRPDeath = 5 * 1000 +Config.RespawnDelayAfterRPDeath = 10 * 60 * 1000 Config.RemoveWeaponsAfterRPDeath = true Config.RemoveCashAfterRPDeath = true Config.RemoveItemsAfterRPDeath = true From dfadbcb6af0e92175fccdd711e99d00f904c7000 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20N=27gadi?= Date: Fri, 11 Aug 2017 12:51:25 +0200 Subject: [PATCH 006/177] Update esx_ambulancejob_full.sql --- esx_ambulancejob_full.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/esx_ambulancejob_full.sql b/esx_ambulancejob_full.sql index 7c8ecdac..f368789a 100644 --- a/esx_ambulancejob_full.sql +++ b/esx_ambulancejob_full.sql @@ -1,4 +1,4 @@ -USE `essentialmode` +USE `essentialmode`; INSERT INTO `addon_account` (name, label, shared) VALUES ('society_ambulance', 'Ambulance', 1), @@ -13,4 +13,4 @@ INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_ INSERT INTO `jobs` (name, label) VALUES ('ambulance','Ambulance') -; \ No newline at end of file +; From 11a894811c6fd2da841171be7053e48f1de1802c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20N=27gadi?= Date: Fri, 11 Aug 2017 12:51:37 +0200 Subject: [PATCH 007/177] Update esx_ambulancejob_minimal.sql --- esx_ambulancejob_minimal.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/esx_ambulancejob_minimal.sql b/esx_ambulancejob_minimal.sql index 2f7afe36..9f142868 100644 --- a/esx_ambulancejob_minimal.sql +++ b/esx_ambulancejob_minimal.sql @@ -1,4 +1,4 @@ -USE `essentialmode` +USE `essentialmode`; INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_female) VALUES ('ambulance',0,'ambulance','Ambulancier',20,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), @@ -9,4 +9,4 @@ INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_ INSERT INTO `jobs` (name, label) VALUES ('ambulance','Ambulance') -; \ No newline at end of file +; From d39bb1e4d516049f628a9794e4c8283b36a80a37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20N=27gadi?= Date: Fri, 11 Aug 2017 15:48:55 +0200 Subject: [PATCH 008/177] Add phone number --- client/main.lua | 13 +++++++++++++ server/main.lua | 17 +++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/client/main.lua b/client/main.lua index 30b5ae82..88d87c1a 100644 --- a/client/main.lua +++ b/client/main.lua @@ -449,6 +449,19 @@ AddEventHandler('esx:setJob', function(job) end) +RegisterNetEvent('esx_phone:loaded') +AddEventHandler('esx_phone:loaded', function(phoneNumber, contacts) + + local specialContact = { + name = 'Ambulance', + number = 'ambulance', + base64Icon = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEwAACxMBAJqcGAAABp5JREFUWIW1l21sFNcVhp/58npn195de23Ha4Mh2EASSvk0CPVHmmCEI0RCTQMBKVVooxYoalBVCVokICWFVFVEFeKoUdNECkZQIlAoFGMhIkrBQGxHwhAcChjbeLcsYHvNfsx+zNz+MBDWNrYhzSvdP+e+c973XM2cc0dihFi9Yo6vSzN/63dqcwPZcnEwS9PDmYoE4IxZIj+ciBb2mteLwlZdfji+dXtNU2AkeaXhCGteLZ/X/IS64/RoR5mh9tFVAaMiAldKQUGiRzFp1wXJPj/YkxblbfFLT/tjq9/f1XD0sQyse2li7pdP5tYeLXXMMGUojAiWKeOodE1gqpmNfN2PFeoF00T2uLGKfZzTwhzqbaEmeYWAQ0K1oKIlfPb7t+7M37aruXvEBlYvnV7xz2ec/2jNs9kKooKNjlksiXhJfLqf1PXOIU9M8fmw/XgRu523eTNyhhu6xLjbSeOFC6EX3t3V9PmwBla9Vv7K7u85d3bpqlwVcvHn7B8iVX+IFQoNKdwfstuFtWoFvwp9zj5XL7nRlPXyudjS9z+u35tmuH/lu6dl7+vSVXmDUcpbX+skP65BxOOPJA4gjDicOM2PciejeTwcsYek1hyl6me5nhNnmwPXBhjYuGC699OpzoaAO0PbYJSy5vgt4idOPrJwf6QuX2FO0oOtqIgj9pDU5dCWrMlyvXf86xsGgHyPeLos83Brns1WFXLxxgVBorHpW4vfQ6KhkbUtCot6srns1TLPjNVr7+1J0PepVc92H/Eagkb7IsTWd4ZMaN+yCXv5zLRY9GQ9xuYtQz4nfreWGdH9dNlkfnGq5/kdO88ekwGan1B3mDJsdMxCqv5w2Iq0khLs48vSllrsG/Y5pfojNugzScnQXKBVA8hrX51ddHq0o6wwIlgS8Y7obZdUZVjOYLC6e3glWkBBVHC2RJ+w/qezCuT/2sV6Q5VYpowjvnf/iBJJqvpYBgBS+w6wVB5DLEOiTZHWy36nNheg0jUBs3PoJnMfyuOdAECqrZ3K7KcACGQp89RAtlysCphqZhPtRzYlcPx+ExklJUiq0le5omCfOGFAYn3qFKS/fZAWS7a3Y2wa+GJOEy4US+B3aaPUYJamj4oI5LA/jWQBt5HIK5+JfXzZsJVpXi/ac8+mxWIXWzAG4Wb4g/jscNMp63I4U5FcKaVvsNyFALokSA47Kx8PVk83OabCHZsiqwAKEpjmfUJIkoh/R+L9oTpjluhRkGSPG4A7EkS+Y3HZk0OXYpIVNy01P5yItnptDsvtIwr0SunqoVP1GG1taTHn1CloXm9aLBEIEDl/IS2W6rg+qIFEYR7+OJTesqJqYa95/VKBNOHLjDBZ8sDS2998a0Bs/F//gvu5Z9NivadOc/U3676pEsizBIN1jCYlhClL+ELJDrkobNUBfBZqQfMN305HAgnIeYi4OnYMh7q/AsAXSdXK+eH41sykxd+TV/AsXvR/MeARAttD9pSqF9nDNfSEoDQsb5O31zQFprcaV244JPY7bqG6Xd9K3C3ALgbfk3NzqNE6CdplZrVFL27eWR+UASb6479ULfhD5AzOlSuGFTE6OohebElbcb8fhxA4xEPUgdTK19hiNKCZgknB+Ep44E44d82cxqPPOKctCGXzTmsBXbV1j1S5XQhyHq6NvnABPylu46A7QmVLpP7w9pNz4IEb0YyOrnmjb8bjB129fDBRkDVj2ojFbYBnCHHb7HL+OC7KQXeEsmAiNrnTqLy3d3+s/bvlVmxpgffM1fyM5cfsPZLuK+YHnvHELl8eUlwV4BXim0r6QV+4gD9Nlnjbfg1vJGktbI5UbN/TcGmAAYDG84Gry/MLLl/zKouO2Xukq/YkCyuWYV5owTIGjhVFCPL6J7kLOTcH89ereF1r4qOsm3gjSevl85El1Z98cfhB3qBN9+dLp1fUTco+0OrVMnNjFuv0chYbBYT2HcBoa+8TALyWQOt/ImPHoFS9SI3WyRajgdt2mbJgIlbREplfveuLf/XXemjXX7v46ZxzPlfd8YlZ01My5MUEVdIY5rueYopw4fQHkbv7/rZkTw6JwjyalBCHur9iD9cI2mU0UzD3P9H6yZ1G5dt7Gwe96w07dl5fXj7vYqH2XsNovdTI6KMrlsAXhRyz7/C7FBO/DubdVq4nBLPaohcnBeMr3/2k4fhQ+Uc8995YPq2wMzNjww2X+vwNt1p00ynrd2yKDJAVN628sBX1hZIdxXdStU9G5W2bd9YHR5L3f/CNmJeY9G8WAAAAAElFTkSuQmCC' + } + + TriggerEvent('esx_phone:addSpecialContact', specialContact.name, specialContact.number, specialContact.base64Icon) + +end) + AddEventHandler('baseevents:onPlayerDied', function(killerType, coords) TriggerEvent('esx_ambulancejob:onPlayerDeath') end) diff --git a/server/main.lua b/server/main.lua index 8d3bd208..7d4555fc 100644 --- a/server/main.lua +++ b/server/main.lua @@ -32,4 +32,21 @@ ESX.RegisterServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function( cb() +end) + +TriggerEvent('esx_phone:registerCallback', function(source, phoneNumber, message, anon) + + local xPlayer = ESX.GetPlayerFromId(source) + local xPlayers = ESX.GetPlayers() + + if phoneNumber == 'ambulance' then + for k, v in pairs(xPlayers) do + if v.job.name == 'ambulance' then + TriggerEvent('esx_phone:getDistpatchRequestId', function(requestId) + TriggerClientEvent('esx_phone:onMessage', v.source, xPlayer.get('phoneNumber'), message, xPlayer.get('coords'), anon, 'Alerte Ambulance', requestId) + end) + end + end + end + end) \ No newline at end of file From 043f1d6f0cfadae82c1bba2679973493a8b106e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20N=27gadi?= Date: Sat, 12 Aug 2017 11:41:43 +0200 Subject: [PATCH 009/177] Add start baseevents --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 73b28889..4c17b6e8 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ git clone https://github.com/FXServer-ESX/fxserver-esx_ambulancejob esx_ambulanc 4) Add this in your server.cfg : ``` +start baseevents start esx_ambulancejob ``` 5) * If you want player management you have to set Config.EnablePlayerManagement to true in config.lua From 3df33a64d385ca733859db61ac53f1eca8826627 Mon Sep 17 00:00:00 2001 From: Aleweadan Date: Sun, 13 Aug 2017 22:24:13 +0200 Subject: [PATCH 010/177] Minor fix --- esx_ambulancejob_full.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esx_ambulancejob_full.sql b/esx_ambulancejob_full.sql index f368789a..4d22f6be 100644 --- a/esx_ambulancejob_full.sql +++ b/esx_ambulancejob_full.sql @@ -1,7 +1,7 @@ USE `essentialmode`; INSERT INTO `addon_account` (name, label, shared) VALUES - ('society_ambulance', 'Ambulance', 1), + ('society_ambulance', 'Ambulance', 1) ; INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_female) VALUES From f2337dae21e3d1b6772afbd1da8a8c1d68d91f1a Mon Sep 17 00:00:00 2001 From: Don Date: Mon, 14 Aug 2017 14:37:48 -0700 Subject: [PATCH 011/177] multilanguagesupport Added multi-language support --- __resource.lua | 8 ++++++- client/main.lua | 64 ++++++++++++++++++++++++------------------------- config.lua | 1 + locales/en.lua | 33 +++++++++++++++++++++++++ locales/fr.lua | 33 +++++++++++++++++++++++++ 5 files changed, 106 insertions(+), 33 deletions(-) create mode 100644 locales/en.lua create mode 100644 locales/fr.lua diff --git a/__resource.lua b/__resource.lua index d181aa85..507ade9c 100644 --- a/__resource.lua +++ b/__resource.lua @@ -4,11 +4,17 @@ description 'ESX Ambulance Job' server_scripts { '@mysql-async/lib/MySQL.lua', + '@es_extended/locale.lua', + 'locales/en.lua', + 'locales/fr.lua', 'config.lua', 'server/main.lua' } client_scripts { + '@es_extended/locale.lua', + 'locales/en.lua', + 'locales/fr.lua', 'config.lua', 'client/main.lua' -} +} \ No newline at end of file diff --git a/client/main.lua b/client/main.lua index 88d87c1a..c7b67f96 100644 --- a/client/main.lua +++ b/client/main.lua @@ -114,7 +114,7 @@ function WarpPedInClosestVehicle(ped) end else - ESX.ShowNotification('Aucun véhicule à proximité') + ESX.ShowNotification(_U('no_vehicles')) end end @@ -122,12 +122,12 @@ end function OpenAmbulanceActionsMenu() local elements = { - {label = 'Vestiaire', value = 'cloakroom'} + {label = _U('cloakroom'), value = 'cloakroom'} } if Config.EnablePlayerManagement and PlayerData.job.grade_name == 'boss' then - table.insert(elements, {label = 'Retirer argent société', value = 'withdraw_society_money'}) - table.insert(elements, {label = 'Déposer argent', value = 'deposit_society_money'}) + table.insert(elements, {label = _U('withdraw_society'), value = 'withdraw_society_money'}) + table.insert(elements, {label = _U('deposit_society'), value = 'deposit_society_money'}) end ESX.UI.Menu.CloseAll() @@ -135,7 +135,7 @@ function OpenAmbulanceActionsMenu() ESX.UI.Menu.Open( 'default', GetCurrentResourceName(), 'ambulance_actions', { - title = 'Ambulance', + title = _U('ambulance'), elements = elements }, function(data, menu) @@ -149,14 +149,14 @@ function OpenAmbulanceActionsMenu() ESX.UI.Menu.Open( 'dialog', GetCurrentResourceName(), 'withdraw_society_money_amount', { - title = 'Montant du retrait' + title = _U('money_withdraw') }, function(data, menu) local amount = tonumber(data.value) if amount == nil then - ESX.ShowNotification('Montant invalide') + ESX.ShowNotification(_U('invalid_amount')) else menu.close() TriggerServerEvent('esx_society:withdrawMoney', 'ambulance', amount) @@ -175,14 +175,14 @@ function OpenAmbulanceActionsMenu() ESX.UI.Menu.Open( 'dialog', GetCurrentResourceName(), 'deposit_money_amount', { - title = 'Montant du dépôt' + title = _U('deposit_amount') }, function(data, menu) local amount = tonumber(data.value) if amount == nil then - ESX.ShowNotification('Montant invalide') + ESX.ShowNotification(_U('invalid_amount')) else menu.close() TriggerServerEvent('esx_society:depositMoney', 'ambulance', amount) @@ -202,7 +202,7 @@ function OpenAmbulanceActionsMenu() menu.close() CurrentAction = 'ambulance_actions_menu' - CurrentActionMsg = 'Appuyez sur ~INPUT_CONTEXT~ pour ouvrir le menu' + CurrentActionMsg = _U('open_menu') CurrentActionData = {} end @@ -217,9 +217,9 @@ function OpenMobileAmbulanceActionsMenu() ESX.UI.Menu.Open( 'default', GetCurrentResourceName(), 'mobile_ambulance_actions', { - title = 'Ambulance', + title = _U('ambulance'), elements = { - {label = 'Interaction citoyen', value = 'citizen_interaction'}, + {label = _U('ems_menu'), value = 'citizen_interaction'}, } }, function(data, menu) @@ -229,10 +229,10 @@ function OpenMobileAmbulanceActionsMenu() ESX.UI.Menu.Open( 'default', GetCurrentResourceName(), 'citizen_interaction', { - title = 'Ambulance - Interactions Citoyen', + title = _U('ems_menu_title'), elements = { - {label = 'Réanimer', value = 'revive'}, - {label = 'Mettre dans véhicule', value = 'put_in_vehicle'}, + {label = _U('ems_menu_revive'), value = 'revive'}, + {label = _U('ems_menu_putincar'), value = 'put_in_vehicle'}, } }, function(data, menu) @@ -244,7 +244,7 @@ function OpenMobileAmbulanceActionsMenu() local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() if closestPlayer == -1 or closestDistance > 3.0 then - ESX.ShowNotification('Aucun joueur à proximité') + ESX.ShowNotification(_U('no_players')) else local ped = GetPlayerPed(closestPlayer) @@ -257,7 +257,7 @@ function OpenMobileAmbulanceActionsMenu() Citizen.CreateThread(function() - ESX.ShowNotification('Réanimation en cours') + ESX.ShowNotification(_U('revive_inprogress')) TaskStartScenarioInPlace(playerPed, 'CODE_HUMAN_MEDIC_TEND_TO_DEAD', 0, true) Citizen.Wait(10000) @@ -265,15 +265,15 @@ function OpenMobileAmbulanceActionsMenu() if GetEntityHealth(closestPlayerPed) == 0 then TriggerServerEvent('esx_ambulancejob:revive', GetPlayerServerId(closestPlayer)) - ESX.ShowNotification('Vous avez réanimé ' .. GetPlayerName(closestPlayer)) + ESX.ShowNotification(_U('revive_complete') .. GetPlayerName(closestPlayer)) else - ESX.ShowNotification(GetPlayerName(closestPlayer) .. ' a succombé') + ESX.ShowNotification(GetPlayerName(closestPlayer) .. _U('isdead')) end end) else - ESX.ShowNotification(GetPlayerName(closestPlayer) .. ' n\'est pas inconscient') + ESX.ShowNotification(GetPlayerName(closestPlayer) .. _U('unconscious')) end end @@ -306,11 +306,11 @@ function OpenCloakroomMenu() ESX.UI.Menu.Open( 'default', GetCurrentResourceName(), 'cloakroom', { - title = 'Vestiaire', + title = _U('cloakroom'), align = 'top-left', elements = { - {label = 'Tenue Civil', value = 'citizen_wear'}, - {label = 'Tenue Ambulancier', value = 'ambulance_wear'}, + {label = _U('ems_clothes_civil'), value = 'citizen_wear'}, + {label = _U('ems_clothes_ems'), value = 'ambulance_wear'}, }, }, function(data, menu) @@ -340,7 +340,7 @@ function OpenCloakroomMenu() end CurrentAction = 'ambulance_actions_menu' - CurrentActionMsg = 'Appuyez sur ~INPUT_CONTEXT~ pour ouvrir le menu' + CurrentActionMsg = _U('open_menu') CurrentActionData = {} end, @@ -356,11 +356,11 @@ function OpenVehicleSpawnerMenu() ESX.UI.Menu.Open( 'default', GetCurrentResourceName(), 'cloakroom', { - title = 'Véhicule', + title = _U('veh_menu'), align = 'top-left', elements = { - {label = 'Ambulance', value = 'ambulance'}, - {label = 'Hélicoptère', value = 'polmav'}, + {label = _U('ambulance'), value = 'ambulance'}, + {label = _U('helicopter'), value = 'polmav'}, }, }, function(data, menu) @@ -388,7 +388,7 @@ function OpenVehicleSpawnerMenu() menu.close() CurrentAction = 'vehicle_spawner_menu' - CurrentActionMsg = 'Appuyez sur ~INPUT_CONTEXT~ pour sortir un véhicule' + CurrentActionMsg = _U('veh_spawn') CurrentActionData = {} end @@ -533,13 +533,13 @@ AddEventHandler('esx_ambulancejob:hasEnteredMarker', function(zone) if zone == 'AmbulanceActions' and PlayerData.job ~= nil and PlayerData.job.name == 'ambulance' then CurrentAction = 'ambulance_actions_menu' - CurrentActionMsg = 'Appuyez sur ~INPUT_CONTEXT~ pour ouvrir le menu' + CurrentActionMsg = _U('open_menu') CurrentActionData = {} end if zone == 'VehicleSpawner' and PlayerData.job ~= nil and PlayerData.job.name == 'ambulance' then CurrentAction = 'vehicle_spawner_menu' - CurrentActionMsg = 'Appuyez sur ~INPUT_CONTEXT~ pour sortir un véhicule' + CurrentActionMsg = _U('veh_spawn') CurrentActionData = {} end @@ -559,7 +559,7 @@ AddEventHandler('esx_ambulancejob:hasEnteredMarker', function(zone) if distance ~= -1 and distance <= 1.0 then CurrentAction = 'delete_vehicle' - CurrentActionMsg = 'Appuyez sur ~INPUT_CONTEXT~ pour ranger le véhicule' + CurrentActionMsg = _U('store_veh') CurrentActionData = {vehicle = vehicle} end @@ -585,7 +585,7 @@ Citizen.CreateThread(function() SetBlipAsShortRange(blip, true) BeginTextCommandSetBlipName("STRING") - AddTextComponentString("Hôpital") + AddTextComponentString(_U('hospital')) EndTextCommandSetBlipName(blip) end) diff --git a/config.lua b/config.lua index aa86bf2c..f41fe565 100644 --- a/config.lua +++ b/config.lua @@ -7,6 +7,7 @@ Config.RemoveWeaponsAfterRPDeath = true Config.RemoveCashAfterRPDeath = true Config.RemoveItemsAfterRPDeath = true Config.EnablePlayerManagement = false +Config.Locale = 'fr' Config.Zones = { diff --git a/locales/en.lua b/locales/en.lua new file mode 100644 index 00000000..26d663dd --- /dev/null +++ b/locales/en.lua @@ -0,0 +1,33 @@ +Locales['en'] = { + --Cloakroom + ['cloakroom'] = 'locker Room', + ['ems_clothes_civil'] = 'civilian Clothes', + ['ems_clothes_ems'] = 'eMS Clothes', + --Vehicles + ['veh_menu'] = 'vehicle', + ['veh_spawn'] = 'press ~INPUT_CONTEXT~ to get a Vehicle or Helicopter', + ['store_veh'] = 'press ~INPUT_CONTEXT~ to store the vehicle', + ['ambulance'] = 'ambulance', + ['helicopter'] = 'helicopter', + --Action Menu + ['hospital'] = 'hospital', + ['revive_inprogress'] = 'revive in progress', + ['revive_complete'] = 'you have been revived ', + ['no_players'] = 'no players nearby', + ['no_vehicles'] = 'no vehicles nearby', + ['isdead'] = 'is dead', + ['unconscious'] = 'is not unconscious', + --Boss Menu + ['deposit_society'] = 'eMS Deposit', + ['withdraw_society'] = 'eMS Withdraw', + --Misc + ['invalid_amount'] = '~r~invalid amount', + ['open_menu'] = 'press ~INPUT_CONTEXT~ to open the menu', + ['deposit_amount'] = 'deposit Amount', + ['money_withdraw'] = 'amount withdrawn', + -- F6 Menu + ['ems_menu'] = 'eMS Menu', + ['ems_menu_title'] = 'ambulance - EMS Menu', + ['ems_menu_revive'] = 'revive Player', + ['ems_menu_putincar'] = 'put in Vehicle', +} \ No newline at end of file diff --git a/locales/fr.lua b/locales/fr.lua new file mode 100644 index 00000000..da7d1d2e --- /dev/null +++ b/locales/fr.lua @@ -0,0 +1,33 @@ +Locales['fr'] = { + --Cloakroom + ['cloakroom'] = 'Vestiaire', + ['ems_clothes_civil'] = 'Tenue Civil', + ['ems_clothes_ems'] = 'Tenue Ambulancier', + --Vehicles + ['veh_menu'] = 'véhicule', + ['veh_spawn'] = 'appuyez sur ~INPUT_CONTEXT~ pour sortir un véhicule', + ['store_veh'] = 'appuyez sur ~INPUT_CONTEXT~ pour ranger le véhicule', + ['ambulance'] = 'ambulance', + ['helicopter'] = 'hélicoptère', + --Action Menu + ['hospital'] = 'hôpital', + ['revive_inprogress'] = 'réanimation en cours', + ['revive_complete'] = 'vous avez réanimé ', + ['no_players'] = 'aucun joueur à proximité', + ['no_vehicles'] = 'aucun véhicule à proximité', + ['isdead'] = 'a succombé', + ['unconscious'] = 'n\'est pas inconscient', + --Boss Menu + ['deposit_society'] = 'déposer argent', + ['withdraw_society'] = 'retirer argent société', + --Misc + ['invalid_amount'] = '~r~montant invalide', + ['open_menu'] = 'appuyez sur ~INPUT_CONTEXT~ pour ouvrir le menu', + ['deposit_amount'] = 'montant du dépôt', + ['money_withdraw'] = 'montant du retrait', + -- F6 Menu + ['ems_menu'] = 'interaction citoyen', + ['ems_menu_title'] = 'ambulance - Interactions Citoyen', + ['ems_menu_revive'] = 'réanimer', + ['ems_menu_putincar'] = 'mettre dans véhicule', +} \ No newline at end of file From 5da1121666e021f64aba2f969b87813d21135d3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20N=27gadi?= Date: Wed, 16 Aug 2017 16:02:00 +0200 Subject: [PATCH 012/177] Close menus when exiting markers --- client/main.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/client/main.lua b/client/main.lua index c7b67f96..0e262bd4 100644 --- a/client/main.lua +++ b/client/main.lua @@ -571,6 +571,7 @@ AddEventHandler('esx_ambulancejob:hasEnteredMarker', function(zone) end) AddEventHandler('esx_ambulancejob:hasExitedMarker', function(zone) + ESX.UI.Menu.CloseAll() CurrentAction = nil end) From 9b06e8d1f909ef59ecba9d209a7dfd195c9b030e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20N=27gadi?= Date: Wed, 16 Aug 2017 16:07:29 +0200 Subject: [PATCH 013/177] Fix VehicleDeleter --- client/main.lua | 4 ++-- config.lua | 13 ++++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/client/main.lua b/client/main.lua index 0e262bd4..418ea4b3 100644 --- a/client/main.lua +++ b/client/main.lua @@ -602,7 +602,7 @@ Citizen.CreateThread(function() for k,v in pairs(Config.Zones) do if(v.Type ~= -1 and GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < Config.DrawDistance) then - DrawMarker(v.Type, v.Pos.x, v.Pos.y, v.Pos.z, 0.0, 0.0, 0.0, 0, 0.0, 0.0, Config.MarkerSize.x, Config.MarkerSize.y, Config.MarkerSize.z, Config.MarkerColor.r, Config.MarkerColor.g, Config.MarkerColor.b, 100, false, true, 2, false, false, false, false) + DrawMarker(v.Type, v.Pos.x, v.Pos.y, v.Pos.z, 0.0, 0.0, 0.0, 0, 0.0, 0.0, v.Size.x, v.Size.y, v.Size.z, Config.MarkerColor.r, Config.MarkerColor.g, Config.MarkerColor.b, 100, false, true, 2, false, false, false, false) end end @@ -620,7 +620,7 @@ Citizen.CreateThread(function() local currentZone = nil for k,v in pairs(Config.Zones) do - if(GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < Config.MarkerSize.x) then + if(GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < v.Size.x) then isInMarker = true currentZone = k end diff --git a/config.lua b/config.lua index f41fe565..209fef42 100644 --- a/config.lua +++ b/config.lua @@ -1,7 +1,6 @@ Config = {} Config.DrawDistance = 100.0 Config.MarkerColor = {r = 102, g = 0, b = 102} -Config.MarkerSize = {x = 1.5, y = 1.5, z = 1.0} Config.RespawnDelayAfterRPDeath = 10 * 60 * 1000 Config.RemoveWeaponsAfterRPDeath = true Config.RemoveCashAfterRPDeath = true @@ -14,61 +13,73 @@ Config.Zones = { HospitalInteriorEntering1 = { Pos = {x = 1151.447, y = -1529.491, z = 34.375}, + Size = {x = 1.5, y = 1.5, z = 1.0}, Type = 1 }, HospitalInteriorInside1 = { Pos = {x = 251.464, y = -1369.770, z = 28.648}, + Size = {x = 1.5, y = 1.5, z = 1.0}, Type = -1 }, HospitalInteriorOutside1 = { Pos = {x = 1153.364, y = -1525.731, z = 33.843}, + Size = {x = 1.5, y = 1.5, z = 1.0}, Type = -1 }, HospitalInteriorExit1 = { Pos = {x = 253.612, y = -1371.66, z = 28.647}, + Size = {x = 1.5, y = 1.5, z = 1.0}, Type = 1 }, HospitalInteriorEntering2 = { Pos = {x = 1137.181, y = -1597.504, z = 33.692}, + Size = {x = 1.5, y = 1.5, z = 1.0}, Type = 1 }, HospitalInteriorInside2 = { Pos = {x = 240.508, y = -1360.565, z = 28.647}, + Size = {x = 1.5, y = 1.5, z = 1.0}, Type = -1 }, HospitalInteriorOutside2 = { Pos = {x = 1137.922, y = -1601.434, z = 33.692}, + Size = {x = 1.5, y = 1.5, z = 1.0}, Type = -1 }, HospitalInteriorExit2 = { Pos = {x = 238.587, y = -1359.113, z = 28.647}, + Size = {x = 1.5, y = 1.5, z = 1.0}, Type = 1 }, AmbulanceActions = { Pos = {x = 244.048, y = -1366.330, z = 28.647}, + Size = {x = 1.5, y = 1.5, z = 1.0}, Type = 1 }, VehicleSpawner = { Pos = {x = 1128.290, y = -1601.451, z = 33.893}, + Size = {x = 1.5, y = 1.5, z = 1.0}, Type = 1 }, VehicleSpawnPoint = { Pos = {x = 1138.061, y = -1607.882, z = 34.692}, + Size = {x = 1.5, y = 1.5, z = 1.0}, Type = -1 }, VehicleDeleter = { Pos = {x = 1122.436, y = -1617.600, z = 33.692}, + Size = {x = 3.0, y = 3.0, z = 2.0}, Type = 1 } From 2e4c14ea58281094aeea09f96ca3e675ef9dcc0f Mon Sep 17 00:00:00 2001 From: TakumiBR <31086346+TakumiBR@users.noreply.github.com> Date: Thu, 17 Aug 2017 09:04:56 -0700 Subject: [PATCH 014/177] Multi-language support Brazilian Portuguese translation. --- __resource.lua | 4 +++- locales/br.lua | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 locales/br.lua diff --git a/__resource.lua b/__resource.lua index 507ade9c..1a7000ed 100644 --- a/__resource.lua +++ b/__resource.lua @@ -5,7 +5,8 @@ description 'ESX Ambulance Job' server_scripts { '@mysql-async/lib/MySQL.lua', '@es_extended/locale.lua', - 'locales/en.lua', + 'locales/br.lua', + 'locales/en.lua', 'locales/fr.lua', 'config.lua', 'server/main.lua' @@ -13,6 +14,7 @@ server_scripts { client_scripts { '@es_extended/locale.lua', + 'locales/br.lua', 'locales/en.lua', 'locales/fr.lua', 'config.lua', diff --git a/locales/br.lua b/locales/br.lua new file mode 100644 index 00000000..3cc3d33c --- /dev/null +++ b/locales/br.lua @@ -0,0 +1,33 @@ +Locales['br'] = { + --Cloakroom + ['cloakroom'] = 'Vestiario', + ['ems_clothes_civil'] = 'Roupa casual', + ['ems_clothes_ems'] = 'Uniforme paramedico', + --Vehicles + ['veh_menu'] = 'Veículo', + ['veh_spawn'] = 'Pressione ~INPUT_CONTEXT~ para escolher veículo ou helicoptero', + ['store_veh'] = 'Pressione ~INPUT_CONTEXT~ para gaurdar o veículo', + ['ambulance'] = 'Ambulância', + ['helicopter'] = 'Helicoptero', + --Action Menu + ['hospital'] = 'Hospital', + ['revive_inprogress'] = 'Reanimação em progresso', + ['revive_complete'] = 'Você reviveu', + ['no_players'] = 'Nenhum jogador nas proximidades', + ['no_vehicles'] = 'Nenhum veículo nas proximidades', + ['isdead'] = 'esta morto', + ['unconscious'] = 'Não está inconsciente', + --Boss Menu + ['deposit_society'] = 'eMS Depositou', + ['withdraw_society'] = 'eMS Sacou', + --Misc + ['invalid_amount'] = '~r~quantidade inválida', + ['open_menu'] = 'Pressione ~INPUT_CONTEXT~ para abrir o menu', + ['deposit_amount'] = 'Quantidade para deposito', + ['money_withdraw'] = 'Quantidade para sacar', + -- F6 Menu + ['ems_menu'] = 'eMS Menu', + ['ems_menu_title'] = 'Paramedico - EMS Menu', + ['ems_menu_revive'] = 'Reviver jogador', + ['ems_menu_putincar'] = 'Colocar no veículo', +} \ No newline at end of file From 9a764e0370fb4fc1cc13f63e32a16f6e8399af5c Mon Sep 17 00:00:00 2001 From: nearbyplayer Date: Thu, 17 Aug 2017 22:44:04 -0400 Subject: [PATCH 015/177] Add missing translation --- locales/br.lua | 2 ++ locales/en.lua | 2 ++ locales/fr.lua | 2 ++ server/main.lua | 6 +++--- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/locales/br.lua b/locales/br.lua index 3cc3d33c..b90a21b8 100644 --- a/locales/br.lua +++ b/locales/br.lua @@ -30,4 +30,6 @@ Locales['br'] = { ['ems_menu_title'] = 'Paramedico - EMS Menu', ['ems_menu_revive'] = 'Reviver jogador', ['ems_menu_putincar'] = 'Colocar no veículo', + -- Phone + ['alert_ambulance'] = 'ambulância de alerta', } \ No newline at end of file diff --git a/locales/en.lua b/locales/en.lua index 26d663dd..80573437 100644 --- a/locales/en.lua +++ b/locales/en.lua @@ -30,4 +30,6 @@ Locales['en'] = { ['ems_menu_title'] = 'ambulance - EMS Menu', ['ems_menu_revive'] = 'revive Player', ['ems_menu_putincar'] = 'put in Vehicle', + -- Phone + ['alert_ambulance'] = 'alert Ambulance', } \ No newline at end of file diff --git a/locales/fr.lua b/locales/fr.lua index da7d1d2e..dc9819e1 100644 --- a/locales/fr.lua +++ b/locales/fr.lua @@ -30,4 +30,6 @@ Locales['fr'] = { ['ems_menu_title'] = 'ambulance - Interactions Citoyen', ['ems_menu_revive'] = 'réanimer', ['ems_menu_putincar'] = 'mettre dans véhicule', + -- Phone + ['alert_ambulance'] = 'alerte Ambulance', } \ No newline at end of file diff --git a/server/main.lua b/server/main.lua index 7d4555fc..923cc28b 100644 --- a/server/main.lua +++ b/server/main.lua @@ -43,10 +43,10 @@ TriggerEvent('esx_phone:registerCallback', function(source, phoneNumber, message for k, v in pairs(xPlayers) do if v.job.name == 'ambulance' then TriggerEvent('esx_phone:getDistpatchRequestId', function(requestId) - TriggerClientEvent('esx_phone:onMessage', v.source, xPlayer.get('phoneNumber'), message, xPlayer.get('coords'), anon, 'Alerte Ambulance', requestId) + TriggerClientEvent('esx_phone:onMessage', v.source, xPlayer.get('phoneNumber'), message, xPlayer.get('coords'), anon, _U('alert_ambulance'), requestId) end) end end end - -end) \ No newline at end of file + +end) From 71c8a2c526f027a3c7dfe450c12566a99ba31274 Mon Sep 17 00:00:00 2001 From: renaiku Date: Sat, 19 Aug 2017 01:13:33 +0200 Subject: [PATCH 016/177] Add a menu to ask the player if he wants to be respawned at the hospital. --- client/main.lua | 58 +++++++++++++++++++++++++++++++++++++++++++++++++ config.lua | 1 + locales/fr.lua | 2 ++ 3 files changed, 61 insertions(+) diff --git a/client/main.lua b/client/main.lua index 418ea4b3..82f8a623 100644 --- a/client/main.lua +++ b/client/main.lua @@ -37,6 +37,63 @@ function RespawnPed(ped, coords) SetPlayerInvincible(ped, false) TriggerEvent('playerSpawned', coords.x, coords.y, coords.z, coords.heading) ClearPedBloodDamage(ped) + ESX.UI.Menu.CloseAll() +end + +function StartRespawnToHospitalMenuTimer() + Citizen.Trace('starting timer') + ESX.SetTimeout(Config.MenuRespawnToHospitalDelay, function() + + Citizen.Trace('menu should appear') + + if IsDead then + + local elements = {} + + table.insert(elements, {label = 'OUI', value = 'yes'}) + + ESX.UI.Menu.Open( + 'default', GetCurrentResourceName(), 'menuName', + { + title = _U('respawn_at_hospital'), + align = 'top-left', + elements = elements + }, + function(data, menu) --Submit Cb + menu.close() + + Citizen.CreateThread(function() + + DoScreenFadeOut(800) + + while not IsScreenFadedOut() do + Citizen.Wait(0) + end + + ESX.TriggerServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function() + + TriggerServerEvent('esx:updateLastPosition', Config.Zones.HospitalInteriorInside1.Pos) + + RespawnPed(GetPlayerPed(-1), Config.Zones.HospitalInteriorInside1.Pos) + StopScreenEffect('DeathFailOut') + DoScreenFadeIn(800) + end) + + end) + end, + function(data, menu) --Cancel Cb + --menu.close() + end, + function(data, menu) --Change Cb + --print(data.current.value) + end + ) + + + end + + end) + end function StartRespawnTimer() @@ -475,6 +532,7 @@ AddEventHandler('esx_ambulancejob:onPlayerDeath', function() IsDead = true StartRespawnTimer() + StartRespawnToHospitalMenuTimer() StartScreenEffect('DeathFailOut', 0, false) end) diff --git a/config.lua b/config.lua index 209fef42..8e1b8a90 100644 --- a/config.lua +++ b/config.lua @@ -2,6 +2,7 @@ Config = {} Config.DrawDistance = 100.0 Config.MarkerColor = {r = 102, g = 0, b = 102} Config.RespawnDelayAfterRPDeath = 10 * 60 * 1000 +Config.MenuRespawnToHospitalDelay= 1 * 60 * 1000 Config.RemoveWeaponsAfterRPDeath = true Config.RemoveCashAfterRPDeath = true Config.RemoveItemsAfterRPDeath = true diff --git a/locales/fr.lua b/locales/fr.lua index dc9819e1..44cf4e5c 100644 --- a/locales/fr.lua +++ b/locales/fr.lua @@ -32,4 +32,6 @@ Locales['fr'] = { ['ems_menu_putincar'] = 'mettre dans véhicule', -- Phone ['alert_ambulance'] = 'alerte Ambulance', + -- Death + ['respawn_at_hospital'] = 'voulez-vous être transporté à l\'hôpital ?', } \ No newline at end of file From 4a723faf853bded359f2bdc73e6d6362cfda62fa Mon Sep 17 00:00:00 2001 From: nearbyplayer Date: Fri, 18 Aug 2017 19:27:05 -0400 Subject: [PATCH 017/177] Update multi-language support --- client/main.lua | 82 ++++++++++++++++++++++++------------------------- locales/en.lua | 5 ++- locales/fr.lua | 3 +- 3 files changed, 47 insertions(+), 43 deletions(-) diff --git a/client/main.lua b/client/main.lua index 82f8a623..cc574eb7 100644 --- a/client/main.lua +++ b/client/main.lua @@ -1,12 +1,12 @@ DoScreenFadeIn(0) local Keys = { - ["ESC"] = 322, ["F1"] = 288, ["F2"] = 289, ["F3"] = 170, ["F5"] = 166, ["F6"] = 167, ["F7"] = 168, ["F8"] = 169, ["F9"] = 56, ["F10"] = 57, - ["~"] = 243, ["1"] = 157, ["2"] = 158, ["3"] = 160, ["4"] = 164, ["5"] = 165, ["6"] = 159, ["7"] = 161, ["8"] = 162, ["9"] = 163, ["-"] = 84, ["="] = 83, ["BACKSPACE"] = 177, + ["ESC"] = 322, ["F1"] = 288, ["F2"] = 289, ["F3"] = 170, ["F5"] = 166, ["F6"] = 167, ["F7"] = 168, ["F8"] = 169, ["F9"] = 56, ["F10"] = 57, + ["~"] = 243, ["1"] = 157, ["2"] = 158, ["3"] = 160, ["4"] = 164, ["5"] = 165, ["6"] = 159, ["7"] = 161, ["8"] = 162, ["9"] = 163, ["-"] = 84, ["="] = 83, ["BACKSPACE"] = 177, ["TAB"] = 37, ["Q"] = 44, ["W"] = 32, ["E"] = 38, ["R"] = 45, ["T"] = 245, ["Y"] = 246, ["U"] = 303, ["P"] = 199, ["["] = 39, ["]"] = 40, ["ENTER"] = 18, ["CAPS"] = 137, ["A"] = 34, ["S"] = 8, ["D"] = 9, ["F"] = 23, ["G"] = 47, ["H"] = 74, ["K"] = 311, ["L"] = 182, ["LEFTSHIFT"] = 21, ["Z"] = 20, ["X"] = 73, ["C"] = 26, ["V"] = 0, ["B"] = 29, ["N"] = 249, ["M"] = 244, [","] = 82, ["."] = 81, - ["LEFTCTRL"] = 36, ["LEFTALT"] = 19, ["SPACE"] = 22, ["RIGHTCTRL"] = 70, + ["LEFTCTRL"] = 36, ["LEFTALT"] = 19, ["SPACE"] = 22, ["RIGHTCTRL"] = 70, ["HOME"] = 213, ["PAGEUP"] = 10, ["PAGEDOWN"] = 11, ["DELETE"] = 178, ["LEFT"] = 174, ["RIGHT"] = 175, ["TOP"] = 27, ["DOWN"] = 173, ["NENTER"] = 201, ["N4"] = 108, ["N5"] = 60, ["N6"] = 107, ["N+"] = 96, ["N-"] = 97, ["N7"] = 117, ["N8"] = 61, ["N9"] = 118 @@ -33,8 +33,8 @@ end) function RespawnPed(ped, coords) SetEntityCoordsNoOffset(ped, coords.x, coords.y, coords.z, false, false, false, true) - NetworkResurrectLocalPlayer(coords.x, coords.y, coords.z, coords.heading, true, false) - SetPlayerInvincible(ped, false) + NetworkResurrectLocalPlayer(coords.x, coords.y, coords.z, coords.heading, true, false) + SetPlayerInvincible(ped, false) TriggerEvent('playerSpawned', coords.x, coords.y, coords.z, coords.heading) ClearPedBloodDamage(ped) ESX.UI.Menu.CloseAll() @@ -45,12 +45,12 @@ function StartRespawnToHospitalMenuTimer() ESX.SetTimeout(Config.MenuRespawnToHospitalDelay, function() Citizen.Trace('menu should appear') - + if IsDead then local elements = {} - table.insert(elements, {label = 'OUI', value = 'yes'}) + table.insert(elements, {label = _U('yes'), value = 'yes'}) ESX.UI.Menu.Open( 'default', GetCurrentResourceName(), 'menuName', @@ -63,13 +63,13 @@ function StartRespawnToHospitalMenuTimer() menu.close() Citizen.CreateThread(function() - + DoScreenFadeOut(800) - + while not IsScreenFadedOut() do Citizen.Wait(0) end - + ESX.TriggerServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function() TriggerServerEvent('esx:updateLastPosition', Config.Zones.HospitalInteriorInside1.Pos) @@ -88,8 +88,8 @@ function StartRespawnToHospitalMenuTimer() --print(data.current.value) end ) - - + + end end) @@ -99,17 +99,17 @@ end function StartRespawnTimer() ESX.SetTimeout(Config.RespawnDelayAfterRPDeath, function() - + if IsDead then - + Citizen.CreateThread(function() - + DoScreenFadeOut(800) - + while not IsScreenFadedOut() do Citizen.Wait(0) end - + ESX.TriggerServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function() TriggerServerEvent('esx:updateLastPosition', Config.Zones.HospitalInteriorInside1.Pos) @@ -129,9 +129,9 @@ end function TeleportFadeEffect(entity, coords) Citizen.CreateThread(function() - + DoScreenFadeOut(800) - + while not IsScreenFadedOut() do Citizen.Wait(0) end @@ -255,7 +255,7 @@ function OpenAmbulanceActionsMenu() end, function(data, menu) - + menu.close() CurrentAction = 'ambulance_actions_menu' @@ -313,7 +313,7 @@ function OpenMobileAmbulanceActionsMenu() local closestPlayerPed = GetPlayerPed(closestPlayer) Citizen.CreateThread(function() - + ESX.ShowNotification(_U('revive_inprogress')) TaskStartScenarioInPlace(playerPed, 'CODE_HUMAN_MEDIC_TEND_TO_DEAD', 0, true) @@ -334,7 +334,7 @@ function OpenMobileAmbulanceActionsMenu() end end - + end if data.current.value == 'put_in_vehicle' then @@ -371,11 +371,11 @@ function OpenCloakroomMenu() }, }, function(data, menu) - + menu.close() if data.current.value == 'citizen_wear' then - + ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin) TriggerEvent('skinchanger:loadSkin', skin) end) @@ -391,7 +391,7 @@ function OpenCloakroomMenu() else TriggerEvent('skinchanger:loadClothes', skin, jobSkin.skin_female) end - + end) end @@ -421,7 +421,7 @@ function OpenVehicleSpawnerMenu() }, }, function(data, menu) - + menu.close() local model = data.current.value @@ -441,7 +441,7 @@ function OpenVehicleSpawnerMenu() end, function(data, menu) - + menu.close() CurrentAction = 'vehicle_spawner_menu' @@ -544,13 +544,13 @@ AddEventHandler('esx_ambulancejob:revive', function() local coords = GetEntityCoords(playerPed) Citizen.CreateThread(function() - + DoScreenFadeOut(800) - + while not IsScreenFadedOut() do Citizen.Wait(0) end - + TriggerServerEvent('esx:updateLastPosition', { x = coords.x, y = coords.y, @@ -602,7 +602,7 @@ AddEventHandler('esx_ambulancejob:hasEnteredMarker', function(zone) end if zone == 'VehicleDeleter' and PlayerData.job ~= nil and PlayerData.job.name == 'ambulance' then - + local playerPed = GetPlayerPed(-1) local coords = GetEntityCoords(playerPed) @@ -637,12 +637,12 @@ end) Citizen.CreateThread(function() local blip = AddBlipForCoord(Config.Zones.HospitalInteriorOutside1.Pos.x, Config.Zones.HospitalInteriorOutside1.Pos.y, Config.Zones.HospitalInteriorOutside1.Pos.z) - + SetBlipSprite (blip, 61) SetBlipDisplay(blip, 4) SetBlipScale (blip, 1.2) SetBlipAsShortRange(blip, true) - + BeginTextCommandSetBlipName("STRING") AddTextComponentString(_U('hospital')) EndTextCommandSetBlipName(blip) @@ -652,11 +652,11 @@ end) -- Display markers Citizen.CreateThread(function() while true do - + Wait(0) - + local coords = GetEntityCoords(GetPlayerPed(-1)) - + for k,v in pairs(Config.Zones) do if(v.Type ~= -1 and GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < Config.DrawDistance) then @@ -670,8 +670,8 @@ end) -- Activate menu when player is inside marker Citizen.CreateThread(function() while true do - - Wait(0) + + Wait(0) local coords = GetEntityCoords(GetPlayerPed(-1)) local isInMarker = false @@ -711,7 +711,7 @@ Citizen.CreateThread(function() DisplayHelpTextFromStringLabel(0, 0, 1, -1) if IsControlPressed(0, Keys['E']) and PlayerData.job ~= nil and PlayerData.job.name == 'ambulance' and (GetGameTimer() - GUI.Time) > 150 then - + if CurrentAction == 'ambulance_actions_menu' then OpenAmbulanceActionsMenu() end @@ -726,7 +726,7 @@ Citizen.CreateThread(function() CurrentAction = nil GUI.Time = GetGameTimer() - + end end @@ -744,4 +744,4 @@ Citizen.CreateThread(function() LoadMpDlcMaps() EnableMpDlcMaps(true) RequestIpl('Coroner_Int_on') -- Morgue -end) \ No newline at end of file +end) diff --git a/locales/en.lua b/locales/en.lua index 80573437..73d76553 100644 --- a/locales/en.lua +++ b/locales/en.lua @@ -32,4 +32,7 @@ Locales['en'] = { ['ems_menu_putincar'] = 'put in Vehicle', -- Phone ['alert_ambulance'] = 'alert Ambulance', -} \ No newline at end of file + -- Death + ['respawn_at_hospital'] = 'do you want to be tranported to the hospital?', + ['yes'] = 'yes', +} diff --git a/locales/fr.lua b/locales/fr.lua index 44cf4e5c..c276c069 100644 --- a/locales/fr.lua +++ b/locales/fr.lua @@ -34,4 +34,5 @@ Locales['fr'] = { ['alert_ambulance'] = 'alerte Ambulance', -- Death ['respawn_at_hospital'] = 'voulez-vous être transporté à l\'hôpital ?', -} \ No newline at end of file + ['yes'] = 'oui', +} From 76f24ff53166fbb9eb978cc22bae9d97def383ee Mon Sep 17 00:00:00 2001 From: nearbyplayer Date: Sat, 19 Aug 2017 00:34:50 -0400 Subject: [PATCH 018/177] Update multi-language support --- locales/br.lua | 5 ++++- locales/en.lua | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/locales/br.lua b/locales/br.lua index b90a21b8..a56396c1 100644 --- a/locales/br.lua +++ b/locales/br.lua @@ -32,4 +32,7 @@ Locales['br'] = { ['ems_menu_putincar'] = 'Colocar no veículo', -- Phone ['alert_ambulance'] = 'ambulância de alerta', -} \ No newline at end of file + -- Death + ['respawn_at_hospital'] = 'você quer ser transportado para o hospital?', + ['yes'] = 'sim', +} diff --git a/locales/en.lua b/locales/en.lua index 73d76553..fa8ddfce 100644 --- a/locales/en.lua +++ b/locales/en.lua @@ -33,6 +33,6 @@ Locales['en'] = { -- Phone ['alert_ambulance'] = 'alert Ambulance', -- Death - ['respawn_at_hospital'] = 'do you want to be tranported to the hospital?', + ['respawn_at_hospital'] = 'do you want to be transported to the hospital?', ['yes'] = 'yes', } From fdad0691cd05dc40eac9b79e137e8924d77fb194 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20N=27gadi?= Date: Sun, 20 Aug 2017 13:31:20 +0200 Subject: [PATCH 019/177] Add /respawn command --- server/main.lua | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/server/main.lua b/server/main.lua index 923cc28b..7b9b4870 100644 --- a/server/main.lua +++ b/server/main.lua @@ -48,5 +48,17 @@ TriggerEvent('esx_phone:registerCallback', function(source, phoneNumber, message end end end - + end) + +TriggerEvent('es:addGroupCommand', 'respawn', 'admin', function(source, args, user) + + if args[2] ~= nil then + TriggerClientEvent('esx_ambulancejob:revive', tonumber(args[2])) + else + TriggerClientEvent('esx_ambulancejob:revive', source) + end + +end, function(source, args, user) + TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "Insufficient Permissions.") +end, {help = 'Respawn', params = {{name = 'id'}}}) \ No newline at end of file From f48f9341027858043e74cb71affb40256c5c8a45 Mon Sep 17 00:00:00 2001 From: nearbyplayer Date: Mon, 21 Aug 2017 09:26:32 -0400 Subject: [PATCH 020/177] Adds new timer --- client/main.lua | 132 ++++++++++++++++++++++++++++++++++++++++++++++-- config.lua | 4 ++ locales/br.lua | 8 +++ locales/en.lua | 8 +++ locales/fr.lua | 8 +++ server/main.lua | 47 +++++++++++++++-- 6 files changed, 198 insertions(+), 9 deletions(-) diff --git a/client/main.lua b/client/main.lua index cc574eb7..4347ba4e 100644 --- a/client/main.lua +++ b/client/main.lua @@ -118,12 +118,117 @@ function StartRespawnTimer() StopScreenEffect('DeathFailOut') DoScreenFadeIn(800) end) - end) end - end) +end +function RespawnTimer() + +local timer = Config.RespawnDelayAfterRPDeath +local allowRespawn = Config.RespawnDelayAfterRPDeath/2 +local enoughMoney = false +local money = 0 + + if IsDead and Config.ShowDeathTimer then + ESX.TriggerServerCallback('esx_ambulancejob:getBankMoney', function(money) + if money >= Config.EarlyRespawnFineAmount then + enoughMoney = true + else + enoughMoney = false + end + end) + Citizen.CreateThread(function() + + while timer > 0 and IsDead do + raw_seconds = timer/1000 + raw_minutes = raw_seconds/60 + minutes = stringsplit(raw_minutes, ".")[1] + seconds = stringsplit(raw_seconds-(minutes*60), ".")[1] + + if Config.EarlyRespawn and Config.EarlyRespawnFine and enoughMoney then + SetTextFont(4) + SetTextProportional(0) + SetTextScale(0.0, 0.5) + SetTextColour(255, 255, 255, 255) + SetTextDropshadow(0, 0, 0, 0, 255) + SetTextEdge(1, 0, 0, 0, 255) + SetTextDropShadow() + SetTextOutline() + SetTextEntry("STRING") + AddTextComponentString(_U('please_wait') .. minutes .. _U('minutes') .. seconds .. _U('seconds_fine') .. Config.EarlyRespawnFineAmount .. _U('press_respawn_fine')) + SetTextCentre(true) + DrawText(0.5, 0.8) + timer = timer - 15 + Citizen.Wait(0) + if IsControlPressed(0, Keys['E']) then + DoScreenFadeOut(800) + + while not IsScreenFadedOut() do + Citizen.Wait(0) + end + + ESX.TriggerServerCallback('esx_ambulancejob:removeItemsAfterRPDeathRemoveMoney', function() + + TriggerServerEvent('esx_ambulancejob:removeAccountMoney', source) + TriggerServerEvent('esx:updateLastPosition', Config.Zones.HospitalInteriorInside1.Pos) + + RespawnPed(GetPlayerPed(-1), Config.Zones.HospitalInteriorInside1.Pos) + StopScreenEffect('DeathFailOut') + DoScreenFadeIn(800) + end) + end + else + SetTextFont(4) + SetTextProportional(0) + SetTextScale(0.0, 0.5) + SetTextColour(255, 255, 255, 255) + SetTextDropshadow(0, 0, 0, 0, 255) + SetTextEdge(1, 0, 0, 0, 255) + SetTextDropShadow() + SetTextOutline() + SetTextEntry("STRING") + AddTextComponentString(_U('please_wait') .. minutes .. _U('minutes') .. seconds .. _U('seconds')) + SetTextCentre(true) + DrawText(0.5, 0.8) + timer = timer - 15 + Citizen.Wait(0) + end + end + + while timer <= 0 and IsDead do + SetTextFont(4) + SetTextProportional(0) + SetTextScale(0.0, 0.5) + SetTextColour(255, 255, 255, 255) + SetTextDropshadow(0, 0, 0, 0, 255) + SetTextEdge(1, 0, 0, 0, 255) + SetTextDropShadow() + SetTextOutline() + SetTextEntry("STRING") + AddTextComponentString(_U('press_respawn')) + SetTextCentre(true) + DrawText(0.5, 0.8) + Citizen.Wait(0) + if IsControlPressed(0, Keys['E']) then + DoScreenFadeOut(800) + + while not IsScreenFadedOut() do + Citizen.Wait(0) + end + + ESX.TriggerServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function() + + TriggerServerEvent('esx:updateLastPosition', Config.Zones.HospitalInteriorInside1.Pos) + + RespawnPed(GetPlayerPed(-1), Config.Zones.HospitalInteriorInside1.Pos) + --StopScreenEffect('DeathFailOut') + DoScreenFadeIn(800) + end) + end + end + end) + end end function TeleportFadeEffect(entity, coords) @@ -531,10 +636,14 @@ AddEventHandler('esx_ambulancejob:onPlayerDeath', function() IsDead = true - StartRespawnTimer() - StartRespawnToHospitalMenuTimer() + if Config.ShowDeathTimer == true then + RespawnTimer() + else + StartRespawnTimer() + StartRespawnToHospitalMenuTimer() + StartScreenEffect('DeathFailOut', 0, false) + end - StartScreenEffect('DeathFailOut', 0, false) end) RegisterNetEvent('esx_ambulancejob:revive') @@ -745,3 +854,16 @@ Citizen.CreateThread(function() EnableMpDlcMaps(true) RequestIpl('Coroner_Int_on') -- Morgue end) + +-- String string +function stringsplit(inputstr, sep) + if sep == nil then + sep = "%s" + end + local t={} ; i=1 + for str in string.gmatch(inputstr, "([^"..sep.."]+)") do + t[i] = str + i = i + 1 + end + return t +end diff --git a/config.lua b/config.lua index 8e1b8a90..f795fc7c 100644 --- a/config.lua +++ b/config.lua @@ -7,6 +7,10 @@ Config.RemoveWeaponsAfterRPDeath = true Config.RemoveCashAfterRPDeath = true Config.RemoveItemsAfterRPDeath = true Config.EnablePlayerManagement = false +Config.ShowDeathTimer = true +Config.EarlyRespawn = true +Config.EarlyRespawnFine = true +Config.EarlyRespawnFineAmount = 500 Config.Locale = 'fr' Config.Zones = { diff --git a/locales/br.lua b/locales/br.lua index a56396c1..494baed3 100644 --- a/locales/br.lua +++ b/locales/br.lua @@ -35,4 +35,12 @@ Locales['br'] = { -- Death ['respawn_at_hospital'] = 'você quer ser transportado para o hospital?', ['yes'] = 'sim', + ['please_wait'] = 'por favor, espere ~b~', + ['minutes'] = ' minutos ', + ['seconds_fine'] = ' segundos ~w~para respawn | Respawn agora para ~g~$', + ['seconds'] = ' segundos ~w~para respawn.', + ['press_respawn_fine'] = '~w~ [Pressione ~b~E~w~]', + ['press_respawn'] = 'pressione [~b~E~w~] para respawn.', + -- Revive + ['revive_help'] = 'reviver um jogador', } diff --git a/locales/en.lua b/locales/en.lua index fa8ddfce..4c86edfc 100644 --- a/locales/en.lua +++ b/locales/en.lua @@ -35,4 +35,12 @@ Locales['en'] = { -- Death ['respawn_at_hospital'] = 'do you want to be transported to the hospital?', ['yes'] = 'yes', + ['please_wait'] = 'please wait ~b~', + ['minutes'] = ' minutes ', + ['seconds_fine'] = ' seconds ~w~to respawn | Respawn now for ~g~$', + ['seconds'] = ' seconds ~w~to respawn.', + ['press_respawn_fine'] = '~w~ [Press ~b~E~w~]', + ['press_respawn'] = 'press [~b~E~w~] to respawn.', + -- Revive + ['revive_help'] = 'revive a player', } diff --git a/locales/fr.lua b/locales/fr.lua index c276c069..877b06e2 100644 --- a/locales/fr.lua +++ b/locales/fr.lua @@ -35,4 +35,12 @@ Locales['fr'] = { -- Death ['respawn_at_hospital'] = 'voulez-vous être transporté à l\'hôpital ?', ['yes'] = 'oui', + ['please_wait'] = 's\'il vous plaît, attendez ~b~', + ['minutes'] = ' minutes ', + ['seconds_fine'] = ' secondes ~w~to réapparaître | Réapparaître maintenant pour ~g~$', + ['seconds'] = ' secondes ~w~pour réapparaître.', + ['press_respawn_fine'] = '~w~ [Presse ~b~E~w~]', + ['press_respawn'] = 'appuyez [~b~E~w~] sur pour réapparaître.', + -- Revive + ['revive_help'] = 'relancer un joueur', } diff --git a/server/main.lua b/server/main.lua index 7b9b4870..296d8bd7 100644 --- a/server/main.lua +++ b/server/main.lua @@ -34,6 +34,45 @@ ESX.RegisterServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function( end) +ESX.RegisterServerCallback('esx_ambulancejob:removeItemsAfterRPDeathRemoveMoney', function(source, cb) + + local xPlayer = ESX.GetPlayerFromId(source) + + if Config.RemoveCashAfterRPDeath then + xPlayer.set('money', 0) + xPlayer.setAccountMoney('black_money', 0) + end + + if Config.EarlyRespawn and Config.EarlyRespawnFine then + xPlayer.removeAccountMoney('bank', Config.EarlyRespawnFineAmount) + end + + if Config.RemoveItemsAfterRPDeath then + for i=1, #xPlayer.inventory, 1 do + if xPlayer.inventory[i].count > 0 then + xPlayer.setInventoryItem(xPlayer.inventory[i].name, 0) + end + end + end + + if Config.RemoveWeaponsAfterRPDeath then + for i=1, #xPlayer.loadout, 1 do + xPlayer.removeWeapon(xPlayer.loadout[i].name) + end + end + + cb() + +end) + +ESX.RegisterServerCallback('esx_ambulancejob:getBankMoney', function(source, cb) + + local xPlayer = ESX.GetPlayerFromId(source) + local money = xPlayer.getAccount('bank').money + + cb(money) +end) + TriggerEvent('esx_phone:registerCallback', function(source, phoneNumber, message, anon) local xPlayer = ESX.GetPlayerFromId(source) @@ -48,11 +87,11 @@ TriggerEvent('esx_phone:registerCallback', function(source, phoneNumber, message end end end - + end) -TriggerEvent('es:addGroupCommand', 'respawn', 'admin', function(source, args, user) - +TriggerEvent('es:addGroupCommand', 'revive', 'admin', function(source, args, user) + if args[2] ~= nil then TriggerClientEvent('esx_ambulancejob:revive', tonumber(args[2])) else @@ -61,4 +100,4 @@ TriggerEvent('es:addGroupCommand', 'respawn', 'admin', function(source, args, us end, function(source, args, user) TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "Insufficient Permissions.") -end, {help = 'Respawn', params = {{name = 'id'}}}) \ No newline at end of file +end, {help = _U('revive_help'), params = {{name = 'id'}}}) From c8a62f18abdee9041354a83ad868d1d4a5040c62 Mon Sep 17 00:00:00 2001 From: nearbyplayer Date: Mon, 21 Aug 2017 12:21:56 -0400 Subject: [PATCH 021/177] Adds new line to text. --- locales/br.lua | 2 +- locales/en.lua | 2 +- locales/fr.lua | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/locales/br.lua b/locales/br.lua index 494baed3..07949889 100644 --- a/locales/br.lua +++ b/locales/br.lua @@ -37,7 +37,7 @@ Locales['br'] = { ['yes'] = 'sim', ['please_wait'] = 'por favor, espere ~b~', ['minutes'] = ' minutos ', - ['seconds_fine'] = ' segundos ~w~para respawn | Respawn agora para ~g~$', + ['seconds_fine'] = ' segundos ~w~para respawn \nRespawn agora para ~g~$', ['seconds'] = ' segundos ~w~para respawn.', ['press_respawn_fine'] = '~w~ [Pressione ~b~E~w~]', ['press_respawn'] = 'pressione [~b~E~w~] para respawn.', diff --git a/locales/en.lua b/locales/en.lua index 4c86edfc..fb7b18a6 100644 --- a/locales/en.lua +++ b/locales/en.lua @@ -37,7 +37,7 @@ Locales['en'] = { ['yes'] = 'yes', ['please_wait'] = 'please wait ~b~', ['minutes'] = ' minutes ', - ['seconds_fine'] = ' seconds ~w~to respawn | Respawn now for ~g~$', + ['seconds_fine'] = ' seconds ~w~to respawn \nRespawn now for ~g~$', ['seconds'] = ' seconds ~w~to respawn.', ['press_respawn_fine'] = '~w~ [Press ~b~E~w~]', ['press_respawn'] = 'press [~b~E~w~] to respawn.', diff --git a/locales/fr.lua b/locales/fr.lua index 877b06e2..8b80d187 100644 --- a/locales/fr.lua +++ b/locales/fr.lua @@ -37,7 +37,7 @@ Locales['fr'] = { ['yes'] = 'oui', ['please_wait'] = 's\'il vous plaît, attendez ~b~', ['minutes'] = ' minutes ', - ['seconds_fine'] = ' secondes ~w~to réapparaître | Réapparaître maintenant pour ~g~$', + ['seconds_fine'] = ' secondes ~w~to réapparaître \nRéapparaître maintenant pour ~g~$', ['seconds'] = ' secondes ~w~pour réapparaître.', ['press_respawn_fine'] = '~w~ [Presse ~b~E~w~]', ['press_respawn'] = 'appuyez [~b~E~w~] sur pour réapparaître.', From 47c7ef29fc31af4723e74ce624d8ae53057af8d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20N=27gadi?= Date: Mon, 21 Aug 2017 20:59:50 +0200 Subject: [PATCH 022/177] Update GetPlayers --- server/main.lua | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/server/main.lua b/server/main.lua index 296d8bd7..92bfa211 100644 --- a/server/main.lua +++ b/server/main.lua @@ -79,10 +79,13 @@ TriggerEvent('esx_phone:registerCallback', function(source, phoneNumber, message local xPlayers = ESX.GetPlayers() if phoneNumber == 'ambulance' then - for k, v in pairs(xPlayers) do - if v.job.name == 'ambulance' then + for i=1, #xPlayers, 1 do + + local xPlayer2 = ESX.GetPlayerFromId(xPlayer[i]) + + if xPlayer2.job.name == 'ambulance' then TriggerEvent('esx_phone:getDistpatchRequestId', function(requestId) - TriggerClientEvent('esx_phone:onMessage', v.source, xPlayer.get('phoneNumber'), message, xPlayer.get('coords'), anon, _U('alert_ambulance'), requestId) + TriggerClientEvent('esx_phone:onMessage', xPlayer2.source, xPlayer.get('phoneNumber'), message, xPlayer.get('coords'), anon, _U('alert_ambulance'), requestId) end) end end From a2af4997f3270e915a6cfbc1b99b8da72f1096fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20N=27gadi?= Date: Mon, 21 Aug 2017 22:00:18 +0200 Subject: [PATCH 023/177] Fix typo --- server/main.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/main.lua b/server/main.lua index 92bfa211..f1f747f6 100644 --- a/server/main.lua +++ b/server/main.lua @@ -81,7 +81,7 @@ TriggerEvent('esx_phone:registerCallback', function(source, phoneNumber, message if phoneNumber == 'ambulance' then for i=1, #xPlayers, 1 do - local xPlayer2 = ESX.GetPlayerFromId(xPlayer[i]) + local xPlayer2 = ESX.GetPlayerFromId(xPlayers[i]) if xPlayer2.job.name == 'ambulance' then TriggerEvent('esx_phone:getDistpatchRequestId', function(requestId) From 1c6880e626ce4702b0b8a451bb45694814f01085 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20N=27gadi?= Date: Tue, 22 Aug 2017 10:14:40 +0200 Subject: [PATCH 024/177] Remove debug code --- client/main.lua | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/client/main.lua b/client/main.lua index 4347ba4e..ad69660e 100644 --- a/client/main.lua +++ b/client/main.lua @@ -1,5 +1,3 @@ -DoScreenFadeIn(0) - 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, @@ -41,10 +39,8 @@ function RespawnPed(ped, coords) end function StartRespawnToHospitalMenuTimer() - Citizen.Trace('starting timer') - ESX.SetTimeout(Config.MenuRespawnToHospitalDelay, function() - Citizen.Trace('menu should appear') + ESX.SetTimeout(Config.MenuRespawnToHospitalDelay, function() if IsDead then @@ -60,17 +56,18 @@ function StartRespawnToHospitalMenuTimer() elements = elements }, function(data, menu) --Submit Cb - menu.close() + + menu.close() + + Citizen.CreateThread(function() - Citizen.CreateThread(function() + DoScreenFadeOut(800) - DoScreenFadeOut(800) + while not IsScreenFadedOut() do + Citizen.Wait(0) + end - while not IsScreenFadedOut() do - Citizen.Wait(0) - end - - ESX.TriggerServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function() + ESX.TriggerServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function() TriggerServerEvent('esx:updateLastPosition', Config.Zones.HospitalInteriorInside1.Pos) From f48bf5da31ddee78d0cca681e0725cd8466df421 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20N=27gadi?= Date: Tue, 22 Aug 2017 11:38:51 +0200 Subject: [PATCH 025/177] Don't remove rare items --- server/main.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/main.lua b/server/main.lua index f1f747f6..7063b953 100644 --- a/server/main.lua +++ b/server/main.lua @@ -49,7 +49,7 @@ ESX.RegisterServerCallback('esx_ambulancejob:removeItemsAfterRPDeathRemoveMoney' if Config.RemoveItemsAfterRPDeath then for i=1, #xPlayer.inventory, 1 do - if xPlayer.inventory[i].count > 0 then + if xPlayer.inventory[i].count > 0 and not xPlayer.inventory[i].rare then xPlayer.setInventoryItem(xPlayer.inventory[i].name, 0) end end From 4b0e2d4a59f6e69a7b9448fb70ffe16dc465acd3 Mon Sep 17 00:00:00 2001 From: renaiku Date: Tue, 22 Aug 2017 20:40:28 +0200 Subject: [PATCH 026/177] small fix, not perfect --- client/main.lua | 47 +++++++++++++++++++++++++++-------------------- config.lua | 8 ++++---- 2 files changed, 31 insertions(+), 24 deletions(-) diff --git a/client/main.lua b/client/main.lua index ad69660e..8e26fb33 100644 --- a/client/main.lua +++ b/client/main.lua @@ -21,6 +21,7 @@ local LastZone = nil local CurrentAction = nil local CurrentActionMsg = '' local CurrentActionData = {} +local RespawnToHospitalMenu = nil Citizen.CreateThread(function() while ESX == nil do @@ -35,20 +36,26 @@ function RespawnPed(ped, coords) SetPlayerInvincible(ped, false) TriggerEvent('playerSpawned', coords.x, coords.y, coords.z, coords.heading) ClearPedBloodDamage(ped) + if RespawnToHospitalMenu ~= nil then + RespawnToHospitalMenu.close() + RespawnToHospitalMenu = nil + end ESX.UI.Menu.CloseAll() end function StartRespawnToHospitalMenuTimer() + Citizen.Trace('player IsDead') ESX.SetTimeout(Config.MenuRespawnToHospitalDelay, function() + Citizen.Trace('timer started') if IsDead then local elements = {} table.insert(elements, {label = _U('yes'), value = 'yes'}) - ESX.UI.Menu.Open( + RespawnToHospitalMenu = ESX.UI.Menu.Open( 'default', GetCurrentResourceName(), 'menuName', { title = _U('respawn_at_hospital'), @@ -56,41 +63,39 @@ function StartRespawnToHospitalMenuTimer() elements = elements }, function(data, menu) --Submit Cb - - menu.close() - - Citizen.CreateThread(function() - DoScreenFadeOut(800) + menu.close() - while not IsScreenFadedOut() do - Citizen.Wait(0) - end + Citizen.CreateThread(function() - ESX.TriggerServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function() + DoScreenFadeOut(800) - TriggerServerEvent('esx:updateLastPosition', Config.Zones.HospitalInteriorInside1.Pos) + while not IsScreenFadedOut() do + Citizen.Wait(0) + end - RespawnPed(GetPlayerPed(-1), Config.Zones.HospitalInteriorInside1.Pos) - StopScreenEffect('DeathFailOut') - DoScreenFadeIn(800) - end) + ESX.TriggerServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function() + TriggerServerEvent('esx:updateLastPosition', Config.Zones.HospitalInteriorInside1.Pos) + + RespawnPed(GetPlayerPed(-1), Config.Zones.HospitalInteriorInside1.Pos) + StopScreenEffect('DeathFailOut') + DoScreenFadeIn(800) end) + end) end, function(data, menu) --Cancel Cb --menu.close() end, function(data, menu) --Change Cb --print(data.current.value) + end, + function(data, menu) --Close Cb + RespawnToHospitalMenu = nil end ) - - end - end) - end function StartRespawnTimer() @@ -630,12 +635,14 @@ AddEventHandler('baseevents:onPlayerKilled', function(killerId, data) end) AddEventHandler('esx_ambulancejob:onPlayerDeath', function() - + Citizen.Trace('player died') IsDead = true if Config.ShowDeathTimer == true then + Citizen.Trace('player died: true') RespawnTimer() else + Citizen.Trace('player died: false') StartRespawnTimer() StartRespawnToHospitalMenuTimer() StartScreenEffect('DeathFailOut', 0, false) diff --git a/config.lua b/config.lua index f795fc7c..6331f291 100644 --- a/config.lua +++ b/config.lua @@ -1,15 +1,15 @@ Config = {} Config.DrawDistance = 100.0 Config.MarkerColor = {r = 102, g = 0, b = 102} -Config.RespawnDelayAfterRPDeath = 10 * 60 * 1000 +Config.RespawnDelayAfterRPDeath = 4 * 60 * 1000 Config.MenuRespawnToHospitalDelay= 1 * 60 * 1000 Config.RemoveWeaponsAfterRPDeath = true Config.RemoveCashAfterRPDeath = true Config.RemoveItemsAfterRPDeath = true Config.EnablePlayerManagement = false -Config.ShowDeathTimer = true -Config.EarlyRespawn = true -Config.EarlyRespawnFine = true +Config.ShowDeathTimer = false +Config.EarlyRespawn = false +Config.EarlyRespawnFine = false Config.EarlyRespawnFineAmount = 500 Config.Locale = 'fr' From 7643336246457c7a228334831ad0e7d51caf595b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20N=27gadi?= Date: Wed, 23 Aug 2017 17:59:54 +0200 Subject: [PATCH 027/177] Change TeleoprtEntity to Teleport --- client/main.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/main.lua b/client/main.lua index 8e26fb33..b786afa7 100644 --- a/client/main.lua +++ b/client/main.lua @@ -243,7 +243,7 @@ function TeleportFadeEffect(entity, coords) Citizen.Wait(0) end - ESX.Game.TeleportEntity(entity, coords, function() + ESX.Game.Teleport(entity, coords, function() DoScreenFadeIn(800) end) From dc42a6378b1f9627f06fc592fb649c67a9a727f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20N=27gadi?= Date: Thu, 24 Aug 2017 16:53:53 +0200 Subject: [PATCH 028/177] Fix DeathFailOut effect + remove debug code --- client/main.lua | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/client/main.lua b/client/main.lua index b786afa7..e5ca39a2 100644 --- a/client/main.lua +++ b/client/main.lua @@ -44,11 +44,9 @@ function RespawnPed(ped, coords) end function StartRespawnToHospitalMenuTimer() - Citizen.Trace('player IsDead') ESX.SetTimeout(Config.MenuRespawnToHospitalDelay, function() - Citizen.Trace('timer started') if IsDead then local elements = {} @@ -127,10 +125,10 @@ end function RespawnTimer() -local timer = Config.RespawnDelayAfterRPDeath -local allowRespawn = Config.RespawnDelayAfterRPDeath/2 -local enoughMoney = false -local money = 0 + local timer = Config.RespawnDelayAfterRPDeath + local allowRespawn = Config.RespawnDelayAfterRPDeath/2 + local enoughMoney = false + local money = 0 if IsDead and Config.ShowDeathTimer then ESX.TriggerServerCallback('esx_ambulancejob:getBankMoney', function(money) @@ -635,19 +633,18 @@ AddEventHandler('baseevents:onPlayerKilled', function(killerId, data) end) AddEventHandler('esx_ambulancejob:onPlayerDeath', function() - Citizen.Trace('player died') + IsDead = true if Config.ShowDeathTimer == true then - Citizen.Trace('player died: true') RespawnTimer() else - Citizen.Trace('player died: false') StartRespawnTimer() StartRespawnToHospitalMenuTimer() - StartScreenEffect('DeathFailOut', 0, false) end + StartScreenEffect('DeathFailOut', 0, false) + end) RegisterNetEvent('esx_ambulancejob:revive') From 5765a030c732f34b035050e6bda9ded6040aa5a0 Mon Sep 17 00:00:00 2001 From: nearbyplayer <3721216+nearbyplayer@users.noreply.github.com> Date: Thu, 24 Aug 2017 12:36:39 -0400 Subject: [PATCH 029/177] Update main.lua --- client/main.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/main.lua b/client/main.lua index e5ca39a2..a2372e0c 100644 --- a/client/main.lua +++ b/client/main.lua @@ -222,7 +222,7 @@ function RespawnTimer() TriggerServerEvent('esx:updateLastPosition', Config.Zones.HospitalInteriorInside1.Pos) RespawnPed(GetPlayerPed(-1), Config.Zones.HospitalInteriorInside1.Pos) - --StopScreenEffect('DeathFailOut') + StopScreenEffect('DeathFailOut') DoScreenFadeIn(800) end) end From 99125452b44052bad1aa8653566d51b12163adcf Mon Sep 17 00:00:00 2001 From: ultratm Date: Sat, 26 Aug 2017 11:38:36 +0200 Subject: [PATCH 030/177] Add German Language --- __resource.lua | 2 ++ de_esx_ambulancejob_full.sql | 16 ++++++++++++ de_esx_ambulancejob_minimal.sql | 12 +++++++++ locales/de.lua | 46 +++++++++++++++++++++++++++++++++ 4 files changed, 76 insertions(+) create mode 100644 de_esx_ambulancejob_full.sql create mode 100644 de_esx_ambulancejob_minimal.sql create mode 100644 locales/de.lua diff --git a/__resource.lua b/__resource.lua index 1a7000ed..9a9710d6 100644 --- a/__resource.lua +++ b/__resource.lua @@ -5,6 +5,7 @@ description 'ESX Ambulance Job' server_scripts { '@mysql-async/lib/MySQL.lua', '@es_extended/locale.lua', + 'locales/de.lua', 'locales/br.lua', 'locales/en.lua', 'locales/fr.lua', @@ -14,6 +15,7 @@ server_scripts { client_scripts { '@es_extended/locale.lua', + 'locales/de.lua', 'locales/br.lua', 'locales/en.lua', 'locales/fr.lua', diff --git a/de_esx_ambulancejob_full.sql b/de_esx_ambulancejob_full.sql new file mode 100644 index 00000000..cd81e976 --- /dev/null +++ b/de_esx_ambulancejob_full.sql @@ -0,0 +1,16 @@ +USE `essentialmode`; + +INSERT INTO `addon_account` (name, label, shared) VALUES + ('society_ambulance', 'Notdienst', 1) +; + +INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_female) VALUES + ('ambulance',0,'ambulance','Sanitäter',20,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), + ('ambulance',1,'doctor','Arzt',40,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), + ('ambulance',2,'chief_doctor','Chefarzt',60,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), + ('ambulance',3,'boss','Chirurg',80,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}') +; + +INSERT INTO `jobs` (name, label) VALUES + ('ambulance','Notdienst') +; diff --git a/de_esx_ambulancejob_minimal.sql b/de_esx_ambulancejob_minimal.sql new file mode 100644 index 00000000..04e27ffc --- /dev/null +++ b/de_esx_ambulancejob_minimal.sql @@ -0,0 +1,12 @@ +USE `essentialmode`; + +INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_female) VALUES + ('ambulance',0,'ambulance','Sanitäter',20,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), + ('ambulance',1,'doctor','Arzt',40,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), + ('ambulance',2,'chief_doctor','Chefarzt',60,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), + ('ambulance',3,'boss','Chirurg',80,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}') +; + +INSERT INTO `jobs` (name, label) VALUES + ('ambulance','Notdienst') +; diff --git a/locales/de.lua b/locales/de.lua new file mode 100644 index 00000000..41a263cc --- /dev/null +++ b/locales/de.lua @@ -0,0 +1,46 @@ +Locales['de'] = { + --Cloakroom + ['cloakroom'] = 'Umkleide', + ['ems_clothes_civil'] = 'Zivilkleidung', + ['ems_clothes_ems'] = 'Arbeitskleidung', + --Vehicles + ['veh_menu'] = 'Fahrzeuge', + ['veh_spawn'] = 'Drücke ~INPUT_CONTEXT~ um ein Fahrzeug zu bekommen', + ['store_veh'] = 'Drücke ~INPUT_CONTEXT~ um das Fahrzeug zu parken', + ['ambulance'] = 'Krankenwagen', + ['helicopter'] = 'Helicopter', + --Action Menu + ['hospital'] = 'Krankenhaus', + ['revive_inprogress'] = 'wiederbeleben im Gange', + ['revive_complete'] = 'du wurdest wiederbelebt ', + ['no_players'] = 'keine Spieler in der Nähe', + ['no_vehicles'] = 'keine Fahrzeuge in der Nähe', + ['isdead'] = 'ist gestorben', + ['unconscious'] = 'ist nicht im Koma', + --Boss Menu + ['deposit_society'] = 'Notdienst einzahlen', + ['withdraw_society'] = 'Notdienst abheben', + --Misc + ['invalid_amount'] = '~r~ungültiger Betrag', + ['open_menu'] = 'Drücke ~INPUT_CONTEXT~ um das Menü zu öffnen', + ['deposit_amount'] = 'Betrag zum einzahlen', + ['money_withdraw'] = 'Betrag zum abheben', + -- F6 Menu + ['ems_menu'] = 'Notdienst - Menü', + ['ems_menu_title'] = 'Notdienst - Menü', + ['ems_menu_revive'] = 'Spieler wiederbeleben', + ['ems_menu_putincar'] = 'in Fahrzeug setzen', + -- Phone + ['alert_ambulance'] = 'Notdienst anrufen', + -- Death + ['respawn_at_hospital'] = 'Willst du ins Krankenhaus gebracht werden?', + ['yes'] = 'ja', + ['please_wait'] = 'bitte warte ~b~', + ['minutes'] = ' minuten ', + ['seconds_fine'] = ' sekunden ~w~zum respawnen\nRespawn jetzt für ~g~$', + ['seconds'] = ' sekunden ~w~bis zum respawn.', + ['press_respawn_fine'] = '~w~ [Drücke ~b~E~w~]', + ['press_respawn'] = 'Drücke [~b~E~w~] zum respawnen.', + -- Revive + ['revive_help'] = 'Spieler wiederbeleben', +} From 7f33a1549dd6c1f9bf05066260fdbc421f376f36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20N=27gadi?= Date: Wed, 30 Aug 2017 19:42:33 +0200 Subject: [PATCH 031/177] Fix position --- client/main.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/client/main.lua b/client/main.lua index a2372e0c..2c1fb9bf 100644 --- a/client/main.lua +++ b/client/main.lua @@ -74,6 +74,7 @@ function StartRespawnToHospitalMenuTimer() ESX.TriggerServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function() + ESX.PlayerData.lastPosition = Config.Zones.HospitalInteriorInside1.Pos TriggerServerEvent('esx:updateLastPosition', Config.Zones.HospitalInteriorInside1.Pos) RespawnPed(GetPlayerPed(-1), Config.Zones.HospitalInteriorInside1.Pos) From dd389b53f73468d526c1c1ea874e5129ef594000 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20N=27gadi?= Date: Thu, 31 Aug 2017 01:01:35 +0200 Subject: [PATCH 032/177] Fix respawn position --- client/main.lua | 6 +++++- config.lua | 10 +++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/client/main.lua b/client/main.lua index 2c1fb9bf..3424420f 100644 --- a/client/main.lua +++ b/client/main.lua @@ -74,7 +74,7 @@ function StartRespawnToHospitalMenuTimer() ESX.TriggerServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function() - ESX.PlayerData.lastPosition = Config.Zones.HospitalInteriorInside1.Pos + ESX.SetPlayerData('lastPosition', Config.Zones.HospitalInteriorInside1.Pos) TriggerServerEvent('esx:updateLastPosition', Config.Zones.HospitalInteriorInside1.Pos) RespawnPed(GetPlayerPed(-1), Config.Zones.HospitalInteriorInside1.Pos) @@ -113,6 +113,7 @@ function StartRespawnTimer() ESX.TriggerServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function() + ESX.SetPlayerData('lastPosition', Config.Zones.HospitalInteriorInside1.Pos) TriggerServerEvent('esx:updateLastPosition', Config.Zones.HospitalInteriorInside1.Pos) RespawnPed(GetPlayerPed(-1), Config.Zones.HospitalInteriorInside1.Pos) @@ -172,6 +173,7 @@ function RespawnTimer() ESX.TriggerServerCallback('esx_ambulancejob:removeItemsAfterRPDeathRemoveMoney', function() TriggerServerEvent('esx_ambulancejob:removeAccountMoney', source) + ESX.SetPlayerData('lastPosition', Config.Zones.HospitalInteriorInside1.Pos) TriggerServerEvent('esx:updateLastPosition', Config.Zones.HospitalInteriorInside1.Pos) RespawnPed(GetPlayerPed(-1), Config.Zones.HospitalInteriorInside1.Pos) @@ -220,6 +222,7 @@ function RespawnTimer() ESX.TriggerServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function() + ESX.SetPlayerData('lastPosition', Config.Zones.HospitalInteriorInside1.Pos) TriggerServerEvent('esx:updateLastPosition', Config.Zones.HospitalInteriorInside1.Pos) RespawnPed(GetPlayerPed(-1), Config.Zones.HospitalInteriorInside1.Pos) @@ -662,6 +665,7 @@ AddEventHandler('esx_ambulancejob:revive', function() Citizen.Wait(0) end + ESX.SetPlayerData('lastPosition', Config.Zones.HospitalInteriorInside1.Pos) TriggerServerEvent('esx:updateLastPosition', { x = coords.x, y = coords.y, diff --git a/config.lua b/config.lua index 6331f291..02206d7b 100644 --- a/config.lua +++ b/config.lua @@ -7,11 +7,11 @@ Config.RemoveWeaponsAfterRPDeath = true Config.RemoveCashAfterRPDeath = true Config.RemoveItemsAfterRPDeath = true Config.EnablePlayerManagement = false -Config.ShowDeathTimer = false -Config.EarlyRespawn = false -Config.EarlyRespawnFine = false -Config.EarlyRespawnFineAmount = 500 -Config.Locale = 'fr' +Config.ShowDeathTimer = true +Config.EarlyRespawn = true +Config.EarlyRespawnFine = true +Config.EarlyRespawnFineAmount = 500 +Config.Locale = 'fr' Config.Zones = { From a6390d1038a4cd9f93cfa136ba8e0fdf253dd028 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20N=27gadi?= Date: Thu, 31 Aug 2017 09:51:01 +0200 Subject: [PATCH 033/177] Fix revive --- client/main.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/client/main.lua b/client/main.lua index 3424420f..0f85f2d1 100644 --- a/client/main.lua +++ b/client/main.lua @@ -665,7 +665,12 @@ AddEventHandler('esx_ambulancejob:revive', function() Citizen.Wait(0) end - ESX.SetPlayerData('lastPosition', Config.Zones.HospitalInteriorInside1.Pos) + ESX.SetPlayerData('lastPosition', { + x = coords.x, + y = coords.y, + z = coords.z + ) + TriggerServerEvent('esx:updateLastPosition', { x = coords.x, y = coords.y, From 1bfefc2931067d6835af39fc16cecc4634082c77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20N=27gadi?= Date: Thu, 31 Aug 2017 09:51:33 +0200 Subject: [PATCH 034/177] Fix revive --- client/main.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/main.lua b/client/main.lua index 0f85f2d1..605e2c1c 100644 --- a/client/main.lua +++ b/client/main.lua @@ -669,8 +669,8 @@ AddEventHandler('esx_ambulancejob:revive', function() x = coords.x, y = coords.y, z = coords.z - ) - + }) + TriggerServerEvent('esx:updateLastPosition', { x = coords.x, y = coords.y, From 885af6d46291f313a033642a5b76284f0396f92f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20N=27gadi?= Date: Sat, 2 Sep 2017 00:36:55 +0200 Subject: [PATCH 035/177] Use new phone --- server/main.lua | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/server/main.lua b/server/main.lua index 7063b953..d8e72d27 100644 --- a/server/main.lua +++ b/server/main.lua @@ -7,6 +7,8 @@ AddEventHandler('esx_ambulancejob:revive', function(target) TriggerClientEvent('esx_ambulancejob:revive', target) end) +TriggerEvent('esx_phone:registerNumber', 'ambulance', _('alert_ambulance'), true, true) + ESX.RegisterServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function(source, cb) local xPlayer = ESX.GetPlayerFromId(source) @@ -73,26 +75,6 @@ ESX.RegisterServerCallback('esx_ambulancejob:getBankMoney', function(source, cb) cb(money) end) -TriggerEvent('esx_phone:registerCallback', function(source, phoneNumber, message, anon) - - local xPlayer = ESX.GetPlayerFromId(source) - local xPlayers = ESX.GetPlayers() - - if phoneNumber == 'ambulance' then - for i=1, #xPlayers, 1 do - - local xPlayer2 = ESX.GetPlayerFromId(xPlayers[i]) - - if xPlayer2.job.name == 'ambulance' then - TriggerEvent('esx_phone:getDistpatchRequestId', function(requestId) - TriggerClientEvent('esx_phone:onMessage', xPlayer2.source, xPlayer.get('phoneNumber'), message, xPlayer.get('coords'), anon, _U('alert_ambulance'), requestId) - end) - end - end - end - -end) - TriggerEvent('es:addGroupCommand', 'revive', 'admin', function(source, args, user) if args[2] ~= nil then From ffde3dca8fd30f99d72e01d33c736703c2ac8ca4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20N=27gadi?= Date: Sun, 3 Sep 2017 11:55:20 +0200 Subject: [PATCH 036/177] Use new boss menu --- client/main.lua | 57 +++++-------------------------------------------- 1 file changed, 5 insertions(+), 52 deletions(-) diff --git a/client/main.lua b/client/main.lua index 605e2c1c..7fa9b2ce 100644 --- a/client/main.lua +++ b/client/main.lua @@ -292,8 +292,7 @@ function OpenAmbulanceActionsMenu() } if Config.EnablePlayerManagement and PlayerData.job.grade_name == 'boss' then - table.insert(elements, {label = _U('withdraw_society'), value = 'withdraw_society_money'}) - table.insert(elements, {label = _U('deposit_society'), value = 'deposit_society_money'}) + table.insert(elements, {label = 'Action Patron', value = 'boss_actions'}) end ESX.UI.Menu.CloseAll() @@ -310,56 +309,10 @@ function OpenAmbulanceActionsMenu() OpenCloakroomMenu() end - if data.current.value == 'withdraw_society_money' then - - ESX.UI.Menu.Open( - 'dialog', GetCurrentResourceName(), 'withdraw_society_money_amount', - { - title = _U('money_withdraw') - }, - function(data, menu) - - local amount = tonumber(data.value) - - if amount == nil then - ESX.ShowNotification(_U('invalid_amount')) - else - menu.close() - TriggerServerEvent('esx_society:withdrawMoney', 'ambulance', amount) - end - - end, - function(data, menu) - menu.close() - end - ) - - end - - if data.current.value == 'deposit_society_money' then - - ESX.UI.Menu.Open( - 'dialog', GetCurrentResourceName(), 'deposit_money_amount', - { - title = _U('deposit_amount') - }, - function(data, menu) - - local amount = tonumber(data.value) - - if amount == nil then - ESX.ShowNotification(_U('invalid_amount')) - else - menu.close() - TriggerServerEvent('esx_society:depositMoney', 'ambulance', amount) - end - - end, - function(data, menu) - menu.close() - end - ) - + if data.current.value == 'boss_actions' then + TriggerEvent('esx_society:openBossMenu', 'ambulance', function(data, menu) + menu.close() + end, {wash = false}) end end, From b8cede669606c068c629841b53c56642b64cc3da Mon Sep 17 00:00:00 2001 From: nearbyplayer Date: Sun, 3 Sep 2017 15:20:41 -0400 Subject: [PATCH 037/177] Update Multi-Language Support --- client/main.lua | 2 +- locales/en.lua | 1 + locales/fr.lua | 1 + server/main.lua | 2 +- 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/client/main.lua b/client/main.lua index 7fa9b2ce..9c645a94 100644 --- a/client/main.lua +++ b/client/main.lua @@ -292,7 +292,7 @@ function OpenAmbulanceActionsMenu() } if Config.EnablePlayerManagement and PlayerData.job.grade_name == 'boss' then - table.insert(elements, {label = 'Action Patron', value = 'boss_actions'}) + table.insert(elements, {label = _U('boss_actions'), value = 'boss_actions'}) end ESX.UI.Menu.CloseAll() diff --git a/locales/en.lua b/locales/en.lua index fb7b18a6..7386d01e 100644 --- a/locales/en.lua +++ b/locales/en.lua @@ -20,6 +20,7 @@ Locales['en'] = { --Boss Menu ['deposit_society'] = 'eMS Deposit', ['withdraw_society'] = 'eMS Withdraw', + ['boss_actions'] = 'boss Actions', --Misc ['invalid_amount'] = '~r~invalid amount', ['open_menu'] = 'press ~INPUT_CONTEXT~ to open the menu', diff --git a/locales/fr.lua b/locales/fr.lua index 8b80d187..41e735d9 100644 --- a/locales/fr.lua +++ b/locales/fr.lua @@ -20,6 +20,7 @@ Locales['fr'] = { --Boss Menu ['deposit_society'] = 'déposer argent', ['withdraw_society'] = 'retirer argent société', + ['boss_actions'] = 'action Patron', --Misc ['invalid_amount'] = '~r~montant invalide', ['open_menu'] = 'appuyez sur ~INPUT_CONTEXT~ pour ouvrir le menu', diff --git a/server/main.lua b/server/main.lua index d8e72d27..cf299d78 100644 --- a/server/main.lua +++ b/server/main.lua @@ -7,7 +7,7 @@ AddEventHandler('esx_ambulancejob:revive', function(target) TriggerClientEvent('esx_ambulancejob:revive', target) end) -TriggerEvent('esx_phone:registerNumber', 'ambulance', _('alert_ambulance'), true, true) +TriggerEvent('esx_phone:registerNumber', 'ambulance', _U('alert_ambulance'), true, true) ESX.RegisterServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function(source, cb) From 0c9acf91bdd110083552667c050ed062611ddc36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20N=27gadi?= Date: Sat, 9 Sep 2017 16:54:07 +0200 Subject: [PATCH 038/177] Add society garage support --- client/main.lua | 113 ++++++++++++++++++++++++++++++++++++------------ config.lua | 29 +++++++------ 2 files changed, 100 insertions(+), 42 deletions(-) diff --git a/client/main.lua b/client/main.lua index 9c645a94..0ee374e7 100644 --- a/client/main.lua +++ b/client/main.lua @@ -472,46 +472,97 @@ end function OpenVehicleSpawnerMenu() - ESX.UI.Menu.Open( - 'default', GetCurrentResourceName(), 'cloakroom', - { - title = _U('veh_menu'), - align = 'top-left', - elements = { - {label = _U('ambulance'), value = 'ambulance'}, - {label = _U('helicopter'), value = 'polmav'}, - }, - }, - function(data, menu) + ESX.UI.Menu.CloseAll() - menu.close() + if Config.EnableSocietyOwnedVehicles then - local model = data.current.value + local elements = {} - ESX.Game.SpawnVehicle(model, Config.Zones.VehicleSpawnPoint.Pos, 270.0, function(vehicle) + ESX.TriggerServerCallback('esx_society:getVehiclesInGarage', function(vehicles) - local playerPed = GetPlayerPed(-1) + for i=1, #vehicles, 1 do + table.insert(elements, {label = GetDisplayNameFromVehicleModel(vehicles[i].model) .. ' [' .. vehicles[i].plate .. ']', value = vehicles[i]}) + end + + ESX.UI.Menu.Open( + 'default', GetCurrentResourceName(), 'vehicle_spawner', + { + title = _U('veh_menu'), + align = 'top-left', + elements = elements, + }, + function(data, menu) + + menu.close() + + local vehicleProps = data.current.value + + ESX.Game.SpawnVehicle(vehicleProps.model, Config.Zones.VehicleSpawnPoint.Pos, 270.0, function(vehicle) + ESX.Game.SetVehicleProperties(vehicle, vehicleProps) + local playerPed = GetPlayerPed(-1) + TaskWarpPedIntoVehicle(playerPed, vehicle, -1) + end) + + TriggerServerEvent('esx_society:removeVehicleFromGarage', 'ambulance', vehicleProps) + + end, + function(data, menu) + + menu.close() + + CurrentAction = 'vehicle_spawner_menu' + CurrentActionMsg = _U('veh_spawn') + CurrentActionData = {} - if model == 'polmav' then - SetVehicleModKit(vehicle, 0) - SetVehicleLivery(vehicle, 1) end + ) - TaskWarpPedIntoVehicle(playerPed, vehicle, -1) + end, 'ambulance') - end) + else - end, - function(data, menu) + ESX.UI.Menu.Open( + 'default', GetCurrentResourceName(), 'vehicle_spawner', + { + title = _U('veh_menu'), + align = 'top-left', + elements = { + {label = _U('ambulance'), value = 'ambulance'}, + {label = _U('helicopter'), value = 'polmav'}, + }, + }, + function(data, menu) - menu.close() + menu.close() - CurrentAction = 'vehicle_spawner_menu' - CurrentActionMsg = _U('veh_spawn') - CurrentActionData = {} + local model = data.current.value - end - ) + ESX.Game.SpawnVehicle(model, Config.Zones.VehicleSpawnPoint.Pos, 270.0, function(vehicle) + + local playerPed = GetPlayerPed(-1) + + if model == 'polmav' then + SetVehicleModKit(vehicle, 0) + SetVehicleLivery(vehicle, 1) + end + + TaskWarpPedIntoVehicle(playerPed, vehicle, -1) + + end) + + end, + function(data, menu) + + menu.close() + + CurrentAction = 'vehicle_spawner_menu' + CurrentActionMsg = _U('veh_spawn') + CurrentActionData = {} + + end + ) + + end end @@ -794,6 +845,12 @@ Citizen.CreateThread(function() end if CurrentAction == 'delete_vehicle' then + + if Config.EnableSocietyOwnedVehicles then + local vehicleProps = ESX.Game.GetVehicleProperties(CurrentActionData.vehicle) + TriggerServerEvent('esx_society:putVehicleInGarage', 'ambulance', vehicleProps) + end + ESX.Game.DeleteVehicle(CurrentActionData.vehicle) end diff --git a/config.lua b/config.lua index 02206d7b..380de97a 100644 --- a/config.lua +++ b/config.lua @@ -1,17 +1,18 @@ -Config = {} -Config.DrawDistance = 100.0 -Config.MarkerColor = {r = 102, g = 0, b = 102} -Config.RespawnDelayAfterRPDeath = 4 * 60 * 1000 -Config.MenuRespawnToHospitalDelay= 1 * 60 * 1000 -Config.RemoveWeaponsAfterRPDeath = true -Config.RemoveCashAfterRPDeath = true -Config.RemoveItemsAfterRPDeath = true -Config.EnablePlayerManagement = false -Config.ShowDeathTimer = true -Config.EarlyRespawn = true -Config.EarlyRespawnFine = true -Config.EarlyRespawnFineAmount = 500 -Config.Locale = 'fr' +Config = {} +Config.DrawDistance = 100.0 +Config.MarkerColor = {r = 102, g = 0, b = 102} +Config.RespawnDelayAfterRPDeath = 4 * 60 * 1000 +Config.MenuRespawnToHospitalDelay = 1 * 60 * 1000 +Config.EnableSocietyOwnedVehicles = false +Config.RemoveWeaponsAfterRPDeath = true +Config.RemoveCashAfterRPDeath = true +Config.RemoveItemsAfterRPDeath = true +Config.EnablePlayerManagement = false +Config.ShowDeathTimer = true +Config.EarlyRespawn = true +Config.EarlyRespawnFine = true +Config.EarlyRespawnFineAmount = 500 +Config.Locale = 'fr' Config.Zones = { From 9d5cf6d8f55135f828fc0a8c6d6f7b0a04e968a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20N=27gadi?= Date: Sat, 9 Sep 2017 17:09:24 +0200 Subject: [PATCH 039/177] Clean up repo --- README.md | 3 +-- de_esx_ambulancejob_minimal.sql | 12 ------------ esx_ambulancejob_full.sql => esx_ambulancejob.sql | 0 esx_ambulancejob_minimal.sql | 12 ------------ .../de_esx_ambulancejob.sql | 0 5 files changed, 1 insertion(+), 26 deletions(-) delete mode 100644 de_esx_ambulancejob_minimal.sql rename esx_ambulancejob_full.sql => esx_ambulancejob.sql (100%) delete mode 100644 esx_ambulancejob_minimal.sql rename de_esx_ambulancejob_full.sql => localization/de_esx_ambulancejob.sql (100%) diff --git a/README.md b/README.md index 4c17b6e8..8701fc26 100644 --- a/README.md +++ b/README.md @@ -16,8 +16,7 @@ FXServer ESX Ambulance Job ``` git clone https://github.com/FXServer-ESX/fxserver-esx_ambulancejob esx_ambulancejob ``` -3) * Auto mode : Import esx_ambulancejob_minimal.sql in your database - * Player management : Import esx_ambulancejob_full.sql in your database +3) Import esx_ambulancejob.sql in your database 4) Add this in your server.cfg : diff --git a/de_esx_ambulancejob_minimal.sql b/de_esx_ambulancejob_minimal.sql deleted file mode 100644 index 04e27ffc..00000000 --- a/de_esx_ambulancejob_minimal.sql +++ /dev/null @@ -1,12 +0,0 @@ -USE `essentialmode`; - -INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_female) VALUES - ('ambulance',0,'ambulance','Sanitäter',20,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), - ('ambulance',1,'doctor','Arzt',40,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), - ('ambulance',2,'chief_doctor','Chefarzt',60,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), - ('ambulance',3,'boss','Chirurg',80,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}') -; - -INSERT INTO `jobs` (name, label) VALUES - ('ambulance','Notdienst') -; diff --git a/esx_ambulancejob_full.sql b/esx_ambulancejob.sql similarity index 100% rename from esx_ambulancejob_full.sql rename to esx_ambulancejob.sql diff --git a/esx_ambulancejob_minimal.sql b/esx_ambulancejob_minimal.sql deleted file mode 100644 index 9f142868..00000000 --- a/esx_ambulancejob_minimal.sql +++ /dev/null @@ -1,12 +0,0 @@ -USE `essentialmode`; - -INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_female) VALUES - ('ambulance',0,'ambulance','Ambulancier',20,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), - ('ambulance',1,'doctor','Medecin',40,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), - ('ambulance',2,'chief_doctor','Medecin-chef',60,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), - ('ambulance',3,'boss','Chirurgien',80,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}') -; - -INSERT INTO `jobs` (name, label) VALUES - ('ambulance','Ambulance') -; diff --git a/de_esx_ambulancejob_full.sql b/localization/de_esx_ambulancejob.sql similarity index 100% rename from de_esx_ambulancejob_full.sql rename to localization/de_esx_ambulancejob.sql From 8e0f0ea13d758e7f4c0e5ea6e746bd8f20c2395a Mon Sep 17 00:00:00 2001 From: o0Coro0o Date: Mon, 11 Sep 2017 21:45:33 +0200 Subject: [PATCH 040/177] Add files via upload Added Spanish language --- locales/es.lua | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 locales/es.lua diff --git a/locales/es.lua b/locales/es.lua new file mode 100644 index 00000000..d6dddfc3 --- /dev/null +++ b/locales/es.lua @@ -0,0 +1,46 @@ +Locales['es'] = { + --Cloakroom + ['cloakroom'] = 'Guardarropa', + ['ems_clothes_civil'] = 'Camiseta', + ['ems_clothes_ems'] = 'Equipo de ambulancia', + --Vehicles + ['veh_menu'] = 'vehículo', + ['veh_spawn'] = 'Presione ~INPUT_CONTEXT~ para sacar un vehículo', + ['store_veh'] = 'Presione ~INPUT_CONTEXT~ para alamcenar un vehículo', + ['ambulance'] = 'Ambulancia', + ['helicopter'] = 'helicóptero', + --Action Menu + ['hospital'] = 'hospital', + ['revive_inprogress'] = 'reanimación en curso', + ['revive_complete'] = 'has sido reanimado ', + ['no_players'] = 'ningún jugador cerca', + ['no_vehicles'] = 'ningún vehículo cerca', + ['isdead'] = 'Has muerto', + ['unconscious'] = 'n\'estás inconsciente', + --Boss Menu + ['deposit_society'] = 'depositar dinero', + ['withdraw_society'] = 'retirar dinero', + --Misc + ['invalid_amount'] = '~r~cantidad no válida', + ['open_menu'] = 'Presione ~INPUT_CONTEXT~ para abrir el menú', + ['deposit_amount'] = 'cantidad de fianza depositada', + ['money_withdraw'] = 'cantidad de fianza retirada', + -- F6 Menu + ['ems_menu'] = 'ayuda ciudadana', + ['ems_menu_title'] = 'ambulancia - Ayuda Ciudadana', + ['ems_menu_revive'] = 'reanimar', + ['ems_menu_putincar'] = 'meter en el vehículo', + -- Phone + ['alert_ambulance'] = 'Alerta de ambulancia', + -- Death + ['respawn_at_hospital'] = '¿Quieres ser transportado al hospital?', + ['yes'] = 'oui', + ['please_wait'] = 's\'por favor, espere ~b~', + ['minutes'] = ' minutos ', + ['seconds_fine'] = ' segundos ~w~to reparecer \nReapareciendo ahora por ~g~€', + ['seconds'] = ' segundos ~w~para reparecer.', + ['press_respawn_fine'] = '~w~ [Pulsa ~b~E~w~]', + ['press_respawn'] = 'presione [~b~E~w~] para reparecer.', + -- Revive + ['revive_help'] = 'reviver un jugador', +} From e5e0aa12110332602d7fbf842b7ee2a4efdf0f00 Mon Sep 17 00:00:00 2001 From: trekin91 Date: Tue, 12 Sep 2017 14:23:25 +0200 Subject: [PATCH 041/177] Refresh moneyHUD after death --- server/main.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/main.lua b/server/main.lua index cf299d78..7e92c961 100644 --- a/server/main.lua +++ b/server/main.lua @@ -14,7 +14,7 @@ ESX.RegisterServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function( local xPlayer = ESX.GetPlayerFromId(source) if Config.RemoveCashAfterRPDeath then - xPlayer.set('money', 0) + xPlayer.removeMoney(xPlayer.getMoney()) xPlayer.setAccountMoney('black_money', 0) end @@ -41,7 +41,7 @@ ESX.RegisterServerCallback('esx_ambulancejob:removeItemsAfterRPDeathRemoveMoney' local xPlayer = ESX.GetPlayerFromId(source) if Config.RemoveCashAfterRPDeath then - xPlayer.set('money', 0) + xPlayer.removeMoney(xPlayer.getMoney()) xPlayer.setAccountMoney('black_money', 0) end From 242aa701de4702bcfd920b92b0e7a8694f661571 Mon Sep 17 00:00:00 2001 From: Coro Veneno Date: Tue, 12 Sep 2017 23:13:04 +0200 Subject: [PATCH 042/177] Update Spanish Language Added Spanish Language --- __resource.lua | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/__resource.lua b/__resource.lua index 9a9710d6..37621073 100644 --- a/__resource.lua +++ b/__resource.lua @@ -6,19 +6,21 @@ server_scripts { '@mysql-async/lib/MySQL.lua', '@es_extended/locale.lua', 'locales/de.lua', - 'locales/br.lua', + 'locales/br.lua', 'locales/en.lua', - 'locales/fr.lua', + 'locales/fr.lua', + 'locales/es.lua', 'config.lua', 'server/main.lua' } client_scripts { - '@es_extended/locale.lua', + '@es_extended/locale.lua', 'locales/de.lua', 'locales/br.lua', - 'locales/en.lua', - 'locales/fr.lua', + 'locales/en.lua', + 'locales/fr.lua', + 'locales/es.lua', 'config.lua', 'client/main.lua' -} \ No newline at end of file +} From 4d0a417de3b5e62bffc6fced726a3cf7b555696e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20N=27gadi?= Date: Wed, 13 Sep 2017 14:42:01 +0200 Subject: [PATCH 043/177] Use new esx_society --- server/main.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/server/main.lua b/server/main.lua index 7e92c961..e4c9d7fc 100644 --- a/server/main.lua +++ b/server/main.lua @@ -8,6 +8,7 @@ AddEventHandler('esx_ambulancejob:revive', function(target) end) TriggerEvent('esx_phone:registerNumber', 'ambulance', _U('alert_ambulance'), true, true) +TriggerEvent('esx_society:registerSociety', 'ambulance', 'Ambulance', 'society_ambulance', 'society_ambulance', 'society_ambulance', {type = 'public'}) ESX.RegisterServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function(source, cb) From 690d0fdc72124ae990297c5a8455bb8297b9525e Mon Sep 17 00:00:00 2001 From: Romain Lanz Date: Wed, 13 Sep 2017 23:06:36 +0200 Subject: [PATCH 044/177] fix(locales): typo in french translation --- locales/fr.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/locales/fr.lua b/locales/fr.lua index 41e735d9..b2c57384 100644 --- a/locales/fr.lua +++ b/locales/fr.lua @@ -38,8 +38,8 @@ Locales['fr'] = { ['yes'] = 'oui', ['please_wait'] = 's\'il vous plaît, attendez ~b~', ['minutes'] = ' minutes ', - ['seconds_fine'] = ' secondes ~w~to réapparaître \nRéapparaître maintenant pour ~g~$', - ['seconds'] = ' secondes ~w~pour réapparaître.', + ['seconds_fine'] = ' secondes ~w~ pour réapparaître \nRéapparaître maintenant pour ~g~$', + ['seconds'] = ' secondes ~w~ pour réapparaître.', ['press_respawn_fine'] = '~w~ [Presse ~b~E~w~]', ['press_respawn'] = 'appuyez [~b~E~w~] sur pour réapparaître.', -- Revive From ed4b7ad8871dc23ef60aabaf6807b1bfe0165d00 Mon Sep 17 00:00:00 2001 From: Romain Lanz Date: Thu, 14 Sep 2017 12:38:31 +0200 Subject: [PATCH 045/177] chore(coding-style): correct indentation --- .editorconfig | 9 ++ __resource.lua | 34 +++---- config.lua | 130 +++++++++++++-------------- esx_ambulancejob.sql | 4 +- locales/br.lua | 88 +++++++++--------- locales/de.lua | 88 +++++++++--------- locales/en.lua | 90 +++++++++---------- locales/es.lua | 92 +++++++++---------- locales/fr.lua | 90 +++++++++---------- localization/de_esx_ambulancejob.sql | 4 +- server/main.lua | 92 +++++++++---------- 11 files changed, 365 insertions(+), 356 deletions(-) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..41c2aaf2 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*] +indent_size = 2 +indent_style = space +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true \ No newline at end of file diff --git a/__resource.lua b/__resource.lua index 37621073..8dc4f3d5 100644 --- a/__resource.lua +++ b/__resource.lua @@ -3,24 +3,24 @@ resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937' description 'ESX Ambulance Job' server_scripts { - '@mysql-async/lib/MySQL.lua', - '@es_extended/locale.lua', - 'locales/de.lua', - 'locales/br.lua', - 'locales/en.lua', - 'locales/fr.lua', - 'locales/es.lua', - 'config.lua', - 'server/main.lua' + '@mysql-async/lib/MySQL.lua', + '@es_extended/locale.lua', + 'locales/de.lua', + 'locales/br.lua', + 'locales/en.lua', + 'locales/fr.lua', + 'locales/es.lua', + 'config.lua', + 'server/main.lua' } client_scripts { - '@es_extended/locale.lua', - 'locales/de.lua', - 'locales/br.lua', - 'locales/en.lua', - 'locales/fr.lua', - 'locales/es.lua', - 'config.lua', - 'client/main.lua' + '@es_extended/locale.lua', + 'locales/de.lua', + 'locales/br.lua', + 'locales/en.lua', + 'locales/fr.lua', + 'locales/es.lua', + 'config.lua', + 'client/main.lua' } diff --git a/config.lua b/config.lua index 380de97a..e9971e5e 100644 --- a/config.lua +++ b/config.lua @@ -1,6 +1,6 @@ Config = {} Config.DrawDistance = 100.0 -Config.MarkerColor = {r = 102, g = 0, b = 102} +Config.MarkerColor = { r = 102, g = 0, b = 102 } Config.RespawnDelayAfterRPDeath = 4 * 60 * 1000 Config.MenuRespawnToHospitalDelay = 1 * 60 * 1000 Config.EnableSocietyOwnedVehicles = false @@ -8,85 +8,85 @@ Config.RemoveWeaponsAfterRPDeath = true Config.RemoveCashAfterRPDeath = true Config.RemoveItemsAfterRPDeath = true Config.EnablePlayerManagement = false -Config.ShowDeathTimer = true -Config.EarlyRespawn = true -Config.EarlyRespawnFine = true -Config.EarlyRespawnFineAmount = 500 +Config.ShowDeathTimer = true +Config.EarlyRespawn = true +Config.EarlyRespawnFine = true +Config.EarlyRespawnFineAmount = 500 Config.Locale = 'fr' Config.Zones = { - HospitalInteriorEntering1 = { - Pos = {x = 1151.447, y = -1529.491, z = 34.375}, - Size = {x = 1.5, y = 1.5, z = 1.0}, - Type = 1 - }, + HospitalInteriorEntering1 = { + Pos = { x = 1151.447, y = -1529.491, z = 34.375 }, + Size = { x = 1.5, y = 1.5, z = 1.0 }, + Type = 1 + }, - HospitalInteriorInside1 = { - Pos = {x = 251.464, y = -1369.770, z = 28.648}, - Size = {x = 1.5, y = 1.5, z = 1.0}, - Type = -1 - }, + HospitalInteriorInside1 = { + Pos = { x = 251.464, y = -1369.770, z = 28.648 }, + Size = { x = 1.5, y = 1.5, z = 1.0 }, + Type = -1 + }, - HospitalInteriorOutside1 = { - Pos = {x = 1153.364, y = -1525.731, z = 33.843}, - Size = {x = 1.5, y = 1.5, z = 1.0}, - Type = -1 - }, + HospitalInteriorOutside1 = { + Pos = { x = 1153.364, y = -1525.731, z = 33.843 }, + Size = { x = 1.5, y = 1.5, z = 1.0 }, + Type = -1 + }, - HospitalInteriorExit1 = { - Pos = {x = 253.612, y = -1371.66, z = 28.647}, - Size = {x = 1.5, y = 1.5, z = 1.0}, - Type = 1 - }, + HospitalInteriorExit1 = { + Pos = { x = 253.612, y = -1371.66, z = 28.647 }, + Size = { x = 1.5, y = 1.5, z = 1.0 }, + Type = 1 + }, - HospitalInteriorEntering2 = { - Pos = {x = 1137.181, y = -1597.504, z = 33.692}, - Size = {x = 1.5, y = 1.5, z = 1.0}, - Type = 1 - }, + HospitalInteriorEntering2 = { + Pos = { x = 1137.181, y = -1597.504, z = 33.692 }, + Size = { x = 1.5, y = 1.5, z = 1.0 }, + Type = 1 + }, - HospitalInteriorInside2 = { - Pos = {x = 240.508, y = -1360.565, z = 28.647}, - Size = {x = 1.5, y = 1.5, z = 1.0}, - Type = -1 - }, + HospitalInteriorInside2 = { + Pos = { x = 240.508, y = -1360.565, z = 28.647 }, + Size = { x = 1.5, y = 1.5, z = 1.0 }, + Type = -1 + }, - HospitalInteriorOutside2 = { - Pos = {x = 1137.922, y = -1601.434, z = 33.692}, - Size = {x = 1.5, y = 1.5, z = 1.0}, - Type = -1 - }, + HospitalInteriorOutside2 = { + Pos = { x = 1137.922, y = -1601.434, z = 33.692 }, + Size = { x = 1.5, y = 1.5, z = 1.0 }, + Type = -1 + }, - HospitalInteriorExit2 = { - Pos = {x = 238.587, y = -1359.113, z = 28.647}, - Size = {x = 1.5, y = 1.5, z = 1.0}, - Type = 1 - }, + HospitalInteriorExit2 = { + Pos = { x = 238.587, y = -1359.113, z = 28.647 }, + Size = { x = 1.5, y = 1.5, z = 1.0 }, + Type = 1 + }, - AmbulanceActions = { - Pos = {x = 244.048, y = -1366.330, z = 28.647}, - Size = {x = 1.5, y = 1.5, z = 1.0}, - Type = 1 - }, + AmbulanceActions = { + Pos = { x = 244.048, y = -1366.330, z = 28.647 }, + Size = { x = 1.5, y = 1.5, z = 1.0 }, + Type = 1 + }, - VehicleSpawner = { - Pos = {x = 1128.290, y = -1601.451, z = 33.893}, - Size = {x = 1.5, y = 1.5, z = 1.0}, - Type = 1 - }, + VehicleSpawner = { + Pos = { x = 1128.290, y = -1601.451, z = 33.893 }, + Size = { x = 1.5, y = 1.5, z = 1.0 }, + Type = 1 + }, - VehicleSpawnPoint = { - Pos = {x = 1138.061, y = -1607.882, z = 34.692}, - Size = {x = 1.5, y = 1.5, z = 1.0}, - Type = -1 - }, + VehicleSpawnPoint = { + Pos = { x = 1138.061, y = -1607.882, z = 34.692 }, + Size = { x = 1.5, y = 1.5, z = 1.0 }, + Type = -1 + }, - VehicleDeleter = { - Pos = {x = 1122.436, y = -1617.600, z = 33.692}, - Size = {x = 3.0, y = 3.0, z = 2.0}, - Type = 1 - } + VehicleDeleter = { + Pos = { x = 1122.436, y = -1617.600, z = 33.692 }, + Size = { x = 3.0, y = 3.0, z = 2.0 }, + Type = 1 + } } diff --git a/esx_ambulancejob.sql b/esx_ambulancejob.sql index 4d22f6be..aae0c0d8 100644 --- a/esx_ambulancejob.sql +++ b/esx_ambulancejob.sql @@ -1,6 +1,6 @@ USE `essentialmode`; -INSERT INTO `addon_account` (name, label, shared) VALUES +INSERT INTO `addon_account` (name, label, shared) VALUES ('society_ambulance', 'Ambulance', 1) ; @@ -11,6 +11,6 @@ INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_ ('ambulance',3,'boss','Chirurgien',80,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}') ; -INSERT INTO `jobs` (name, label) VALUES +INSERT INTO `jobs` (name, label) VALUES ('ambulance','Ambulance') ; diff --git a/locales/br.lua b/locales/br.lua index 07949889..359f6fe8 100644 --- a/locales/br.lua +++ b/locales/br.lua @@ -1,46 +1,46 @@ Locales['br'] = { - --Cloakroom - ['cloakroom'] = 'Vestiario', - ['ems_clothes_civil'] = 'Roupa casual', - ['ems_clothes_ems'] = 'Uniforme paramedico', - --Vehicles - ['veh_menu'] = 'Veículo', - ['veh_spawn'] = 'Pressione ~INPUT_CONTEXT~ para escolher veículo ou helicoptero', - ['store_veh'] = 'Pressione ~INPUT_CONTEXT~ para gaurdar o veículo', - ['ambulance'] = 'Ambulância', - ['helicopter'] = 'Helicoptero', - --Action Menu - ['hospital'] = 'Hospital', - ['revive_inprogress'] = 'Reanimação em progresso', - ['revive_complete'] = 'Você reviveu', - ['no_players'] = 'Nenhum jogador nas proximidades', - ['no_vehicles'] = 'Nenhum veículo nas proximidades', - ['isdead'] = 'esta morto', - ['unconscious'] = 'Não está inconsciente', - --Boss Menu - ['deposit_society'] = 'eMS Depositou', - ['withdraw_society'] = 'eMS Sacou', - --Misc - ['invalid_amount'] = '~r~quantidade inválida', - ['open_menu'] = 'Pressione ~INPUT_CONTEXT~ para abrir o menu', - ['deposit_amount'] = 'Quantidade para deposito', - ['money_withdraw'] = 'Quantidade para sacar', - -- F6 Menu - ['ems_menu'] = 'eMS Menu', - ['ems_menu_title'] = 'Paramedico - EMS Menu', - ['ems_menu_revive'] = 'Reviver jogador', - ['ems_menu_putincar'] = 'Colocar no veículo', - -- Phone - ['alert_ambulance'] = 'ambulância de alerta', - -- Death - ['respawn_at_hospital'] = 'você quer ser transportado para o hospital?', - ['yes'] = 'sim', - ['please_wait'] = 'por favor, espere ~b~', - ['minutes'] = ' minutos ', - ['seconds_fine'] = ' segundos ~w~para respawn \nRespawn agora para ~g~$', - ['seconds'] = ' segundos ~w~para respawn.', - ['press_respawn_fine'] = '~w~ [Pressione ~b~E~w~]', - ['press_respawn'] = 'pressione [~b~E~w~] para respawn.', - -- Revive - ['revive_help'] = 'reviver um jogador', + -- Cloakroom + ['cloakroom'] = 'Vestiario', + ['ems_clothes_civil'] = 'Roupa casual', + ['ems_clothes_ems'] = 'Uniforme paramedico', + -- Vehicles + ['veh_menu'] = 'Veículo', + ['veh_spawn'] = 'Pressione ~INPUT_CONTEXT~ para escolher veículo ou helicoptero', + ['store_veh'] = 'Pressione ~INPUT_CONTEXT~ para gaurdar o veículo', + ['ambulance'] = 'Ambulância', + ['helicopter'] = 'Helicoptero', + -- Action Menu + ['hospital'] = 'Hospital', + ['revive_inprogress'] = 'Reanimação em progresso', + ['revive_complete'] = 'Você reviveu', + ['no_players'] = 'Nenhum jogador nas proximidades', + ['no_vehicles'] = 'Nenhum veículo nas proximidades', + ['isdead'] = 'esta morto', + ['unconscious'] = 'Não está inconsciente', + -- Boss Menu + ['deposit_society'] = 'eMS Depositou', + ['withdraw_society'] = 'eMS Sacou', + -- Misc + ['invalid_amount'] = '~r~quantidade inválida', + ['open_menu'] = 'Pressione ~INPUT_CONTEXT~ para abrir o menu', + ['deposit_amount'] = 'Quantidade para deposito', + ['money_withdraw'] = 'Quantidade para sacar', + -- F6 Menu + ['ems_menu'] = 'eMS Menu', + ['ems_menu_title'] = 'Paramedico - EMS Menu', + ['ems_menu_revive'] = 'Reviver jogador', + ['ems_menu_putincar'] = 'Colocar no veículo', + -- Phone + ['alert_ambulance'] = 'ambulância de alerta', + -- Death + ['respawn_at_hospital'] = 'você quer ser transportado para o hospital?', + ['yes'] = 'sim', + ['please_wait'] = 'por favor, espere ~b~', + ['minutes'] = ' minutos ', + ['seconds_fine'] = ' segundos ~w~para respawn \nRespawn agora para ~g~$', + ['seconds'] = ' segundos ~w~para respawn.', + ['press_respawn_fine'] = '~w~ [Pressione ~b~E~w~]', + ['press_respawn'] = 'pressione [~b~E~w~] para respawn.', + -- Revive + ['revive_help'] = 'reviver um jogador', } diff --git a/locales/de.lua b/locales/de.lua index 41a263cc..5f3b0328 100644 --- a/locales/de.lua +++ b/locales/de.lua @@ -1,46 +1,46 @@ Locales['de'] = { - --Cloakroom - ['cloakroom'] = 'Umkleide', - ['ems_clothes_civil'] = 'Zivilkleidung', - ['ems_clothes_ems'] = 'Arbeitskleidung', - --Vehicles - ['veh_menu'] = 'Fahrzeuge', - ['veh_spawn'] = 'Drücke ~INPUT_CONTEXT~ um ein Fahrzeug zu bekommen', - ['store_veh'] = 'Drücke ~INPUT_CONTEXT~ um das Fahrzeug zu parken', - ['ambulance'] = 'Krankenwagen', - ['helicopter'] = 'Helicopter', - --Action Menu - ['hospital'] = 'Krankenhaus', - ['revive_inprogress'] = 'wiederbeleben im Gange', - ['revive_complete'] = 'du wurdest wiederbelebt ', - ['no_players'] = 'keine Spieler in der Nähe', - ['no_vehicles'] = 'keine Fahrzeuge in der Nähe', - ['isdead'] = 'ist gestorben', - ['unconscious'] = 'ist nicht im Koma', - --Boss Menu - ['deposit_society'] = 'Notdienst einzahlen', - ['withdraw_society'] = 'Notdienst abheben', - --Misc - ['invalid_amount'] = '~r~ungültiger Betrag', - ['open_menu'] = 'Drücke ~INPUT_CONTEXT~ um das Menü zu öffnen', - ['deposit_amount'] = 'Betrag zum einzahlen', - ['money_withdraw'] = 'Betrag zum abheben', - -- F6 Menu - ['ems_menu'] = 'Notdienst - Menü', - ['ems_menu_title'] = 'Notdienst - Menü', - ['ems_menu_revive'] = 'Spieler wiederbeleben', - ['ems_menu_putincar'] = 'in Fahrzeug setzen', - -- Phone - ['alert_ambulance'] = 'Notdienst anrufen', - -- Death - ['respawn_at_hospital'] = 'Willst du ins Krankenhaus gebracht werden?', - ['yes'] = 'ja', - ['please_wait'] = 'bitte warte ~b~', - ['minutes'] = ' minuten ', - ['seconds_fine'] = ' sekunden ~w~zum respawnen\nRespawn jetzt für ~g~$', - ['seconds'] = ' sekunden ~w~bis zum respawn.', - ['press_respawn_fine'] = '~w~ [Drücke ~b~E~w~]', - ['press_respawn'] = 'Drücke [~b~E~w~] zum respawnen.', - -- Revive - ['revive_help'] = 'Spieler wiederbeleben', + -- Cloakroom + ['cloakroom'] = 'Umkleide', + ['ems_clothes_civil'] = 'Zivilkleidung', + ['ems_clothes_ems'] = 'Arbeitskleidung', + -- Vehicles + ['veh_menu'] = 'Fahrzeuge', + ['veh_spawn'] = 'Drücke ~INPUT_CONTEXT~ um ein Fahrzeug zu bekommen', + ['store_veh'] = 'Drücke ~INPUT_CONTEXT~ um das Fahrzeug zu parken', + ['ambulance'] = 'Krankenwagen', + ['helicopter'] = 'Helicopter', + -- Action Menu + ['hospital'] = 'Krankenhaus', + ['revive_inprogress'] = 'wiederbeleben im Gange', + ['revive_complete'] = 'du wurdest wiederbelebt ', + ['no_players'] = 'keine Spieler in der Nähe', + ['no_vehicles'] = 'keine Fahrzeuge in der Nähe', + ['isdead'] = 'ist gestorben', + ['unconscious'] = 'ist nicht im Koma', + -- Boss Menu + ['deposit_society'] = 'Notdienst einzahlen', + ['withdraw_society'] = 'Notdienst abheben', + -- Misc + ['invalid_amount'] = '~r~ungültiger Betrag', + ['open_menu'] = 'Drücke ~INPUT_CONTEXT~ um das Menü zu öffnen', + ['deposit_amount'] = 'Betrag zum einzahlen', + ['money_withdraw'] = 'Betrag zum abheben', + -- F6 Menu + ['ems_menu'] = 'Notdienst - Menü', + ['ems_menu_title'] = 'Notdienst - Menü', + ['ems_menu_revive'] = 'Spieler wiederbeleben', + ['ems_menu_putincar'] = 'in Fahrzeug setzen', + -- Phone + ['alert_ambulance'] = 'Notdienst anrufen', + -- Death + ['respawn_at_hospital'] = 'Willst du ins Krankenhaus gebracht werden?', + ['yes'] = 'ja', + ['please_wait'] = 'bitte warte ~b~', + ['minutes'] = ' minuten ', + ['seconds_fine'] = ' sekunden ~w~zum respawnen\nRespawn jetzt für ~g~$', + ['seconds'] = ' sekunden ~w~bis zum respawn.', + ['press_respawn_fine'] = '~w~ [Drücke ~b~E~w~]', + ['press_respawn'] = 'Drücke [~b~E~w~] zum respawnen.', + -- Revive + ['revive_help'] = 'Spieler wiederbeleben', } diff --git a/locales/en.lua b/locales/en.lua index 7386d01e..f3d8982b 100644 --- a/locales/en.lua +++ b/locales/en.lua @@ -1,47 +1,47 @@ Locales['en'] = { - --Cloakroom - ['cloakroom'] = 'locker Room', - ['ems_clothes_civil'] = 'civilian Clothes', - ['ems_clothes_ems'] = 'eMS Clothes', - --Vehicles - ['veh_menu'] = 'vehicle', - ['veh_spawn'] = 'press ~INPUT_CONTEXT~ to get a Vehicle or Helicopter', - ['store_veh'] = 'press ~INPUT_CONTEXT~ to store the vehicle', - ['ambulance'] = 'ambulance', - ['helicopter'] = 'helicopter', - --Action Menu - ['hospital'] = 'hospital', - ['revive_inprogress'] = 'revive in progress', - ['revive_complete'] = 'you have been revived ', - ['no_players'] = 'no players nearby', - ['no_vehicles'] = 'no vehicles nearby', - ['isdead'] = 'is dead', - ['unconscious'] = 'is not unconscious', - --Boss Menu - ['deposit_society'] = 'eMS Deposit', - ['withdraw_society'] = 'eMS Withdraw', - ['boss_actions'] = 'boss Actions', - --Misc - ['invalid_amount'] = '~r~invalid amount', - ['open_menu'] = 'press ~INPUT_CONTEXT~ to open the menu', - ['deposit_amount'] = 'deposit Amount', - ['money_withdraw'] = 'amount withdrawn', - -- F6 Menu - ['ems_menu'] = 'eMS Menu', - ['ems_menu_title'] = 'ambulance - EMS Menu', - ['ems_menu_revive'] = 'revive Player', - ['ems_menu_putincar'] = 'put in Vehicle', - -- Phone - ['alert_ambulance'] = 'alert Ambulance', - -- Death - ['respawn_at_hospital'] = 'do you want to be transported to the hospital?', - ['yes'] = 'yes', - ['please_wait'] = 'please wait ~b~', - ['minutes'] = ' minutes ', - ['seconds_fine'] = ' seconds ~w~to respawn \nRespawn now for ~g~$', - ['seconds'] = ' seconds ~w~to respawn.', - ['press_respawn_fine'] = '~w~ [Press ~b~E~w~]', - ['press_respawn'] = 'press [~b~E~w~] to respawn.', - -- Revive - ['revive_help'] = 'revive a player', + -- Cloakroom + ['cloakroom'] = 'locker Room', + ['ems_clothes_civil'] = 'civilian Clothes', + ['ems_clothes_ems'] = 'eMS Clothes', + -- Vehicles + ['veh_menu'] = 'vehicle', + ['veh_spawn'] = 'press ~INPUT_CONTEXT~ to get a Vehicle or Helicopter', + ['store_veh'] = 'press ~INPUT_CONTEXT~ to store the vehicle', + ['ambulance'] = 'ambulance', + ['helicopter'] = 'helicopter', + -- Action Menu + ['hospital'] = 'hospital', + ['revive_inprogress'] = 'revive in progress', + ['revive_complete'] = 'you have been revived ', + ['no_players'] = 'no players nearby', + ['no_vehicles'] = 'no vehicles nearby', + ['isdead'] = 'is dead', + ['unconscious'] = 'is not unconscious', + -- Boss Menu + ['deposit_society'] = 'eMS Deposit', + ['withdraw_society'] = 'eMS Withdraw', + ['boss_actions'] = 'boss Actions', + -- Misc + ['invalid_amount'] = '~r~invalid amount', + ['open_menu'] = 'press ~INPUT_CONTEXT~ to open the menu', + ['deposit_amount'] = 'deposit Amount', + ['money_withdraw'] = 'amount withdrawn', + -- F6 Menu + ['ems_menu'] = 'eMS Menu', + ['ems_menu_title'] = 'ambulance - EMS Menu', + ['ems_menu_revive'] = 'revive Player', + ['ems_menu_putincar'] = 'put in Vehicle', + -- Phone + ['alert_ambulance'] = 'alert Ambulance', + -- Death + ['respawn_at_hospital'] = 'do you want to be transported to the hospital?', + ['yes'] = 'yes', + ['please_wait'] = 'please wait ~b~', + ['minutes'] = ' minutes ', + ['seconds_fine'] = ' seconds ~w~to respawn \nRespawn now for ~g~$', + ['seconds'] = ' seconds ~w~to respawn.', + ['press_respawn_fine'] = '~w~ [Press ~b~E~w~]', + ['press_respawn'] = 'press [~b~E~w~] to respawn.', + -- Revive + ['revive_help'] = 'revive a player', } diff --git a/locales/es.lua b/locales/es.lua index d6dddfc3..139404ca 100644 --- a/locales/es.lua +++ b/locales/es.lua @@ -1,46 +1,46 @@ -Locales['es'] = { - --Cloakroom - ['cloakroom'] = 'Guardarropa', - ['ems_clothes_civil'] = 'Camiseta', - ['ems_clothes_ems'] = 'Equipo de ambulancia', - --Vehicles - ['veh_menu'] = 'vehículo', - ['veh_spawn'] = 'Presione ~INPUT_CONTEXT~ para sacar un vehículo', - ['store_veh'] = 'Presione ~INPUT_CONTEXT~ para alamcenar un vehículo', - ['ambulance'] = 'Ambulancia', - ['helicopter'] = 'helicóptero', - --Action Menu - ['hospital'] = 'hospital', - ['revive_inprogress'] = 'reanimación en curso', - ['revive_complete'] = 'has sido reanimado ', - ['no_players'] = 'ningún jugador cerca', - ['no_vehicles'] = 'ningún vehículo cerca', - ['isdead'] = 'Has muerto', - ['unconscious'] = 'n\'estás inconsciente', - --Boss Menu - ['deposit_society'] = 'depositar dinero', - ['withdraw_society'] = 'retirar dinero', - --Misc - ['invalid_amount'] = '~r~cantidad no válida', - ['open_menu'] = 'Presione ~INPUT_CONTEXT~ para abrir el menú', - ['deposit_amount'] = 'cantidad de fianza depositada', - ['money_withdraw'] = 'cantidad de fianza retirada', - -- F6 Menu - ['ems_menu'] = 'ayuda ciudadana', - ['ems_menu_title'] = 'ambulancia - Ayuda Ciudadana', - ['ems_menu_revive'] = 'reanimar', - ['ems_menu_putincar'] = 'meter en el vehículo', - -- Phone - ['alert_ambulance'] = 'Alerta de ambulancia', - -- Death - ['respawn_at_hospital'] = '¿Quieres ser transportado al hospital?', - ['yes'] = 'oui', - ['please_wait'] = 's\'por favor, espere ~b~', - ['minutes'] = ' minutos ', - ['seconds_fine'] = ' segundos ~w~to reparecer \nReapareciendo ahora por ~g~€', - ['seconds'] = ' segundos ~w~para reparecer.', - ['press_respawn_fine'] = '~w~ [Pulsa ~b~E~w~]', - ['press_respawn'] = 'presione [~b~E~w~] para reparecer.', - -- Revive - ['revive_help'] = 'reviver un jugador', -} +Locales['es'] = { + -- Cloakroom + ['cloakroom'] = 'Guardarropa', + ['ems_clothes_civil'] = 'Camiseta', + ['ems_clothes_ems'] = 'Equipo de ambulancia', +-- Vehicles + ['veh_menu'] = 'vehículo', + ['veh_spawn'] = 'Presione ~INPUT_CONTEXT~ para sacar un vehículo', + ['store_veh'] = 'Presione ~INPUT_CONTEXT~ para alamcenar un vehículo', + ['ambulance'] = 'Ambulancia', + ['helicopter'] = 'helicóptero', + -- Action Menu + ['hospital'] = 'hospital', + ['revive_inprogress'] = 'reanimación en curso', + ['revive_complete'] = 'has sido reanimado ', + ['no_players'] = 'ningún jugador cerca', + ['no_vehicles'] = 'ningún vehículo cerca', + ['isdead'] = 'Has muerto', + ['unconscious'] = 'n\'estás inconsciente', + -- oss Menu + ['deposit_society'] = 'depositar dinero', + ['withdraw_society'] = 'retirar dinero', + -- Misc + ['invalid_amount'] = '~r~cantidad no válida', + ['open_menu'] = 'Presione ~INPUT_CONTEXT~ para abrir el menú', + ['deposit_amount'] = 'cantidad de fianza depositada', + ['money_withdraw'] = 'cantidad de fianza retirada', + -- F6 Menu + ['ems_menu'] = 'ayuda ciudadana', + ['ems_menu_title'] = 'ambulancia - Ayuda Ciudadana', + ['ems_menu_revive'] = 'reanimar', + ['ems_menu_putincar'] = 'meter en el vehículo', + -- Phone + ['alert_ambulance'] = 'Alerta de ambulancia', + -- Death + ['respawn_at_hospital'] = '¿Quieres ser transportado al hospital?', + ['yes'] = 'oui', + ['please_wait'] = 's\'por favor, espere ~b~', + ['minutes'] = ' minutos ', + ['seconds_fine'] = ' segundos ~w~to reparecer \nReapareciendo ahora por ~g~€', + ['seconds'] = ' segundos ~w~para reparecer.', + ['press_respawn_fine'] = '~w~ [Pulsa ~b~E~w~]', + ['press_respawn'] = 'presione [~b~E~w~] para reparecer.', + -- Revive + ['revive_help'] = 'reviver un jugador', +} diff --git a/locales/fr.lua b/locales/fr.lua index b2c57384..decee714 100644 --- a/locales/fr.lua +++ b/locales/fr.lua @@ -1,47 +1,47 @@ Locales['fr'] = { - --Cloakroom - ['cloakroom'] = 'Vestiaire', - ['ems_clothes_civil'] = 'Tenue Civil', - ['ems_clothes_ems'] = 'Tenue Ambulancier', - --Vehicles - ['veh_menu'] = 'véhicule', - ['veh_spawn'] = 'appuyez sur ~INPUT_CONTEXT~ pour sortir un véhicule', - ['store_veh'] = 'appuyez sur ~INPUT_CONTEXT~ pour ranger le véhicule', - ['ambulance'] = 'ambulance', - ['helicopter'] = 'hélicoptère', - --Action Menu - ['hospital'] = 'hôpital', - ['revive_inprogress'] = 'réanimation en cours', - ['revive_complete'] = 'vous avez réanimé ', - ['no_players'] = 'aucun joueur à proximité', - ['no_vehicles'] = 'aucun véhicule à proximité', - ['isdead'] = 'a succombé', - ['unconscious'] = 'n\'est pas inconscient', - --Boss Menu - ['deposit_society'] = 'déposer argent', - ['withdraw_society'] = 'retirer argent société', - ['boss_actions'] = 'action Patron', - --Misc - ['invalid_amount'] = '~r~montant invalide', - ['open_menu'] = 'appuyez sur ~INPUT_CONTEXT~ pour ouvrir le menu', - ['deposit_amount'] = 'montant du dépôt', - ['money_withdraw'] = 'montant du retrait', - -- F6 Menu - ['ems_menu'] = 'interaction citoyen', - ['ems_menu_title'] = 'ambulance - Interactions Citoyen', - ['ems_menu_revive'] = 'réanimer', - ['ems_menu_putincar'] = 'mettre dans véhicule', - -- Phone - ['alert_ambulance'] = 'alerte Ambulance', - -- Death - ['respawn_at_hospital'] = 'voulez-vous être transporté à l\'hôpital ?', - ['yes'] = 'oui', - ['please_wait'] = 's\'il vous plaît, attendez ~b~', - ['minutes'] = ' minutes ', - ['seconds_fine'] = ' secondes ~w~ pour réapparaître \nRéapparaître maintenant pour ~g~$', - ['seconds'] = ' secondes ~w~ pour réapparaître.', - ['press_respawn_fine'] = '~w~ [Presse ~b~E~w~]', - ['press_respawn'] = 'appuyez [~b~E~w~] sur pour réapparaître.', - -- Revive - ['revive_help'] = 'relancer un joueur', + -- Cloakroom + ['cloakroom'] = 'Vestiaire', + ['ems_clothes_civil'] = 'Tenue Civil', + ['ems_clothes_ems'] = 'Tenue Ambulancier', + -- Vehicles + ['veh_menu'] = 'véhicule', + ['veh_spawn'] = 'appuyez sur ~INPUT_CONTEXT~ pour sortir un véhicule', + ['store_veh'] = 'appuyez sur ~INPUT_CONTEXT~ pour ranger le véhicule', + ['ambulance'] = 'ambulance', + ['helicopter'] = 'hélicoptère', + -- Action Menu + ['hospital'] = 'hôpital', + ['revive_inprogress'] = 'réanimation en cours', + ['revive_complete'] = 'vous avez réanimé ', + ['no_players'] = 'aucun joueur à proximité', + ['no_vehicles'] = 'aucun véhicule à proximité', + ['isdead'] = 'a succombé', + ['unconscious'] = 'n\'est pas inconscient', + -- Boss Menu + ['deposit_society'] = 'déposer argent', + ['withdraw_society'] = 'retirer argent société', + ['boss_actions'] = 'action Patron', + -- Misc + ['invalid_amount'] = '~r~montant invalide', + ['open_menu'] = 'appuyez sur ~INPUT_CONTEXT~ pour ouvrir le menu', + ['deposit_amount'] = 'montant du dépôt', + ['money_withdraw'] = 'montant du retrait', + -- F6 Menu + ['ems_menu'] = 'interaction citoyen', + ['ems_menu_title'] = 'ambulance - Interactions Citoyen', + ['ems_menu_revive'] = 'réanimer', + ['ems_menu_putincar'] = 'mettre dans véhicule', + -- Phone + ['alert_ambulance'] = 'alerte Ambulance', + -- Death + ['respawn_at_hospital'] = 'voulez-vous être transporté à l\'hôpital ?', + ['yes'] = 'oui', + ['please_wait'] = 's\'il vous plaît, attendez ~b~', + ['minutes'] = ' minutes ', + ['seconds_fine'] = ' secondes ~w~ pour réapparaître \nRéapparaître maintenant pour ~g~$', + ['seconds'] = ' secondes ~w~ pour réapparaître.', + ['press_respawn_fine'] = '~w~ [Presse ~b~E~w~]', + ['press_respawn'] = 'appuyez [~b~E~w~] sur pour réapparaître.', + -- Revive + ['revive_help'] = 'relancer un joueur', } diff --git a/localization/de_esx_ambulancejob.sql b/localization/de_esx_ambulancejob.sql index cd81e976..c2b62522 100644 --- a/localization/de_esx_ambulancejob.sql +++ b/localization/de_esx_ambulancejob.sql @@ -1,6 +1,6 @@ USE `essentialmode`; -INSERT INTO `addon_account` (name, label, shared) VALUES +INSERT INTO `addon_account` (name, label, shared) VALUES ('society_ambulance', 'Notdienst', 1) ; @@ -11,6 +11,6 @@ INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_ ('ambulance',3,'boss','Chirurg',80,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}') ; -INSERT INTO `jobs` (name, label) VALUES +INSERT INTO `jobs` (name, label) VALUES ('ambulance','Notdienst') ; diff --git a/server/main.lua b/server/main.lua index e4c9d7fc..70b9e57d 100644 --- a/server/main.lua +++ b/server/main.lua @@ -4,7 +4,7 @@ TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) RegisterServerEvent('esx_ambulancejob:revive') AddEventHandler('esx_ambulancejob:revive', function(target) - TriggerClientEvent('esx_ambulancejob:revive', target) + TriggerClientEvent('esx_ambulancejob:revive', target) end) TriggerEvent('esx_phone:registerNumber', 'ambulance', _U('alert_ambulance'), true, true) @@ -12,59 +12,59 @@ TriggerEvent('esx_society:registerSociety', 'ambulance', 'Ambulance', 'society_a ESX.RegisterServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function(source, cb) - local xPlayer = ESX.GetPlayerFromId(source) + local xPlayer = ESX.GetPlayerFromId(source) - if Config.RemoveCashAfterRPDeath then - xPlayer.removeMoney(xPlayer.getMoney()) - xPlayer.setAccountMoney('black_money', 0) - end + if Config.RemoveCashAfterRPDeath then + xPlayer.removeMoney(xPlayer.getMoney()) + xPlayer.setAccountMoney('black_money', 0) + end - if Config.RemoveItemsAfterRPDeath then - for i=1, #xPlayer.inventory, 1 do - if xPlayer.inventory[i].count > 0 then - xPlayer.setInventoryItem(xPlayer.inventory[i].name, 0) - end - end - end + if Config.RemoveItemsAfterRPDeath then + for i=1, #xPlayer.inventory, 1 do + if xPlayer.inventory[i].count > 0 then + xPlayer.setInventoryItem(xPlayer.inventory[i].name, 0) + end + end + end - if Config.RemoveWeaponsAfterRPDeath then - for i=1, #xPlayer.loadout, 1 do - xPlayer.removeWeapon(xPlayer.loadout[i].name) - end - end + if Config.RemoveWeaponsAfterRPDeath then + for i=1, #xPlayer.loadout, 1 do + xPlayer.removeWeapon(xPlayer.loadout[i].name) + end + end - cb() + cb() end) ESX.RegisterServerCallback('esx_ambulancejob:removeItemsAfterRPDeathRemoveMoney', function(source, cb) - local xPlayer = ESX.GetPlayerFromId(source) + local xPlayer = ESX.GetPlayerFromId(source) - if Config.RemoveCashAfterRPDeath then - xPlayer.removeMoney(xPlayer.getMoney()) - xPlayer.setAccountMoney('black_money', 0) - end + if Config.RemoveCashAfterRPDeath then + xPlayer.removeMoney(xPlayer.getMoney()) + xPlayer.setAccountMoney('black_money', 0) + end - if Config.EarlyRespawn and Config.EarlyRespawnFine then - xPlayer.removeAccountMoney('bank', Config.EarlyRespawnFineAmount) - end + if Config.EarlyRespawn and Config.EarlyRespawnFine then + xPlayer.removeAccountMoney('bank', Config.EarlyRespawnFineAmount) + end - if Config.RemoveItemsAfterRPDeath then - for i=1, #xPlayer.inventory, 1 do - if xPlayer.inventory[i].count > 0 and not xPlayer.inventory[i].rare then - xPlayer.setInventoryItem(xPlayer.inventory[i].name, 0) - end - end - end + if Config.RemoveItemsAfterRPDeath then + for i=1, #xPlayer.inventory, 1 do + if xPlayer.inventory[i].count > 0 and not xPlayer.inventory[i].rare then + xPlayer.setInventoryItem(xPlayer.inventory[i].name, 0) + end + end + end - if Config.RemoveWeaponsAfterRPDeath then - for i=1, #xPlayer.loadout, 1 do - xPlayer.removeWeapon(xPlayer.loadout[i].name) - end - end + if Config.RemoveWeaponsAfterRPDeath then + for i=1, #xPlayer.loadout, 1 do + xPlayer.removeWeapon(xPlayer.loadout[i].name) + end + end - cb() + cb() end) @@ -78,12 +78,12 @@ end) TriggerEvent('es:addGroupCommand', 'revive', 'admin', function(source, args, user) - if args[2] ~= nil then - TriggerClientEvent('esx_ambulancejob:revive', tonumber(args[2])) - else - TriggerClientEvent('esx_ambulancejob:revive', source) - end + if args[2] ~= nil then + TriggerClientEvent('esx_ambulancejob:revive', tonumber(args[2])) + else + TriggerClientEvent('esx_ambulancejob:revive', source) + end end, function(source, args, user) - TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "Insufficient Permissions.") + TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "Insufficient Permissions.") end, {help = _U('revive_help'), params = {{name = 'id'}}}) From 52c9f7d03082b9f4ad4ff34ecbdb7362d9a9ca07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20N=27gadi?= Date: Thu, 14 Sep 2017 23:16:30 +0200 Subject: [PATCH 046/177] Update LICENSE.txt --- LICENSE.txt | 674 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 674 insertions(+) create mode 100644 LICENSE.txt diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 00000000..dcfcef62 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +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. + + fxserver-esx_ambulancejob + Copyright (C) 2015 Jérémie N'gadi + + 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 . + +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: + + fxserver-esx_ambulancejob Copyright (C) 2015 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. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. \ No newline at end of file From 8f32fa10091437b701326dd0b3ad40a662b0c500 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20N=27gadi?= Date: Fri, 15 Sep 2017 15:27:53 +0200 Subject: [PATCH 047/177] chore(resource): Add version --- __resource.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/__resource.lua b/__resource.lua index 8dc4f3d5..536a9b40 100644 --- a/__resource.lua +++ b/__resource.lua @@ -2,6 +2,8 @@ resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937' description 'ESX Ambulance Job' +version '1.0.0' + server_scripts { '@mysql-async/lib/MySQL.lua', '@es_extended/locale.lua', From 4554bb0b96cd4fa1e7edf5cecd7c88291b950e90 Mon Sep 17 00:00:00 2001 From: Romain Lanz Date: Mon, 18 Sep 2017 18:58:04 +0200 Subject: [PATCH 048/177] chore(blip): extract configuration --- client/main.lua | 7 ++++--- config.lua | 7 +++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/client/main.lua b/client/main.lua index 0ee374e7..e0a0a2e4 100644 --- a/client/main.lua +++ b/client/main.lua @@ -762,9 +762,10 @@ Citizen.CreateThread(function() local blip = AddBlipForCoord(Config.Zones.HospitalInteriorOutside1.Pos.x, Config.Zones.HospitalInteriorOutside1.Pos.y, Config.Zones.HospitalInteriorOutside1.Pos.z) - SetBlipSprite (blip, 61) - SetBlipDisplay(blip, 4) - SetBlipScale (blip, 1.2) + SetBlipSprite (blip, Config.Zones.Blip.Sprite) + SetBlipDisplay(blip, Config.Zones.Blip.Display) + SetBlipScale (blip, Config.Zones.Blip.Scale) + SetBlipColour (blip, Config.Zones.Blip.Colour) SetBlipAsShortRange(blip, true) BeginTextCommandSetBlipName("STRING") diff --git a/config.lua b/config.lua index e9971e5e..050faa3c 100644 --- a/config.lua +++ b/config.lua @@ -16,6 +16,13 @@ Config.Locale = 'fr' Config.Zones = { + Blip = { + Pos = { x = 425.130, y = -979.558, z = 30.711 }, + Sprite = 61, + Display = 4, + Scale = 1.2, + Colour = 2, + }, HospitalInteriorEntering1 = { Pos = { x = 1151.447, y = -1529.491, z = 34.375 }, From b30d9e06e1ea3d0d8563b851bf649a31bf799461 Mon Sep 17 00:00:00 2001 From: Romain Lanz Date: Wed, 20 Sep 2017 21:20:28 +0200 Subject: [PATCH 049/177] fix(marker): move blip out of Zones Table --- client/main.lua | 12 ++++++------ config.lua | 18 +++++++++--------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/client/main.lua b/client/main.lua index e0a0a2e4..455a6502 100644 --- a/client/main.lua +++ b/client/main.lua @@ -760,15 +760,15 @@ end) -- Create blips Citizen.CreateThread(function() - local blip = AddBlipForCoord(Config.Zones.HospitalInteriorOutside1.Pos.x, Config.Zones.HospitalInteriorOutside1.Pos.y, Config.Zones.HospitalInteriorOutside1.Pos.z) + local blip = AddBlipForCoord(Config.Blip.Pos.x, Config.Blip.Pos.y, Config.Blip.Pos.z) - SetBlipSprite (blip, Config.Zones.Blip.Sprite) - SetBlipDisplay(blip, Config.Zones.Blip.Display) - SetBlipScale (blip, Config.Zones.Blip.Scale) - SetBlipColour (blip, Config.Zones.Blip.Colour) + SetBlipSprite (blip, Config.Blip.Sprite) + SetBlipDisplay(blip, Config.Blip.Display) + SetBlipScale (blip, Config.Blip.Scale) + SetBlipColour (blip, Config.Blip.Colour) SetBlipAsShortRange(blip, true) - BeginTextCommandSetBlipName("STRING") + BeginTextCommandSetBlipName("STRING") AddTextComponentString(_U('hospital')) EndTextCommandSetBlipName(blip) diff --git a/config.lua b/config.lua index 050faa3c..fd045016 100644 --- a/config.lua +++ b/config.lua @@ -14,18 +14,18 @@ Config.EarlyRespawnFine = true Config.EarlyRespawnFineAmount = 500 Config.Locale = 'fr' +Config.Blip = { + Pos = { x = 1153.364, y = -979.558, z = 30.711 }, + Sprite = 61, + Display = 4, + Scale = 1.2, + Colour = 2, +}, + Config.Zones = { - Blip = { - Pos = { x = 425.130, y = -979.558, z = 30.711 }, - Sprite = 61, - Display = 4, - Scale = 1.2, - Colour = 2, - }, - HospitalInteriorEntering1 = { - Pos = { x = 1151.447, y = -1529.491, z = 34.375 }, + Pos = { x = 1151.447, y = -1525.731, z = 33.843 }, Size = { x = 1.5, y = 1.5, z = 1.0 }, Type = 1 }, From b7fc487c2c0d8310ab4748a22d85d53e54fbe7c0 Mon Sep 17 00:00:00 2001 From: Romain Lanz Date: Wed, 20 Sep 2017 21:20:51 +0200 Subject: [PATCH 050/177] chore: bump version --- __resource.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/__resource.lua b/__resource.lua index 536a9b40..27bdd64c 100644 --- a/__resource.lua +++ b/__resource.lua @@ -2,7 +2,7 @@ resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937' description 'ESX Ambulance Job' -version '1.0.0' +version '1.0.1' server_scripts { '@mysql-async/lib/MySQL.lua', From 546e8a69bfea9fd9d8b3dab5920e91e846cf2fb5 Mon Sep 17 00:00:00 2001 From: Romain Lanz Date: Wed, 20 Sep 2017 21:40:59 +0200 Subject: [PATCH 051/177] chore(coding-style): convert tabs to spaces --- client/main.lua | 1113 ++++++++++++++++++++++++----------------------- 1 file changed, 557 insertions(+), 556 deletions(-) diff --git a/client/main.lua b/client/main.lua index 455a6502..c99bb2bc 100644 --- a/client/main.lua +++ b/client/main.lua @@ -1,18 +1,16 @@ 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 } -ESX = nil local GUI = {} -GUI.Time = 0 local PlayerData = {} local FirstSpawn = true local IsDead = false @@ -23,738 +21,741 @@ local CurrentActionMsg = '' local CurrentActionData = {} local RespawnToHospitalMenu = nil +ESX = nil +GUI.Time = 0 + Citizen.CreateThread(function() - while ESX == nil do - TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) - Citizen.Wait(0) - end + while ESX == nil do + TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) + Citizen.Wait(0) + end end) function RespawnPed(ped, coords) - SetEntityCoordsNoOffset(ped, coords.x, coords.y, coords.z, false, false, false, true) - NetworkResurrectLocalPlayer(coords.x, coords.y, coords.z, coords.heading, true, false) - SetPlayerInvincible(ped, false) - TriggerEvent('playerSpawned', coords.x, coords.y, coords.z, coords.heading) - ClearPedBloodDamage(ped) - if RespawnToHospitalMenu ~= nil then - RespawnToHospitalMenu.close() - RespawnToHospitalMenu = nil - end - ESX.UI.Menu.CloseAll() + SetEntityCoordsNoOffset(ped, coords.x, coords.y, coords.z, false, false, false, true) + NetworkResurrectLocalPlayer(coords.x, coords.y, coords.z, coords.heading, true, false) + SetPlayerInvincible(ped, false) + TriggerEvent('playerSpawned', coords.x, coords.y, coords.z, coords.heading) + ClearPedBloodDamage(ped) + if RespawnToHospitalMenu ~= nil then + RespawnToHospitalMenu.close() + RespawnToHospitalMenu = nil + end + ESX.UI.Menu.CloseAll() end function StartRespawnToHospitalMenuTimer() - ESX.SetTimeout(Config.MenuRespawnToHospitalDelay, function() + ESX.SetTimeout(Config.MenuRespawnToHospitalDelay, function() - if IsDead then + if IsDead then - local elements = {} + local elements = {} - table.insert(elements, {label = _U('yes'), value = 'yes'}) + table.insert(elements, {label = _U('yes'), value = 'yes'}) - RespawnToHospitalMenu = ESX.UI.Menu.Open( - 'default', GetCurrentResourceName(), 'menuName', - { - title = _U('respawn_at_hospital'), - align = 'top-left', - elements = elements - }, - function(data, menu) --Submit Cb + RespawnToHospitalMenu = ESX.UI.Menu.Open( + 'default', GetCurrentResourceName(), 'menuName', + { + title = _U('respawn_at_hospital'), + align = 'top-left', + elements = elements + }, + function(data, menu) --Submit Cb - menu.close() + menu.close() - Citizen.CreateThread(function() + Citizen.CreateThread(function() - DoScreenFadeOut(800) + DoScreenFadeOut(800) - while not IsScreenFadedOut() do - Citizen.Wait(0) - end + while not IsScreenFadedOut() do + Citizen.Wait(0) + end - ESX.TriggerServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function() + ESX.TriggerServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function() - ESX.SetPlayerData('lastPosition', Config.Zones.HospitalInteriorInside1.Pos) - TriggerServerEvent('esx:updateLastPosition', Config.Zones.HospitalInteriorInside1.Pos) + ESX.SetPlayerData('lastPosition', Config.Zones.HospitalInteriorInside1.Pos) + TriggerServerEvent('esx:updateLastPosition', Config.Zones.HospitalInteriorInside1.Pos) - RespawnPed(GetPlayerPed(-1), Config.Zones.HospitalInteriorInside1.Pos) - StopScreenEffect('DeathFailOut') - DoScreenFadeIn(800) - end) - end) - end, - function(data, menu) --Cancel Cb - --menu.close() - end, - function(data, menu) --Change Cb - --print(data.current.value) - end, - function(data, menu) --Close Cb - RespawnToHospitalMenu = nil - end - ) - end - end) + RespawnPed(GetPlayerPed(-1), Config.Zones.HospitalInteriorInside1.Pos) + StopScreenEffect('DeathFailOut') + DoScreenFadeIn(800) + end) + end) + end, + function(data, menu) --Cancel Cb + --menu.close() + end, + function(data, menu) --Change Cb + --print(data.current.value) + end, + function(data, menu) --Close Cb + RespawnToHospitalMenu = nil + end + ) + end + end) end function StartRespawnTimer() - ESX.SetTimeout(Config.RespawnDelayAfterRPDeath, function() + ESX.SetTimeout(Config.RespawnDelayAfterRPDeath, function() - if IsDead then + if IsDead then - Citizen.CreateThread(function() + Citizen.CreateThread(function() - DoScreenFadeOut(800) + DoScreenFadeOut(800) - while not IsScreenFadedOut() do - Citizen.Wait(0) - end + while not IsScreenFadedOut() do + Citizen.Wait(0) + end - ESX.TriggerServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function() + ESX.TriggerServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function() - ESX.SetPlayerData('lastPosition', Config.Zones.HospitalInteriorInside1.Pos) - TriggerServerEvent('esx:updateLastPosition', Config.Zones.HospitalInteriorInside1.Pos) + ESX.SetPlayerData('lastPosition', Config.Zones.HospitalInteriorInside1.Pos) + TriggerServerEvent('esx:updateLastPosition', Config.Zones.HospitalInteriorInside1.Pos) - RespawnPed(GetPlayerPed(-1), Config.Zones.HospitalInteriorInside1.Pos) - StopScreenEffect('DeathFailOut') - DoScreenFadeIn(800) - end) - end) - end - end) + RespawnPed(GetPlayerPed(-1), Config.Zones.HospitalInteriorInside1.Pos) + StopScreenEffect('DeathFailOut') + DoScreenFadeIn(800) + end) + end) + end + end) end function RespawnTimer() - local timer = Config.RespawnDelayAfterRPDeath - local allowRespawn = Config.RespawnDelayAfterRPDeath/2 - local enoughMoney = false - local money = 0 + local timer = Config.RespawnDelayAfterRPDeath + local allowRespawn = Config.RespawnDelayAfterRPDeath/2 + local enoughMoney = false + local money = 0 - if IsDead and Config.ShowDeathTimer then - ESX.TriggerServerCallback('esx_ambulancejob:getBankMoney', function(money) - if money >= Config.EarlyRespawnFineAmount then - enoughMoney = true - else - enoughMoney = false - end - end) - Citizen.CreateThread(function() + if IsDead and Config.ShowDeathTimer then + ESX.TriggerServerCallback('esx_ambulancejob:getBankMoney', function(money) + if money >= Config.EarlyRespawnFineAmount then + enoughMoney = true + else + enoughMoney = false + end + end) + Citizen.CreateThread(function() - while timer > 0 and IsDead do - raw_seconds = timer/1000 - raw_minutes = raw_seconds/60 - minutes = stringsplit(raw_minutes, ".")[1] - seconds = stringsplit(raw_seconds-(minutes*60), ".")[1] + while timer > 0 and IsDead do + raw_seconds = timer/1000 + raw_minutes = raw_seconds/60 + minutes = stringsplit(raw_minutes, ".")[1] + seconds = stringsplit(raw_seconds-(minutes*60), ".")[1] - if Config.EarlyRespawn and Config.EarlyRespawnFine and enoughMoney then - SetTextFont(4) - SetTextProportional(0) - SetTextScale(0.0, 0.5) - SetTextColour(255, 255, 255, 255) - SetTextDropshadow(0, 0, 0, 0, 255) - SetTextEdge(1, 0, 0, 0, 255) - SetTextDropShadow() - SetTextOutline() - SetTextEntry("STRING") - AddTextComponentString(_U('please_wait') .. minutes .. _U('minutes') .. seconds .. _U('seconds_fine') .. Config.EarlyRespawnFineAmount .. _U('press_respawn_fine')) - SetTextCentre(true) - DrawText(0.5, 0.8) - timer = timer - 15 - Citizen.Wait(0) - if IsControlPressed(0, Keys['E']) then - DoScreenFadeOut(800) + if Config.EarlyRespawn and Config.EarlyRespawnFine and enoughMoney then + SetTextFont(4) + SetTextProportional(0) + SetTextScale(0.0, 0.5) + SetTextColour(255, 255, 255, 255) + SetTextDropshadow(0, 0, 0, 0, 255) + SetTextEdge(1, 0, 0, 0, 255) + SetTextDropShadow() + SetTextOutline() + SetTextEntry("STRING") + AddTextComponentString(_U('please_wait') .. minutes .. _U('minutes') .. seconds .. _U('seconds_fine') .. Config.EarlyRespawnFineAmount .. _U('press_respawn_fine')) + SetTextCentre(true) + DrawText(0.5, 0.8) + timer = timer - 15 + Citizen.Wait(0) + if IsControlPressed(0, Keys['E']) then + DoScreenFadeOut(800) - while not IsScreenFadedOut() do - Citizen.Wait(0) - end + while not IsScreenFadedOut() do + Citizen.Wait(0) + end - ESX.TriggerServerCallback('esx_ambulancejob:removeItemsAfterRPDeathRemoveMoney', function() + ESX.TriggerServerCallback('esx_ambulancejob:removeItemsAfterRPDeathRemoveMoney', function() - TriggerServerEvent('esx_ambulancejob:removeAccountMoney', source) - ESX.SetPlayerData('lastPosition', Config.Zones.HospitalInteriorInside1.Pos) - TriggerServerEvent('esx:updateLastPosition', Config.Zones.HospitalInteriorInside1.Pos) + TriggerServerEvent('esx_ambulancejob:removeAccountMoney', source) + ESX.SetPlayerData('lastPosition', Config.Zones.HospitalInteriorInside1.Pos) + TriggerServerEvent('esx:updateLastPosition', Config.Zones.HospitalInteriorInside1.Pos) - RespawnPed(GetPlayerPed(-1), Config.Zones.HospitalInteriorInside1.Pos) - StopScreenEffect('DeathFailOut') - DoScreenFadeIn(800) - end) - end - else - SetTextFont(4) - SetTextProportional(0) - SetTextScale(0.0, 0.5) - SetTextColour(255, 255, 255, 255) - SetTextDropshadow(0, 0, 0, 0, 255) - SetTextEdge(1, 0, 0, 0, 255) - SetTextDropShadow() - SetTextOutline() - SetTextEntry("STRING") - AddTextComponentString(_U('please_wait') .. minutes .. _U('minutes') .. seconds .. _U('seconds')) - SetTextCentre(true) - DrawText(0.5, 0.8) - timer = timer - 15 - Citizen.Wait(0) - end - end + RespawnPed(GetPlayerPed(-1), Config.Zones.HospitalInteriorInside1.Pos) + StopScreenEffect('DeathFailOut') + DoScreenFadeIn(800) + end) + end + else + SetTextFont(4) + SetTextProportional(0) + SetTextScale(0.0, 0.5) + SetTextColour(255, 255, 255, 255) + SetTextDropshadow(0, 0, 0, 0, 255) + SetTextEdge(1, 0, 0, 0, 255) + SetTextDropShadow() + SetTextOutline() + SetTextEntry("STRING") + AddTextComponentString(_U('please_wait') .. minutes .. _U('minutes') .. seconds .. _U('seconds')) + SetTextCentre(true) + DrawText(0.5, 0.8) + timer = timer - 15 + Citizen.Wait(0) + end + end - while timer <= 0 and IsDead do - SetTextFont(4) - SetTextProportional(0) - SetTextScale(0.0, 0.5) - SetTextColour(255, 255, 255, 255) - SetTextDropshadow(0, 0, 0, 0, 255) - SetTextEdge(1, 0, 0, 0, 255) - SetTextDropShadow() - SetTextOutline() - SetTextEntry("STRING") - AddTextComponentString(_U('press_respawn')) - SetTextCentre(true) - DrawText(0.5, 0.8) - Citizen.Wait(0) - if IsControlPressed(0, Keys['E']) then - DoScreenFadeOut(800) + while timer <= 0 and IsDead do + SetTextFont(4) + SetTextProportional(0) + SetTextScale(0.0, 0.5) + SetTextColour(255, 255, 255, 255) + SetTextDropshadow(0, 0, 0, 0, 255) + SetTextEdge(1, 0, 0, 0, 255) + SetTextDropShadow() + SetTextOutline() + SetTextEntry("STRING") + AddTextComponentString(_U('press_respawn')) + SetTextCentre(true) + DrawText(0.5, 0.8) + Citizen.Wait(0) + if IsControlPressed(0, Keys['E']) then + DoScreenFadeOut(800) - while not IsScreenFadedOut() do - Citizen.Wait(0) - end + while not IsScreenFadedOut() do + Citizen.Wait(0) + end - ESX.TriggerServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function() + ESX.TriggerServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function() - ESX.SetPlayerData('lastPosition', Config.Zones.HospitalInteriorInside1.Pos) - TriggerServerEvent('esx:updateLastPosition', Config.Zones.HospitalInteriorInside1.Pos) + ESX.SetPlayerData('lastPosition', Config.Zones.HospitalInteriorInside1.Pos) + TriggerServerEvent('esx:updateLastPosition', Config.Zones.HospitalInteriorInside1.Pos) - RespawnPed(GetPlayerPed(-1), Config.Zones.HospitalInteriorInside1.Pos) - StopScreenEffect('DeathFailOut') - DoScreenFadeIn(800) - end) - end - end - end) - end + RespawnPed(GetPlayerPed(-1), Config.Zones.HospitalInteriorInside1.Pos) + StopScreenEffect('DeathFailOut') + DoScreenFadeIn(800) + end) + end + end + end) + end end function TeleportFadeEffect(entity, coords) - Citizen.CreateThread(function() + Citizen.CreateThread(function() - DoScreenFadeOut(800) + DoScreenFadeOut(800) - while not IsScreenFadedOut() do - Citizen.Wait(0) - end + while not IsScreenFadedOut() do + Citizen.Wait(0) + end - ESX.Game.Teleport(entity, coords, function() - DoScreenFadeIn(800) - end) + ESX.Game.Teleport(entity, coords, function() + DoScreenFadeIn(800) + end) - end) + end) end function WarpPedInClosestVehicle(ped) - local coords = GetEntityCoords(ped) + local coords = GetEntityCoords(ped) local vehicle, distance = ESX.Game.GetClosestVehicle({ - x = coords.x, - y = coords.y, - z = coords.z + x = coords.x, + y = coords.y, + z = coords.z }) if distance ~= -1 and distance <= 5.0 then - local maxSeats = GetVehicleMaxNumberOfPassengers(vehicle) - local freeSeat = nil + local maxSeats = GetVehicleMaxNumberOfPassengers(vehicle) + local freeSeat = nil - for i=maxSeats - 1, 0, -1 do - if IsVehicleSeatFree(vehicle, i) then - freeSeat = i - break - end - end + for i=maxSeats - 1, 0, -1 do + if IsVehicleSeatFree(vehicle, i) then + freeSeat = i + break + end + end - if freeSeat ~= nil then - TaskWarpPedIntoVehicle(ped, vehicle, freeSeat) - end + if freeSeat ~= nil then + TaskWarpPedIntoVehicle(ped, vehicle, freeSeat) + end else - ESX.ShowNotification(_U('no_vehicles')) + ESX.ShowNotification(_U('no_vehicles')) end end function OpenAmbulanceActionsMenu() - local elements = { - {label = _U('cloakroom'), value = 'cloakroom'} - } + local elements = { + {label = _U('cloakroom'), value = 'cloakroom'} + } - if Config.EnablePlayerManagement and PlayerData.job.grade_name == 'boss' then - table.insert(elements, {label = _U('boss_actions'), value = 'boss_actions'}) - end + if Config.EnablePlayerManagement and PlayerData.job.grade_name == 'boss' then + table.insert(elements, {label = _U('boss_actions'), value = 'boss_actions'}) + end - ESX.UI.Menu.CloseAll() + ESX.UI.Menu.CloseAll() - ESX.UI.Menu.Open( - 'default', GetCurrentResourceName(), 'ambulance_actions', - { - title = _U('ambulance'), - elements = elements - }, - function(data, menu) + ESX.UI.Menu.Open( + 'default', GetCurrentResourceName(), 'ambulance_actions', + { + title = _U('ambulance'), + elements = elements + }, + function(data, menu) - if data.current.value == 'cloakroom' then - OpenCloakroomMenu() - end + if data.current.value == 'cloakroom' then + OpenCloakroomMenu() + end - if data.current.value == 'boss_actions' then - TriggerEvent('esx_society:openBossMenu', 'ambulance', function(data, menu) - menu.close() - end, {wash = false}) - end + if data.current.value == 'boss_actions' then + TriggerEvent('esx_society:openBossMenu', 'ambulance', function(data, menu) + menu.close() + end, {wash = false}) + end - end, - function(data, menu) + end, + function(data, menu) - menu.close() + menu.close() - CurrentAction = 'ambulance_actions_menu' - CurrentActionMsg = _U('open_menu') - CurrentActionData = {} + CurrentAction = 'ambulance_actions_menu' + CurrentActionMsg = _U('open_menu') + CurrentActionData = {} - end - ) + end + ) end function OpenMobileAmbulanceActionsMenu() - ESX.UI.Menu.CloseAll() + ESX.UI.Menu.CloseAll() - ESX.UI.Menu.Open( - 'default', GetCurrentResourceName(), 'mobile_ambulance_actions', - { - title = _U('ambulance'), - elements = { - {label = _U('ems_menu'), value = 'citizen_interaction'}, - } - }, - function(data, menu) + ESX.UI.Menu.Open( + 'default', GetCurrentResourceName(), 'mobile_ambulance_actions', + { + title = _U('ambulance'), + elements = { + {label = _U('ems_menu'), value = 'citizen_interaction'}, + } + }, + function(data, menu) - if data.current.value == 'citizen_interaction' then + if data.current.value == 'citizen_interaction' then - ESX.UI.Menu.Open( - 'default', GetCurrentResourceName(), 'citizen_interaction', - { - title = _U('ems_menu_title'), - elements = { - {label = _U('ems_menu_revive'), value = 'revive'}, - {label = _U('ems_menu_putincar'), value = 'put_in_vehicle'}, - } - }, - function(data, menu) + ESX.UI.Menu.Open( + 'default', GetCurrentResourceName(), 'citizen_interaction', + { + title = _U('ems_menu_title'), + elements = { + {label = _U('ems_menu_revive'), value = 'revive'}, + {label = _U('ems_menu_putincar'), value = 'put_in_vehicle'}, + } + }, + function(data, menu) - if data.current.value == 'revive' then + if data.current.value == 'revive' then - menu.close() + menu.close() - local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() + local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() - if closestPlayer == -1 or closestDistance > 3.0 then - ESX.ShowNotification(_U('no_players')) - else + if closestPlayer == -1 or closestDistance > 3.0 then + ESX.ShowNotification(_U('no_players')) + else - local ped = GetPlayerPed(closestPlayer) - local health = GetEntityHealth(ped) + local ped = GetPlayerPed(closestPlayer) + local health = GetEntityHealth(ped) - if health == 0 then + if health == 0 then - local playerPed = GetPlayerPed(-1) - local closestPlayerPed = GetPlayerPed(closestPlayer) + local playerPed = GetPlayerPed(-1) + local closestPlayerPed = GetPlayerPed(closestPlayer) - Citizen.CreateThread(function() + Citizen.CreateThread(function() - ESX.ShowNotification(_U('revive_inprogress')) + ESX.ShowNotification(_U('revive_inprogress')) - TaskStartScenarioInPlace(playerPed, 'CODE_HUMAN_MEDIC_TEND_TO_DEAD', 0, true) - Citizen.Wait(10000) - ClearPedTasks(playerPed) + TaskStartScenarioInPlace(playerPed, 'CODE_HUMAN_MEDIC_TEND_TO_DEAD', 0, true) + Citizen.Wait(10000) + ClearPedTasks(playerPed) - if GetEntityHealth(closestPlayerPed) == 0 then - TriggerServerEvent('esx_ambulancejob:revive', GetPlayerServerId(closestPlayer)) - ESX.ShowNotification(_U('revive_complete') .. GetPlayerName(closestPlayer)) - else - ESX.ShowNotification(GetPlayerName(closestPlayer) .. _U('isdead')) - end + if GetEntityHealth(closestPlayerPed) == 0 then + TriggerServerEvent('esx_ambulancejob:revive', GetPlayerServerId(closestPlayer)) + ESX.ShowNotification(_U('revive_complete') .. GetPlayerName(closestPlayer)) + else + ESX.ShowNotification(GetPlayerName(closestPlayer) .. _U('isdead')) + end - end) + end) - else - ESX.ShowNotification(GetPlayerName(closestPlayer) .. _U('unconscious')) - end + else + ESX.ShowNotification(GetPlayerName(closestPlayer) .. _U('unconscious')) + end - end + end - end + end - if data.current.value == 'put_in_vehicle' then - menu.close() - WarpPedInClosestVehicle(GetPlayerPed(closestPlayer)) - end + if data.current.value == 'put_in_vehicle' then + menu.close() + WarpPedInClosestVehicle(GetPlayerPed(closestPlayer)) + end - end, - function(data, menu) - menu.close() - end - ) + end, + function(data, menu) + menu.close() + end + ) - end + end - end, - function(data, menu) - menu.close() - end - ) + end, + function(data, menu) + menu.close() + end + ) end function OpenCloakroomMenu() - ESX.UI.Menu.Open( - 'default', GetCurrentResourceName(), 'cloakroom', - { - title = _U('cloakroom'), - align = 'top-left', - elements = { - {label = _U('ems_clothes_civil'), value = 'citizen_wear'}, - {label = _U('ems_clothes_ems'), value = 'ambulance_wear'}, - }, - }, - function(data, menu) + ESX.UI.Menu.Open( + 'default', GetCurrentResourceName(), 'cloakroom', + { + title = _U('cloakroom'), + align = 'top-left', + elements = { + {label = _U('ems_clothes_civil'), value = 'citizen_wear'}, + {label = _U('ems_clothes_ems'), value = 'ambulance_wear'}, + }, + }, + function(data, menu) - menu.close() + menu.close() - if data.current.value == 'citizen_wear' then + if data.current.value == 'citizen_wear' then - ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin) - TriggerEvent('skinchanger:loadSkin', skin) - end) + ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin) + TriggerEvent('skinchanger:loadSkin', skin) + end) - end + end - if data.current.value == 'ambulance_wear' then + if data.current.value == 'ambulance_wear' then - ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin) + ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin) - if skin.sex == 0 then - TriggerEvent('skinchanger:loadClothes', skin, jobSkin.skin_male) - else - TriggerEvent('skinchanger:loadClothes', skin, jobSkin.skin_female) - end + if skin.sex == 0 then + TriggerEvent('skinchanger:loadClothes', skin, jobSkin.skin_male) + else + TriggerEvent('skinchanger:loadClothes', skin, jobSkin.skin_female) + end - end) + end) - end + end - CurrentAction = 'ambulance_actions_menu' - CurrentActionMsg = _U('open_menu') - CurrentActionData = {} + CurrentAction = 'ambulance_actions_menu' + CurrentActionMsg = _U('open_menu') + CurrentActionData = {} - end, - function(data, menu) - menu.close() - end - ) + end, + function(data, menu) + menu.close() + end + ) end function OpenVehicleSpawnerMenu() - ESX.UI.Menu.CloseAll() + ESX.UI.Menu.CloseAll() - if Config.EnableSocietyOwnedVehicles then + if Config.EnableSocietyOwnedVehicles then - local elements = {} + local elements = {} - ESX.TriggerServerCallback('esx_society:getVehiclesInGarage', function(vehicles) + ESX.TriggerServerCallback('esx_society:getVehiclesInGarage', function(vehicles) - for i=1, #vehicles, 1 do - table.insert(elements, {label = GetDisplayNameFromVehicleModel(vehicles[i].model) .. ' [' .. vehicles[i].plate .. ']', value = vehicles[i]}) - end + for i=1, #vehicles, 1 do + table.insert(elements, {label = GetDisplayNameFromVehicleModel(vehicles[i].model) .. ' [' .. vehicles[i].plate .. ']', value = vehicles[i]}) + end - ESX.UI.Menu.Open( - 'default', GetCurrentResourceName(), 'vehicle_spawner', - { - title = _U('veh_menu'), - align = 'top-left', - elements = elements, - }, - function(data, menu) + ESX.UI.Menu.Open( + 'default', GetCurrentResourceName(), 'vehicle_spawner', + { + title = _U('veh_menu'), + align = 'top-left', + elements = elements, + }, + function(data, menu) - menu.close() + menu.close() - local vehicleProps = data.current.value + local vehicleProps = data.current.value - ESX.Game.SpawnVehicle(vehicleProps.model, Config.Zones.VehicleSpawnPoint.Pos, 270.0, function(vehicle) - ESX.Game.SetVehicleProperties(vehicle, vehicleProps) - local playerPed = GetPlayerPed(-1) - TaskWarpPedIntoVehicle(playerPed, vehicle, -1) - end) + ESX.Game.SpawnVehicle(vehicleProps.model, Config.Zones.VehicleSpawnPoint.Pos, 270.0, function(vehicle) + ESX.Game.SetVehicleProperties(vehicle, vehicleProps) + local playerPed = GetPlayerPed(-1) + TaskWarpPedIntoVehicle(playerPed, vehicle, -1) + end) - TriggerServerEvent('esx_society:removeVehicleFromGarage', 'ambulance', vehicleProps) + TriggerServerEvent('esx_society:removeVehicleFromGarage', 'ambulance', vehicleProps) - end, - function(data, menu) + end, + function(data, menu) - menu.close() + menu.close() - CurrentAction = 'vehicle_spawner_menu' - CurrentActionMsg = _U('veh_spawn') - CurrentActionData = {} + CurrentAction = 'vehicle_spawner_menu' + CurrentActionMsg = _U('veh_spawn') + CurrentActionData = {} - end - ) + end + ) - end, 'ambulance') + end, 'ambulance') - else + else - ESX.UI.Menu.Open( - 'default', GetCurrentResourceName(), 'vehicle_spawner', - { - title = _U('veh_menu'), - align = 'top-left', - elements = { - {label = _U('ambulance'), value = 'ambulance'}, - {label = _U('helicopter'), value = 'polmav'}, - }, - }, - function(data, menu) + ESX.UI.Menu.Open( + 'default', GetCurrentResourceName(), 'vehicle_spawner', + { + title = _U('veh_menu'), + align = 'top-left', + elements = { + {label = _U('ambulance'), value = 'ambulance'}, + {label = _U('helicopter'), value = 'polmav'}, + }, + }, + function(data, menu) - menu.close() + menu.close() - local model = data.current.value + local model = data.current.value - ESX.Game.SpawnVehicle(model, Config.Zones.VehicleSpawnPoint.Pos, 270.0, function(vehicle) + ESX.Game.SpawnVehicle(model, Config.Zones.VehicleSpawnPoint.Pos, 270.0, function(vehicle) - local playerPed = GetPlayerPed(-1) + local playerPed = GetPlayerPed(-1) - if model == 'polmav' then - SetVehicleModKit(vehicle, 0) - SetVehicleLivery(vehicle, 1) - end + if model == 'polmav' then + SetVehicleModKit(vehicle, 0) + SetVehicleLivery(vehicle, 1) + end - TaskWarpPedIntoVehicle(playerPed, vehicle, -1) + TaskWarpPedIntoVehicle(playerPed, vehicle, -1) - end) + end) - end, - function(data, menu) + end, + function(data, menu) - menu.close() + menu.close() - CurrentAction = 'vehicle_spawner_menu' - CurrentActionMsg = _U('veh_spawn') - CurrentActionData = {} + CurrentAction = 'vehicle_spawner_menu' + CurrentActionMsg = _U('veh_spawn') + CurrentActionData = {} - end - ) + end + ) - end + end end AddEventHandler('playerSpawned', function() - IsDead = false + IsDead = false - if FirstSpawn then - exports.spawnmanager:setAutoSpawn(false) - FirstSpawn = false - end + if FirstSpawn then + exports.spawnmanager:setAutoSpawn(false) + FirstSpawn = false + end end) RegisterNetEvent('esx:playerLoaded') AddEventHandler('esx:playerLoaded', function(xPlayer) - PlayerData = xPlayer + PlayerData = xPlayer - if PlayerData.job.name == 'ambulance' then + if PlayerData.job.name == 'ambulance' then - Config.Zones.AmbulanceActions.Type = 1 - Config.Zones.VehicleSpawner.Type = 1 - Config.Zones.VehicleDeleter.Type = 1 + Config.Zones.AmbulanceActions.Type = 1 + Config.Zones.VehicleSpawner.Type = 1 + Config.Zones.VehicleDeleter.Type = 1 - else + else - Config.Zones.AmbulanceActions.Type = -1 - Config.Zones.VehicleSpawner.Type = -1 - Config.Zones.VehicleDeleter.Type = -1 + Config.Zones.AmbulanceActions.Type = -1 + Config.Zones.VehicleSpawner.Type = -1 + Config.Zones.VehicleDeleter.Type = -1 - end + end end) RegisterNetEvent('esx:setJob') AddEventHandler('esx:setJob', function(job) - PlayerData.job = job + PlayerData.job = job - if PlayerData.job.name == 'ambulance' then + if PlayerData.job.name == 'ambulance' then - Config.Zones.AmbulanceActions.Type = 1 - Config.Zones.VehicleSpawner.Type = 1 - Config.Zones.VehicleDeleter.Type = 1 + Config.Zones.AmbulanceActions.Type = 1 + Config.Zones.VehicleSpawner.Type = 1 + Config.Zones.VehicleDeleter.Type = 1 - else + else - Config.Zones.AmbulanceActions.Type = -1 - Config.Zones.VehicleSpawner.Type = -1 - Config.Zones.VehicleDeleter.Type = -1 + Config.Zones.AmbulanceActions.Type = -1 + Config.Zones.VehicleSpawner.Type = -1 + Config.Zones.VehicleDeleter.Type = -1 - end + end end) RegisterNetEvent('esx_phone:loaded') AddEventHandler('esx_phone:loaded', function(phoneNumber, contacts) - local specialContact = { - name = 'Ambulance', - number = 'ambulance', - base64Icon = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEwAACxMBAJqcGAAABp5JREFUWIW1l21sFNcVhp/58npn195de23Ha4Mh2EASSvk0CPVHmmCEI0RCTQMBKVVooxYoalBVCVokICWFVFVEFeKoUdNECkZQIlAoFGMhIkrBQGxHwhAcChjbeLcsYHvNfsx+zNz+MBDWNrYhzSvdP+e+c973XM2cc0dihFi9Yo6vSzN/63dqcwPZcnEwS9PDmYoE4IxZIj+ciBb2mteLwlZdfji+dXtNU2AkeaXhCGteLZ/X/IS64/RoR5mh9tFVAaMiAldKQUGiRzFp1wXJPj/YkxblbfFLT/tjq9/f1XD0sQyse2li7pdP5tYeLXXMMGUojAiWKeOodE1gqpmNfN2PFeoF00T2uLGKfZzTwhzqbaEmeYWAQ0K1oKIlfPb7t+7M37aruXvEBlYvnV7xz2ec/2jNs9kKooKNjlksiXhJfLqf1PXOIU9M8fmw/XgRu523eTNyhhu6xLjbSeOFC6EX3t3V9PmwBla9Vv7K7u85d3bpqlwVcvHn7B8iVX+IFQoNKdwfstuFtWoFvwp9zj5XL7nRlPXyudjS9z+u35tmuH/lu6dl7+vSVXmDUcpbX+skP65BxOOPJA4gjDicOM2PciejeTwcsYek1hyl6me5nhNnmwPXBhjYuGC699OpzoaAO0PbYJSy5vgt4idOPrJwf6QuX2FO0oOtqIgj9pDU5dCWrMlyvXf86xsGgHyPeLos83Brns1WFXLxxgVBorHpW4vfQ6KhkbUtCot6srns1TLPjNVr7+1J0PepVc92H/Eagkb7IsTWd4ZMaN+yCXv5zLRY9GQ9xuYtQz4nfreWGdH9dNlkfnGq5/kdO88ekwGan1B3mDJsdMxCqv5w2Iq0khLs48vSllrsG/Y5pfojNugzScnQXKBVA8hrX51ddHq0o6wwIlgS8Y7obZdUZVjOYLC6e3glWkBBVHC2RJ+w/qezCuT/2sV6Q5VYpowjvnf/iBJJqvpYBgBS+w6wVB5DLEOiTZHWy36nNheg0jUBs3PoJnMfyuOdAECqrZ3K7KcACGQp89RAtlysCphqZhPtRzYlcPx+ExklJUiq0le5omCfOGFAYn3qFKS/fZAWS7a3Y2wa+GJOEy4US+B3aaPUYJamj4oI5LA/jWQBt5HIK5+JfXzZsJVpXi/ac8+mxWIXWzAG4Wb4g/jscNMp63I4U5FcKaVvsNyFALokSA47Kx8PVk83OabCHZsiqwAKEpjmfUJIkoh/R+L9oTpjluhRkGSPG4A7EkS+Y3HZk0OXYpIVNy01P5yItnptDsvtIwr0SunqoVP1GG1taTHn1CloXm9aLBEIEDl/IS2W6rg+qIFEYR7+OJTesqJqYa95/VKBNOHLjDBZ8sDS2998a0Bs/F//gvu5Z9NivadOc/U3676pEsizBIN1jCYlhClL+ELJDrkobNUBfBZqQfMN305HAgnIeYi4OnYMh7q/AsAXSdXK+eH41sykxd+TV/AsXvR/MeARAttD9pSqF9nDNfSEoDQsb5O31zQFprcaV244JPY7bqG6Xd9K3C3ALgbfk3NzqNE6CdplZrVFL27eWR+UASb6479ULfhD5AzOlSuGFTE6OohebElbcb8fhxA4xEPUgdTK19hiNKCZgknB+Ep44E44d82cxqPPOKctCGXzTmsBXbV1j1S5XQhyHq6NvnABPylu46A7QmVLpP7w9pNz4IEb0YyOrnmjb8bjB129fDBRkDVj2ojFbYBnCHHb7HL+OC7KQXeEsmAiNrnTqLy3d3+s/bvlVmxpgffM1fyM5cfsPZLuK+YHnvHELl8eUlwV4BXim0r6QV+4gD9Nlnjbfg1vJGktbI5UbN/TcGmAAYDG84Gry/MLLl/zKouO2Xukq/YkCyuWYV5owTIGjhVFCPL6J7kLOTcH89ereF1r4qOsm3gjSevl85El1Z98cfhB3qBN9+dLp1fUTco+0OrVMnNjFuv0chYbBYT2HcBoa+8TALyWQOt/ImPHoFS9SI3WyRajgdt2mbJgIlbREplfveuLf/XXemjXX7v46ZxzPlfd8YlZ01My5MUEVdIY5rueYopw4fQHkbv7/rZkTw6JwjyalBCHur9iD9cI2mU0UzD3P9H6yZ1G5dt7Gwe96w07dl5fXj7vYqH2XsNovdTI6KMrlsAXhRyz7/C7FBO/DubdVq4nBLPaohcnBeMr3/2k4fhQ+Uc8995YPq2wMzNjww2X+vwNt1p00ynrd2yKDJAVN628sBX1hZIdxXdStU9G5W2bd9YHR5L3f/CNmJeY9G8WAAAAAElFTkSuQmCC' - } + local specialContact = { + name = 'Ambulance', + number = 'ambulance', + base64Icon = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEwAACxMBAJqcGAAABp5JREFUWIW1l21sFNcVhp/58npn195de23Ha4Mh2EASSvk0CPVHmmCEI0RCTQMBKVVooxYoalBVCVokICWFVFVEFeKoUdNECkZQIlAoFGMhIkrBQGxHwhAcChjbeLcsYHvNfsx+zNz+MBDWNrYhzSvdP+e+c973XM2cc0dihFi9Yo6vSzN/63dqcwPZcnEwS9PDmYoE4IxZIj+ciBb2mteLwlZdfji+dXtNU2AkeaXhCGteLZ/X/IS64/RoR5mh9tFVAaMiAldKQUGiRzFp1wXJPj/YkxblbfFLT/tjq9/f1XD0sQyse2li7pdP5tYeLXXMMGUojAiWKeOodE1gqpmNfN2PFeoF00T2uLGKfZzTwhzqbaEmeYWAQ0K1oKIlfPb7t+7M37aruXvEBlYvnV7xz2ec/2jNs9kKooKNjlksiXhJfLqf1PXOIU9M8fmw/XgRu523eTNyhhu6xLjbSeOFC6EX3t3V9PmwBla9Vv7K7u85d3bpqlwVcvHn7B8iVX+IFQoNKdwfstuFtWoFvwp9zj5XL7nRlPXyudjS9z+u35tmuH/lu6dl7+vSVXmDUcpbX+skP65BxOOPJA4gjDicOM2PciejeTwcsYek1hyl6me5nhNnmwPXBhjYuGC699OpzoaAO0PbYJSy5vgt4idOPrJwf6QuX2FO0oOtqIgj9pDU5dCWrMlyvXf86xsGgHyPeLos83Brns1WFXLxxgVBorHpW4vfQ6KhkbUtCot6srns1TLPjNVr7+1J0PepVc92H/Eagkb7IsTWd4ZMaN+yCXv5zLRY9GQ9xuYtQz4nfreWGdH9dNlkfnGq5/kdO88ekwGan1B3mDJsdMxCqv5w2Iq0khLs48vSllrsG/Y5pfojNugzScnQXKBVA8hrX51ddHq0o6wwIlgS8Y7obZdUZVjOYLC6e3glWkBBVHC2RJ+w/qezCuT/2sV6Q5VYpowjvnf/iBJJqvpYBgBS+w6wVB5DLEOiTZHWy36nNheg0jUBs3PoJnMfyuOdAECqrZ3K7KcACGQp89RAtlysCphqZhPtRzYlcPx+ExklJUiq0le5omCfOGFAYn3qFKS/fZAWS7a3Y2wa+GJOEy4US+B3aaPUYJamj4oI5LA/jWQBt5HIK5+JfXzZsJVpXi/ac8+mxWIXWzAG4Wb4g/jscNMp63I4U5FcKaVvsNyFALokSA47Kx8PVk83OabCHZsiqwAKEpjmfUJIkoh/R+L9oTpjluhRkGSPG4A7EkS+Y3HZk0OXYpIVNy01P5yItnptDsvtIwr0SunqoVP1GG1taTHn1CloXm9aLBEIEDl/IS2W6rg+qIFEYR7+OJTesqJqYa95/VKBNOHLjDBZ8sDS2998a0Bs/F//gvu5Z9NivadOc/U3676pEsizBIN1jCYlhClL+ELJDrkobNUBfBZqQfMN305HAgnIeYi4OnYMh7q/AsAXSdXK+eH41sykxd+TV/AsXvR/MeARAttD9pSqF9nDNfSEoDQsb5O31zQFprcaV244JPY7bqG6Xd9K3C3ALgbfk3NzqNE6CdplZrVFL27eWR+UASb6479ULfhD5AzOlSuGFTE6OohebElbcb8fhxA4xEPUgdTK19hiNKCZgknB+Ep44E44d82cxqPPOKctCGXzTmsBXbV1j1S5XQhyHq6NvnABPylu46A7QmVLpP7w9pNz4IEb0YyOrnmjb8bjB129fDBRkDVj2ojFbYBnCHHb7HL+OC7KQXeEsmAiNrnTqLy3d3+s/bvlVmxpgffM1fyM5cfsPZLuK+YHnvHELl8eUlwV4BXim0r6QV+4gD9Nlnjbfg1vJGktbI5UbN/TcGmAAYDG84Gry/MLLl/zKouO2Xukq/YkCyuWYV5owTIGjhVFCPL6J7kLOTcH89ereF1r4qOsm3gjSevl85El1Z98cfhB3qBN9+dLp1fUTco+0OrVMnNjFuv0chYbBYT2HcBoa+8TALyWQOt/ImPHoFS9SI3WyRajgdt2mbJgIlbREplfveuLf/XXemjXX7v46ZxzPlfd8YlZ01My5MUEVdIY5rueYopw4fQHkbv7/rZkTw6JwjyalBCHur9iD9cI2mU0UzD3P9H6yZ1G5dt7Gwe96w07dl5fXj7vYqH2XsNovdTI6KMrlsAXhRyz7/C7FBO/DubdVq4nBLPaohcnBeMr3/2k4fhQ+Uc8995YPq2wMzNjww2X+vwNt1p00ynrd2yKDJAVN628sBX1hZIdxXdStU9G5W2bd9YHR5L3f/CNmJeY9G8WAAAAAElFTkSuQmCC' + } - TriggerEvent('esx_phone:addSpecialContact', specialContact.name, specialContact.number, specialContact.base64Icon) + TriggerEvent('esx_phone:addSpecialContact', specialContact.name, specialContact.number, specialContact.base64Icon) end) AddEventHandler('baseevents:onPlayerDied', function(killerType, coords) - TriggerEvent('esx_ambulancejob:onPlayerDeath') + TriggerEvent('esx_ambulancejob:onPlayerDeath') end) AddEventHandler('baseevents:onPlayerKilled', function(killerId, data) - TriggerEvent('esx_ambulancejob:onPlayerDeath') + TriggerEvent('esx_ambulancejob:onPlayerDeath') end) AddEventHandler('esx_ambulancejob:onPlayerDeath', function() - IsDead = true + IsDead = true - if Config.ShowDeathTimer == true then - RespawnTimer() - else - StartRespawnTimer() - StartRespawnToHospitalMenuTimer() - end + if Config.ShowDeathTimer == true then + RespawnTimer() + else + StartRespawnTimer() + StartRespawnToHospitalMenuTimer() + end - StartScreenEffect('DeathFailOut', 0, false) + StartScreenEffect('DeathFailOut', 0, false) end) RegisterNetEvent('esx_ambulancejob:revive') AddEventHandler('esx_ambulancejob:revive', function() - local playerPed = GetPlayerPed(-1) - local coords = GetEntityCoords(playerPed) + local playerPed = GetPlayerPed(-1) + local coords = GetEntityCoords(playerPed) - Citizen.CreateThread(function() + Citizen.CreateThread(function() - DoScreenFadeOut(800) + DoScreenFadeOut(800) - while not IsScreenFadedOut() do - Citizen.Wait(0) - end + while not IsScreenFadedOut() do + Citizen.Wait(0) + end - ESX.SetPlayerData('lastPosition', { - x = coords.x, - y = coords.y, - z = coords.z - }) + ESX.SetPlayerData('lastPosition', { + x = coords.x, + y = coords.y, + z = coords.z + }) - TriggerServerEvent('esx:updateLastPosition', { - x = coords.x, - y = coords.y, - z = coords.z - }) + TriggerServerEvent('esx:updateLastPosition', { + x = coords.x, + y = coords.y, + z = coords.z + }) - RespawnPed(playerPed, { - x = coords.x, - y = coords.y, - z = coords.z - }) + RespawnPed(playerPed, { + x = coords.x, + y = coords.y, + z = coords.z + }) - StopScreenEffect('DeathFailOut') + StopScreenEffect('DeathFailOut') - DoScreenFadeIn(800) + DoScreenFadeIn(800) - end) + end) end) AddEventHandler('esx_ambulancejob:hasEnteredMarker', function(zone) - if zone == 'HospitalInteriorEntering1' then - TeleportFadeEffect(GetPlayerPed(-1), Config.Zones.HospitalInteriorInside1.Pos) - end + if zone == 'HospitalInteriorEntering1' then + TeleportFadeEffect(GetPlayerPed(-1), Config.Zones.HospitalInteriorInside1.Pos) + end - if zone == 'HospitalInteriorExit1' then - TeleportFadeEffect(GetPlayerPed(-1), Config.Zones.HospitalInteriorOutside1.Pos) - end + if zone == 'HospitalInteriorExit1' then + TeleportFadeEffect(GetPlayerPed(-1), Config.Zones.HospitalInteriorOutside1.Pos) + end - if zone == 'HospitalInteriorEntering2' then - TeleportFadeEffect(GetPlayerPed(-1), Config.Zones.HospitalInteriorInside2.Pos) - end + if zone == 'HospitalInteriorEntering2' then + TeleportFadeEffect(GetPlayerPed(-1), Config.Zones.HospitalInteriorInside2.Pos) + end - if zone == 'HospitalInteriorExit2' then - TeleportFadeEffect(GetPlayerPed(-1), Config.Zones.HospitalInteriorOutside2.Pos) - end + if zone == 'HospitalInteriorExit2' then + TeleportFadeEffect(GetPlayerPed(-1), Config.Zones.HospitalInteriorOutside2.Pos) + end - if zone == 'AmbulanceActions' and PlayerData.job ~= nil and PlayerData.job.name == 'ambulance' then - CurrentAction = 'ambulance_actions_menu' - CurrentActionMsg = _U('open_menu') - CurrentActionData = {} - end + if zone == 'AmbulanceActions' and PlayerData.job ~= nil and PlayerData.job.name == 'ambulance' then + CurrentAction = 'ambulance_actions_menu' + CurrentActionMsg = _U('open_menu') + CurrentActionData = {} + end - if zone == 'VehicleSpawner' and PlayerData.job ~= nil and PlayerData.job.name == 'ambulance' then - CurrentAction = 'vehicle_spawner_menu' - CurrentActionMsg = _U('veh_spawn') - CurrentActionData = {} - end + if zone == 'VehicleSpawner' and PlayerData.job ~= nil and PlayerData.job.name == 'ambulance' then + CurrentAction = 'vehicle_spawner_menu' + CurrentActionMsg = _U('veh_spawn') + CurrentActionData = {} + end - if zone == 'VehicleDeleter' and PlayerData.job ~= nil and PlayerData.job.name == 'ambulance' then + if zone == 'VehicleDeleter' and PlayerData.job ~= nil and PlayerData.job.name == 'ambulance' then - local playerPed = GetPlayerPed(-1) - local coords = GetEntityCoords(playerPed) + local playerPed = GetPlayerPed(-1) + local coords = GetEntityCoords(playerPed) - if IsPedInAnyVehicle(playerPed, false) then + if IsPedInAnyVehicle(playerPed, false) then - local vehicle, distance = ESX.Game.GetClosestVehicle({ - x = coords.x, - y = coords.y, - z = coords.z - }) + local vehicle, distance = ESX.Game.GetClosestVehicle({ + x = coords.x, + y = coords.y, + z = coords.z + }) - if distance ~= -1 and distance <= 1.0 then + if distance ~= -1 and distance <= 1.0 then - CurrentAction = 'delete_vehicle' - CurrentActionMsg = _U('store_veh') - CurrentActionData = {vehicle = vehicle} + CurrentAction = 'delete_vehicle' + CurrentActionMsg = _U('store_veh') + CurrentActionData = {vehicle = vehicle} - end + end - end + end - end + end end) AddEventHandler('esx_ambulancejob:hasExitedMarker', function(zone) - ESX.UI.Menu.CloseAll() - CurrentAction = nil + ESX.UI.Menu.CloseAll() + CurrentAction = nil end) -- Create blips @@ -776,98 +777,98 @@ end) -- Display markers Citizen.CreateThread(function() - while true do + while true do - Wait(0) + Wait(0) - local coords = GetEntityCoords(GetPlayerPed(-1)) + local coords = GetEntityCoords(GetPlayerPed(-1)) - for k,v in pairs(Config.Zones) do + for k,v in pairs(Config.Zones) do - if(v.Type ~= -1 and GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < Config.DrawDistance) then - DrawMarker(v.Type, v.Pos.x, v.Pos.y, v.Pos.z, 0.0, 0.0, 0.0, 0, 0.0, 0.0, v.Size.x, v.Size.y, v.Size.z, Config.MarkerColor.r, Config.MarkerColor.g, Config.MarkerColor.b, 100, false, true, 2, false, false, false, false) - end - end + if(v.Type ~= -1 and GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < Config.DrawDistance) then + DrawMarker(v.Type, v.Pos.x, v.Pos.y, v.Pos.z, 0.0, 0.0, 0.0, 0, 0.0, 0.0, v.Size.x, v.Size.y, v.Size.z, Config.MarkerColor.r, Config.MarkerColor.g, Config.MarkerColor.b, 100, false, true, 2, false, false, false, false) + end + end - end + end end) -- Activate menu when player is inside marker Citizen.CreateThread(function() - while true do + while true do - Wait(0) + Wait(0) - local coords = GetEntityCoords(GetPlayerPed(-1)) - local isInMarker = false - local currentZone = nil + local coords = GetEntityCoords(GetPlayerPed(-1)) + local isInMarker = false + local currentZone = nil - for k,v in pairs(Config.Zones) do - if(GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < v.Size.x) then - isInMarker = true - currentZone = k - end - end + for k,v in pairs(Config.Zones) do + if(GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < v.Size.x) then + isInMarker = true + currentZone = k + end + end - if isInMarker and not hasAlreadyEnteredMarker then - hasAlreadyEnteredMarker = true - lastZone = currentZone - TriggerEvent('esx_ambulancejob:hasEnteredMarker', currentZone) - end + if isInMarker and not hasAlreadyEnteredMarker then + hasAlreadyEnteredMarker = true + lastZone = currentZone + TriggerEvent('esx_ambulancejob:hasEnteredMarker', currentZone) + end - if not isInMarker and hasAlreadyEnteredMarker then - hasAlreadyEnteredMarker = false - TriggerEvent('esx_ambulancejob:hasExitedMarker', lastZone) - end + if not isInMarker and hasAlreadyEnteredMarker then + hasAlreadyEnteredMarker = false + TriggerEvent('esx_ambulancejob:hasExitedMarker', lastZone) + end - end + end end) -- Key Controls Citizen.CreateThread(function() - while true do + while true do - Citizen.Wait(0) + Citizen.Wait(0) - if CurrentAction ~= nil then + if CurrentAction ~= nil then - SetTextComponentFormat('STRING') - AddTextComponentString(CurrentActionMsg) - DisplayHelpTextFromStringLabel(0, 0, 1, -1) + SetTextComponentFormat('STRING') + AddTextComponentString(CurrentActionMsg) + DisplayHelpTextFromStringLabel(0, 0, 1, -1) - if IsControlPressed(0, Keys['E']) and PlayerData.job ~= nil and PlayerData.job.name == 'ambulance' and (GetGameTimer() - GUI.Time) > 150 then + if IsControlPressed(0, Keys['E']) and PlayerData.job ~= nil and PlayerData.job.name == 'ambulance' and (GetGameTimer() - GUI.Time) > 150 then - if CurrentAction == 'ambulance_actions_menu' then - OpenAmbulanceActionsMenu() - end + if CurrentAction == 'ambulance_actions_menu' then + OpenAmbulanceActionsMenu() + end - if CurrentAction == 'vehicle_spawner_menu' then - OpenVehicleSpawnerMenu() - end + if CurrentAction == 'vehicle_spawner_menu' then + OpenVehicleSpawnerMenu() + end - if CurrentAction == 'delete_vehicle' then + if CurrentAction == 'delete_vehicle' then - if Config.EnableSocietyOwnedVehicles then - local vehicleProps = ESX.Game.GetVehicleProperties(CurrentActionData.vehicle) - TriggerServerEvent('esx_society:putVehicleInGarage', 'ambulance', vehicleProps) - end + if Config.EnableSocietyOwnedVehicles then + local vehicleProps = ESX.Game.GetVehicleProperties(CurrentActionData.vehicle) + TriggerServerEvent('esx_society:putVehicleInGarage', 'ambulance', vehicleProps) + end - ESX.Game.DeleteVehicle(CurrentActionData.vehicle) - end + ESX.Game.DeleteVehicle(CurrentActionData.vehicle) + end - CurrentAction = nil - GUI.Time = GetGameTimer() + CurrentAction = nil + GUI.Time = GetGameTimer() - end + end - end + end - if IsControlPressed(0, Keys['F6']) and PlayerData.job ~= nil and PlayerData.job.name == 'ambulance' and (GetGameTimer() - GUI.Time) > 150 then - OpenMobileAmbulanceActionsMenu() - GUI.Time = GetGameTimer() - end + if IsControlPressed(0, Keys['F6']) and PlayerData.job ~= nil and PlayerData.job.name == 'ambulance' and (GetGameTimer() - GUI.Time) > 150 then + OpenMobileAmbulanceActionsMenu() + GUI.Time = GetGameTimer() + end - end + end end) -- Load unloaded IPLs From ad738c25dea03fa9713661f5266ff3f8ca6fbb41 Mon Sep 17 00:00:00 2001 From: Romain Lanz Date: Wed, 20 Sep 2017 21:50:55 +0200 Subject: [PATCH 052/177] fix(config): remove comma --- config.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.lua b/config.lua index fd045016..3eb05a25 100644 --- a/config.lua +++ b/config.lua @@ -20,7 +20,7 @@ Config.Blip = { Display = 4, Scale = 1.2, Colour = 2, -}, +} Config.Zones = { From 351e1e139cc04d0f0837e9df20ca606d5f7ca827 Mon Sep 17 00:00:00 2001 From: Romain Lanz Date: Wed, 20 Sep 2017 21:52:43 +0200 Subject: [PATCH 053/177] chore: bump version --- __resource.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/__resource.lua b/__resource.lua index 27bdd64c..cf3a37ab 100644 --- a/__resource.lua +++ b/__resource.lua @@ -2,7 +2,7 @@ resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937' description 'ESX Ambulance Job' -version '1.0.1' +version '1.0.2' server_scripts { '@mysql-async/lib/MySQL.lua', From 94287157842f1d93e742cd58bda5670441ae909b Mon Sep 17 00:00:00 2001 From: Romain Lanz Date: Wed, 20 Sep 2017 22:17:57 +0200 Subject: [PATCH 054/177] fix(pos): correct position of blip & outside marker --- __resource.lua | 2 +- config.lua | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/__resource.lua b/__resource.lua index cf3a37ab..85294488 100644 --- a/__resource.lua +++ b/__resource.lua @@ -2,7 +2,7 @@ resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937' description 'ESX Ambulance Job' -version '1.0.2' +version '1.0.3' server_scripts { '@mysql-async/lib/MySQL.lua', diff --git a/config.lua b/config.lua index 3eb05a25..47124b45 100644 --- a/config.lua +++ b/config.lua @@ -15,7 +15,7 @@ Config.EarlyRespawnFineAmount = 500 Config.Locale = 'fr' Config.Blip = { - Pos = { x = 1153.364, y = -979.558, z = 30.711 }, + Pos = { x = 1153.364, y = -1525.731, z = 33.843 }, Sprite = 61, Display = 4, Scale = 1.2, @@ -25,7 +25,7 @@ Config.Blip = { Config.Zones = { HospitalInteriorEntering1 = { - Pos = { x = 1151.447, y = -1525.731, z = 33.843 }, + Pos = { x = 1151.447, y = -1529.491, z = 34.375 }, Size = { x = 1.5, y = 1.5, z = 1.0 }, Type = 1 }, From 384b8c72a11ab8bf204d4a0d8958f34bc491057f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20N=27gadi?= Date: Sat, 23 Sep 2017 10:06:39 +0200 Subject: [PATCH 055/177] fix(server): Don't set money to 0 before respawn if amount is negative --- server/main.lua | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/server/main.lua b/server/main.lua index 70b9e57d..1085e4a2 100644 --- a/server/main.lua +++ b/server/main.lua @@ -15,8 +15,15 @@ ESX.RegisterServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function( local xPlayer = ESX.GetPlayerFromId(source) if Config.RemoveCashAfterRPDeath then - xPlayer.removeMoney(xPlayer.getMoney()) - xPlayer.setAccountMoney('black_money', 0) + + if xPlayer.getMoney() > 0 then + xPlayer.removeMoney(xPlayer.getMoney()) + end + + if xPlayer.getAccount('black_money').money > 0 then + xPlayer.setAccountMoney('black_money', 0) + end + end if Config.RemoveItemsAfterRPDeath then @@ -42,8 +49,15 @@ ESX.RegisterServerCallback('esx_ambulancejob:removeItemsAfterRPDeathRemoveMoney' local xPlayer = ESX.GetPlayerFromId(source) if Config.RemoveCashAfterRPDeath then - xPlayer.removeMoney(xPlayer.getMoney()) - xPlayer.setAccountMoney('black_money', 0) + + if xPlayer.getMoney() > 0 then + xPlayer.removeMoney(xPlayer.getMoney()) + end + + if xPlayer.getAccount('black_money').money > 0 then + xPlayer.setAccountMoney('black_money', 0) + end + end if Config.EarlyRespawn and Config.EarlyRespawnFine then From cb61181ade80657abd53388aa335062fa6b5f7dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20N=27gadi?= Date: Sat, 23 Sep 2017 10:09:04 +0200 Subject: [PATCH 056/177] fix(client): Correctly remove weapons when dead --- client/main.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/client/main.lua b/client/main.lua index c99bb2bc..99eea09a 100644 --- a/client/main.lua +++ b/client/main.lua @@ -76,6 +76,8 @@ function StartRespawnToHospitalMenuTimer() ESX.TriggerServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function() ESX.SetPlayerData('lastPosition', Config.Zones.HospitalInteriorInside1.Pos) + ESX.SetPlayerData('loadout', {}) + TriggerServerEvent('esx:updateLastPosition', Config.Zones.HospitalInteriorInside1.Pos) RespawnPed(GetPlayerPed(-1), Config.Zones.HospitalInteriorInside1.Pos) @@ -115,6 +117,8 @@ function StartRespawnTimer() ESX.TriggerServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function() ESX.SetPlayerData('lastPosition', Config.Zones.HospitalInteriorInside1.Pos) + ESX.SetPlayerData('loadout', {}) + TriggerServerEvent('esx:updateLastPosition', Config.Zones.HospitalInteriorInside1.Pos) RespawnPed(GetPlayerPed(-1), Config.Zones.HospitalInteriorInside1.Pos) @@ -174,10 +178,14 @@ function RespawnTimer() ESX.TriggerServerCallback('esx_ambulancejob:removeItemsAfterRPDeathRemoveMoney', function() TriggerServerEvent('esx_ambulancejob:removeAccountMoney', source) + ESX.SetPlayerData('lastPosition', Config.Zones.HospitalInteriorInside1.Pos) + ESX.SetPlayerData('loadout', {}) + TriggerServerEvent('esx:updateLastPosition', Config.Zones.HospitalInteriorInside1.Pos) RespawnPed(GetPlayerPed(-1), Config.Zones.HospitalInteriorInside1.Pos) + StopScreenEffect('DeathFailOut') DoScreenFadeIn(800) end) @@ -224,6 +232,8 @@ function RespawnTimer() ESX.TriggerServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function() ESX.SetPlayerData('lastPosition', Config.Zones.HospitalInteriorInside1.Pos) + ESX.SetPlayerData('loadout', {}) + TriggerServerEvent('esx:updateLastPosition', Config.Zones.HospitalInteriorInside1.Pos) RespawnPed(GetPlayerPed(-1), Config.Zones.HospitalInteriorInside1.Pos) From df5dc4dfdfcdf6fbc652cb4ab976d773250ef8c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20N=27gadi?= Date: Sat, 23 Sep 2017 11:39:16 +0200 Subject: [PATCH 057/177] chore(version): Increment version --- __resource.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/__resource.lua b/__resource.lua index 85294488..e3d75405 100644 --- a/__resource.lua +++ b/__resource.lua @@ -2,7 +2,7 @@ resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937' description 'ESX Ambulance Job' -version '1.0.3' +version '1.0.4' server_scripts { '@mysql-async/lib/MySQL.lua', From b29f12c77e801cdda27eec32e91d0e081835f79f Mon Sep 17 00:00:00 2001 From: renaiku Date: Tue, 17 Oct 2017 20:53:47 +0200 Subject: [PATCH 058/177] Big revamp of the script. Should be bugless. --- __resource.lua | 2 +- client/main.lua | 598 ++++++++++++++++++++++--------------------- esx_ambulancejob.sql | 5 + locales/fr.lua | 24 +- server/main.lua | 99 +++---- 5 files changed, 388 insertions(+), 340 deletions(-) diff --git a/__resource.lua b/__resource.lua index e3d75405..b9f69210 100644 --- a/__resource.lua +++ b/__resource.lua @@ -2,7 +2,7 @@ resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937' description 'ESX Ambulance Job' -version '1.0.4' +version '1.0.5' server_scripts { '@mysql-async/lib/MySQL.lua', diff --git a/client/main.lua b/client/main.lua index 99eea09a..4ad24d7f 100644 --- a/client/main.lua +++ b/client/main.lua @@ -44,16 +44,26 @@ function RespawnPed(ped, coords) ESX.UI.Menu.CloseAll() end +RegisterNetEvent('esx_ambulancejob:heal') +AddEventHandler('esx_ambulancejob:heal', function(_type) + local playerPed = GetPlayerPed(-1) + local maxHealth = GetEntityMaxHealth(playerPed) + if _type == 'small' then + local health = GetEntityHealth(playerPed) + local newHealth = math.min(maxHealth , math.floor(health + maxHealth/8)) + SetEntityHealth(playerPed, newHealth) + elseif _type == 'big' then + SetEntityHealth(playerPed, maxHealth) + end + ESX.ShowNotification(_U('healed')) +end) + + function StartRespawnToHospitalMenuTimer() - ESX.SetTimeout(Config.MenuRespawnToHospitalDelay, function() - if IsDead then - local elements = {} - table.insert(elements, {label = _U('yes'), value = 'yes'}) - RespawnToHospitalMenu = ESX.UI.Menu.Open( 'default', GetCurrentResourceName(), 'menuName', { @@ -61,175 +71,112 @@ function StartRespawnToHospitalMenuTimer() align = 'top-left', elements = elements }, - function(data, menu) --Submit Cb - - menu.close() - - Citizen.CreateThread(function() - - DoScreenFadeOut(800) - - while not IsScreenFadedOut() do - Citizen.Wait(0) - end - - ESX.TriggerServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function() - - ESX.SetPlayerData('lastPosition', Config.Zones.HospitalInteriorInside1.Pos) - ESX.SetPlayerData('loadout', {}) - - TriggerServerEvent('esx:updateLastPosition', Config.Zones.HospitalInteriorInside1.Pos) - - RespawnPed(GetPlayerPed(-1), Config.Zones.HospitalInteriorInside1.Pos) - StopScreenEffect('DeathFailOut') - DoScreenFadeIn(800) - end) - end) - end, - function(data, menu) --Cancel Cb - --menu.close() - end, - function(data, menu) --Change Cb - --print(data.current.value) - end, - function(data, menu) --Close Cb - RespawnToHospitalMenu = nil - end + function(data, menu) --Submit Cb + menu.close() + Citizen.CreateThread(function() + RemoveItemsAfterRPDeath() + end) + end, + function(data, menu) --Cancel Cb + --menu.close() + end, + function(data, menu) --Change Cb + --print(data.current.value) + end, + function(data, menu) --Close Cb + RespawnToHospitalMenu = nil + end ) end end) end function StartRespawnTimer() - ESX.SetTimeout(Config.RespawnDelayAfterRPDeath, function() - if IsDead then - - Citizen.CreateThread(function() - - DoScreenFadeOut(800) - - while not IsScreenFadedOut() do - Citizen.Wait(0) - end - - ESX.TriggerServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function() - - ESX.SetPlayerData('lastPosition', Config.Zones.HospitalInteriorInside1.Pos) - ESX.SetPlayerData('loadout', {}) - - TriggerServerEvent('esx:updateLastPosition', Config.Zones.HospitalInteriorInside1.Pos) - - RespawnPed(GetPlayerPed(-1), Config.Zones.HospitalInteriorInside1.Pos) - StopScreenEffect('DeathFailOut') - DoScreenFadeIn(800) - end) - end) + RemoveItemsAfterRPDeath() end end) end -function RespawnTimer() - +function ShowTimer() local timer = Config.RespawnDelayAfterRPDeath - local allowRespawn = Config.RespawnDelayAfterRPDeath/2 - local enoughMoney = false - local money = 0 + Citizen.CreateThread(function() - if IsDead and Config.ShowDeathTimer then - ESX.TriggerServerCallback('esx_ambulancejob:getBankMoney', function(money) - if money >= Config.EarlyRespawnFineAmount then - enoughMoney = true - else - enoughMoney = false - end - end) - Citizen.CreateThread(function() + while timer > 0 and IsDead do + Wait(0) - while timer > 0 and IsDead do - raw_seconds = timer/1000 - raw_minutes = raw_seconds/60 - minutes = stringsplit(raw_minutes, ".")[1] - seconds = stringsplit(raw_seconds-(minutes*60), ".")[1] + raw_seconds = timer/1000 + raw_minutes = raw_seconds/60 + minutes = stringsplit(raw_minutes, ".")[1] + seconds = stringsplit(raw_seconds-(minutes*60), ".")[1] - if Config.EarlyRespawn and Config.EarlyRespawnFine and enoughMoney then - SetTextFont(4) - SetTextProportional(0) - SetTextScale(0.0, 0.5) - SetTextColour(255, 255, 255, 255) - SetTextDropshadow(0, 0, 0, 0, 255) - SetTextEdge(1, 0, 0, 0, 255) - SetTextDropShadow() - SetTextOutline() - SetTextEntry("STRING") - AddTextComponentString(_U('please_wait') .. minutes .. _U('minutes') .. seconds .. _U('seconds_fine') .. Config.EarlyRespawnFineAmount .. _U('press_respawn_fine')) - SetTextCentre(true) - DrawText(0.5, 0.8) - timer = timer - 15 - Citizen.Wait(0) - if IsControlPressed(0, Keys['E']) then - DoScreenFadeOut(800) + SetTextFont(4) + SetTextProportional(0) + SetTextScale(0.0, 0.5) + SetTextColour(255, 255, 255, 255) + SetTextDropshadow(0, 0, 0, 0, 255) + SetTextEdge(1, 0, 0, 0, 255) - while not IsScreenFadedOut() do - Citizen.Wait(0) + SetTextDropShadow() + SetTextOutline() + SetTextEntry("STRING") + + local text = _U('please_wait') .. minutes .. _U('minutes') .. seconds .. _U('seconds') + + if Config.EarlyRespawn then + text = text .. '\n[~b~E~w~]' end - ESX.TriggerServerCallback('esx_ambulancejob:removeItemsAfterRPDeathRemoveMoney', function() + AddTextComponentString(text) + SetTextCentre(true) + DrawText(0.5, 0.8) - TriggerServerEvent('esx_ambulancejob:removeAccountMoney', source) - - ESX.SetPlayerData('lastPosition', Config.Zones.HospitalInteriorInside1.Pos) - ESX.SetPlayerData('loadout', {}) - - TriggerServerEvent('esx:updateLastPosition', Config.Zones.HospitalInteriorInside1.Pos) - - RespawnPed(GetPlayerPed(-1), Config.Zones.HospitalInteriorInside1.Pos) - - StopScreenEffect('DeathFailOut') - DoScreenFadeIn(800) - end) - end - else - SetTextFont(4) - SetTextProportional(0) - SetTextScale(0.0, 0.5) - SetTextColour(255, 255, 255, 255) - SetTextDropshadow(0, 0, 0, 0, 255) - SetTextEdge(1, 0, 0, 0, 255) - SetTextDropShadow() - SetTextOutline() - SetTextEntry("STRING") - AddTextComponentString(_U('please_wait') .. minutes .. _U('minutes') .. seconds .. _U('seconds')) - SetTextCentre(true) - DrawText(0.5, 0.8) - timer = timer - 15 - Citizen.Wait(0) + if Config.EarlyRespawn then + if IsControlPressed(0, Keys['E']) then + RemoveItemsAfterRPDeath() + break end end + timer = timer - 15 + end - while timer <= 0 and IsDead do - SetTextFont(4) - SetTextProportional(0) - SetTextScale(0.0, 0.5) - SetTextColour(255, 255, 255, 255) - SetTextDropshadow(0, 0, 0, 0, 255) - SetTextEdge(1, 0, 0, 0, 255) - SetTextDropShadow() - SetTextOutline() - SetTextEntry("STRING") - AddTextComponentString(_U('press_respawn')) - SetTextCentre(true) - DrawText(0.5, 0.8) - Citizen.Wait(0) - if IsControlPressed(0, Keys['E']) then - DoScreenFadeOut(800) + if Config.EarlyRespawn then + while timer <= 0 and IsDead do + Wait(0) - while not IsScreenFadedOut() do - Citizen.Wait(0) + SetTextFont(4) + SetTextProportional(0) + SetTextScale(0.0, 0.5) + SetTextColour(255, 255, 255, 255) + SetTextDropshadow(0, 0, 0, 0, 255) + SetTextEdge(1, 0, 0, 0, 255) + + SetTextDropShadow() + SetTextOutline() + SetTextEntry("STRING") + + AddTextComponentString(_U('press_respawn')) + SetTextCentre(true) + DrawText(0.5, 0.8) + + if IsControlPressed(0, Keys['E']) then + RemoveItemsAfterRPDeath() + break end + end + end - ESX.TriggerServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function() + end) +end + +function RemoveItemsAfterRPDeath() + Citizen.CreateThread(function() + DoScreenFadeOut(800) + while not IsScreenFadedOut() do + Citizen.Wait(0) + end + ESX.TriggerServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function() ESX.SetPlayerData('lastPosition', Config.Zones.HospitalInteriorInside1.Pos) ESX.SetPlayerData('loadout', {}) @@ -237,13 +184,23 @@ function RespawnTimer() TriggerServerEvent('esx:updateLastPosition', Config.Zones.HospitalInteriorInside1.Pos) RespawnPed(GetPlayerPed(-1), Config.Zones.HospitalInteriorInside1.Pos) + StopScreenEffect('DeathFailOut') DoScreenFadeIn(800) - end) - end - end + end) end) - end +end + +function OnPlayerDeath() + IsDead = true + if Config.ShowDeathTimer == true then + ShowTimer() + end + StartRespawnTimer() + if Config.RespawnToHospitalMenuTimer == true then + StartRespawnToHospitalMenuTimer() + end + StartScreenEffect('DeathFailOut', 0, false) end function TeleportFadeEffect(entity, coords) @@ -280,14 +237,14 @@ function WarpPedInClosestVehicle(ped) local freeSeat = nil for i=maxSeats - 1, 0, -1 do - if IsVehicleSeatFree(vehicle, i) then + if IsVehicleSeatFree(vehicle, i) then freeSeat = i break end end if freeSeat ~= nil then - TaskWarpPedIntoVehicle(ped, vehicle, freeSeat) + TaskWarpPedIntoVehicle(ped, vehicle, freeSeat) end else @@ -361,55 +318,99 @@ function OpenMobileAmbulanceActionsMenu() { title = _U('ems_menu_title'), elements = { - {label = _U('ems_menu_revive'), value = 'revive'}, - {label = _U('ems_menu_putincar'), value = 'put_in_vehicle'}, + {label = _U('ems_menu_revive'), value = 'revive'}, + {label = _U('ems_menu_small'), value = 'small'}, + {label = _U('ems_menu_big'), value = 'big'}, + {label = _U('ems_menu_putincar'), value = 'put_in_vehicle'}, } }, function(data, menu) if data.current.value == 'revive' then - menu.close() - local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() - if closestPlayer == -1 or closestDistance > 3.0 then ESX.ShowNotification(_U('no_players')) else - - local ped = GetPlayerPed(closestPlayer) - local health = GetEntityHealth(ped) - - if health == 0 then - - local playerPed = GetPlayerPed(-1) - local closestPlayerPed = GetPlayerPed(closestPlayer) - - Citizen.CreateThread(function() - - ESX.ShowNotification(_U('revive_inprogress')) - - TaskStartScenarioInPlace(playerPed, 'CODE_HUMAN_MEDIC_TEND_TO_DEAD', 0, true) - Citizen.Wait(10000) - ClearPedTasks(playerPed) - - if GetEntityHealth(closestPlayerPed) == 0 then - TriggerServerEvent('esx_ambulancejob:revive', GetPlayerServerId(closestPlayer)) - ESX.ShowNotification(_U('revive_complete') .. GetPlayerName(closestPlayer)) - else - ESX.ShowNotification(GetPlayerName(closestPlayer) .. _U('isdead')) - end - - end) - - else - ESX.ShowNotification(GetPlayerName(closestPlayer) .. _U('unconscious')) - end - + ESX.TriggerServerCallback('esx_ambulancejob:getItemAmount', function(qtty) + if qtty > 0 then + local closestPlayerPed = GetPlayerPed(closestPlayer) + local health = GetEntityHealth(closestPlayerPed) + if health == 0 then + local playerPed = GetPlayerPed(-1) + Citizen.CreateThread(function() + ESX.ShowNotification(_U('revive_inprogress')) + TaskStartScenarioInPlace(playerPed, 'CODE_HUMAN_MEDIC_TEND_TO_DEAD', 0, true) + Wait(10000) + ClearPedTasks(playerPed) + if GetEntityHealth(closestPlayerPed) == 0 then + TriggerServerEvent('esx_ambulancejob:removeItem', 'medikit') + TriggerServerEvent('esx_ambulancejob:revive', GetPlayerServerId(closestPlayer)) + ESX.ShowNotification(_U('revive_complete')) + else + ESX.ShowNotification(_U('isdead')) + end + end) + else + ESX.ShowNotification(_U('unconscious')) + end + else + ESX.ShowNotification(_U('not_enough_medikit')) + end + end, 'medikit') end - end + if data.current.value == 'small' then + menu.close() + local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() + if closestPlayer == -1 or closestDistance > 3.0 then + ESX.ShowNotification(_U('no_players')) + else + ESX.TriggerServerCallback('esx_ambulancejob:getItemAmount', function(qtty) + if qtty > 0 then + local playerPed = GetPlayerPed(-1) + Citizen.CreateThread(function() + ESX.ShowNotification(_U('heal_inprogress')) + TaskStartScenarioInPlace(playerPed, 'CODE_HUMAN_MEDIC_TEND_TO_DEAD', 0, true) + Wait(10000) + ClearPedTasks(playerPed) + TriggerServerEvent('esx_ambulancejob:removeItem', 'bandage') + TriggerServerEvent('esx_ambulancejob:heal', GetPlayerServerId(closestPlayer), 'small') + ESX.ShowNotification(_U('heal_complete')) + end) + else + ESX.ShowNotification(_U('not_enough_bandage')) + end + end, 'bandage') + end + end + + if data.current.value == 'big' then + menu.close() + local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() + if closestPlayer == -1 or closestDistance > 3.0 then + ESX.ShowNotification(_U('no_players')) + else + ESX.TriggerServerCallback('esx_ambulancejob:getItemAmount', function(qtty) + if qtty > 0 then + local playerPed = GetPlayerPed(-1) + Citizen.CreateThread(function() + ESX.ShowNotification(_U('heal_inprogress')) + TaskStartScenarioInPlace(playerPed, 'CODE_HUMAN_MEDIC_TEND_TO_DEAD', 0, true) + Wait(10000) + ClearPedTasks(playerPed) + TriggerServerEvent('esx_ambulancejob:removeItem', 'medikit') + TriggerServerEvent('esx_ambulancejob:heal', GetPlayerServerId(closestPlayer), 'big') + ESX.ShowNotification(_U('heal_complete')) + end) + else + ESX.ShowNotification(_U('not_enough_medikit')) + end + end, 'medikit') + end + end + if data.current.value == 'put_in_vehicle' then menu.close() WarpPedInClosestVehicle(GetPlayerPed(closestPlayer)) @@ -538,38 +539,22 @@ function OpenVehicleSpawnerMenu() title = _U('veh_menu'), align = 'top-left', elements = { - {label = _U('ambulance'), value = 'ambulance'}, - {label = _U('helicopter'), value = 'polmav'}, + {label = _U('ambulance'), value = 'ambulance'} }, }, function(data, menu) - menu.close() - local model = data.current.value - - ESX.Game.SpawnVehicle(model, Config.Zones.VehicleSpawnPoint.Pos, 270.0, function(vehicle) - + ESX.Game.SpawnVehicle(model, Config.Zones.VehicleSpawnPoint.Pos, 230.0, function(vehicle) local playerPed = GetPlayerPed(-1) - - if model == 'polmav' then - SetVehicleModKit(vehicle, 0) - SetVehicleLivery(vehicle, 1) - end - - TaskWarpPedIntoVehicle(playerPed, vehicle, -1) - + TaskWarpPedIntoVehicle(playerPed, vehicle, -1) end) - end, function(data, menu) - menu.close() - CurrentAction = 'vehicle_spawner_menu' CurrentActionMsg = _U('veh_spawn') CurrentActionData = {} - end ) @@ -577,6 +562,31 @@ function OpenVehicleSpawnerMenu() end +function OpenPharmacyMenu() + ESX.UI.Menu.CloseAll() + + ESX.UI.Menu.Open( + 'default', GetCurrentResourceName(), 'pharmacy', + { + title = _U('pharmacy_menu_title'), + align = 'top-left', + elements = { + {label = _U('pharmacy_take') .. ' ' .. _('medikit'), value = 'medikit'}, + {label = _U('pharmacy_take') .. ' ' .. _('bandage'), value = 'bandage'} + }, + }, + function(data, menu) + TriggerServerEvent('esx_ambulancejob:giveItem', data.current.value) + end, + function(data, menu) + menu.close() + CurrentAction = 'pharmacy' + CurrentActionMsg = _U('open_pharmacy') + CurrentActionData = {} + end + ) +end + AddEventHandler('playerSpawned', function() IsDead = false @@ -590,44 +600,12 @@ end) RegisterNetEvent('esx:playerLoaded') AddEventHandler('esx:playerLoaded', function(xPlayer) - PlayerData = xPlayer - - if PlayerData.job.name == 'ambulance' then - - Config.Zones.AmbulanceActions.Type = 1 - Config.Zones.VehicleSpawner.Type = 1 - Config.Zones.VehicleDeleter.Type = 1 - - else - - Config.Zones.AmbulanceActions.Type = -1 - Config.Zones.VehicleSpawner.Type = -1 - Config.Zones.VehicleDeleter.Type = -1 - - end - end) RegisterNetEvent('esx:setJob') AddEventHandler('esx:setJob', function(job) - PlayerData.job = job - - if PlayerData.job.name == 'ambulance' then - - Config.Zones.AmbulanceActions.Type = 1 - Config.Zones.VehicleSpawner.Type = 1 - Config.Zones.VehicleDeleter.Type = 1 - - else - - Config.Zones.AmbulanceActions.Type = -1 - Config.Zones.VehicleSpawner.Type = -1 - Config.Zones.VehicleDeleter.Type = -1 - - end - end) RegisterNetEvent('esx_phone:loaded') @@ -644,26 +622,11 @@ AddEventHandler('esx_phone:loaded', function(phoneNumber, contacts) end) AddEventHandler('baseevents:onPlayerDied', function(killerType, coords) - TriggerEvent('esx_ambulancejob:onPlayerDeath') + OnPlayerDeath() end) AddEventHandler('baseevents:onPlayerKilled', function(killerId, data) - TriggerEvent('esx_ambulancejob:onPlayerDeath') -end) - -AddEventHandler('esx_ambulancejob:onPlayerDeath', function() - - IsDead = true - - if Config.ShowDeathTimer == true then - RespawnTimer() - else - StartRespawnTimer() - StartRespawnToHospitalMenuTimer() - end - - StartScreenEffect('DeathFailOut', 0, false) - + OnPlayerDeath() end) RegisterNetEvent('esx_ambulancejob:revive') @@ -717,6 +680,20 @@ AddEventHandler('esx_ambulancejob:hasEnteredMarker', function(zone) end if zone == 'HospitalInteriorEntering2' then + local heli = Config.HelicopterSpawner + + if not IsAnyVehicleNearPoint(heli.SpawnPoint.x, heli.SpawnPoint.y, heli.SpawnPoint.z, 3.0) + and PlayerData.job ~= nil and PlayerData.job.name == 'ambulance' then + ESX.Game.SpawnVehicle('polmav', { + x = heli.SpawnPoint.x, + y = heli.SpawnPoint.y, + z = heli.SpawnPoint.z + }, heli.Heading, function(vehicle) + SetVehicleModKit(vehicle, 0) + SetVehicleLivery(vehicle, 1) + end) + + end TeleportFadeEffect(GetPlayerPed(-1), Config.Zones.HospitalInteriorInside2.Pos) end @@ -724,19 +701,45 @@ AddEventHandler('esx_ambulancejob:hasEnteredMarker', function(zone) TeleportFadeEffect(GetPlayerPed(-1), Config.Zones.HospitalInteriorOutside2.Pos) end - if zone == 'AmbulanceActions' and PlayerData.job ~= nil and PlayerData.job.name == 'ambulance' then + if zone == 'ParkingDoorGoOutInside' then + TeleportFadeEffect(GetPlayerPed(-1), Config.Zones.ParkingDoorGoOutOutside.Pos) + end + + if zone == 'ParkingDoorGoInOutside' then + TeleportFadeEffect(GetPlayerPed(-1), Config.Zones.ParkingDoorGoInInside.Pos) + end + + if zone == 'StairsGoTopBottom' then + CurrentAction = 'fast_travel_goto_top' + CurrentActionMsg = _U('fast_travel') + CurrentActionData = {pos = Config.Zones.StairsGoTopTop.Pos} + end + + if zone == 'StairsGoBottomTop' then + CurrentAction = 'fast_travel_goto_bottom' + CurrentActionMsg = _U('fast_travel') + CurrentActionData = {pos = Config.Zones.StairsGoBottomBottom.Pos} + end + + if zone == 'AmbulanceActions' then CurrentAction = 'ambulance_actions_menu' CurrentActionMsg = _U('open_menu') CurrentActionData = {} end - if zone == 'VehicleSpawner' and PlayerData.job ~= nil and PlayerData.job.name == 'ambulance' then + if zone == 'VehicleSpawner' then CurrentAction = 'vehicle_spawner_menu' CurrentActionMsg = _U('veh_spawn') CurrentActionData = {} end - if zone == 'VehicleDeleter' and PlayerData.job ~= nil and PlayerData.job.name == 'ambulance' then + if zone == 'Pharmacy' then + CurrentAction = 'pharmacy' + CurrentActionMsg = _U('open_pharmacy') + CurrentActionData = {} + end + + if zone == 'VehicleDeleter' then local playerPed = GetPlayerPed(-1) local coords = GetEntityCoords(playerPed) @@ -759,10 +762,14 @@ AddEventHandler('esx_ambulancejob:hasEnteredMarker', function(zone) end - end + end end) +function FastTravel(pos) + TeleportFadeEffect(GetPlayerPed(-1), pos) +end + AddEventHandler('esx_ambulancejob:hasExitedMarker', function(zone) ESX.UI.Menu.CloseAll() CurrentAction = nil @@ -788,49 +795,52 @@ end) -- Display markers Citizen.CreateThread(function() while true do - Wait(0) local coords = GetEntityCoords(GetPlayerPed(-1)) - for k,v in pairs(Config.Zones) do - if(v.Type ~= -1 and GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < Config.DrawDistance) then - DrawMarker(v.Type, v.Pos.x, v.Pos.y, v.Pos.z, 0.0, 0.0, 0.0, 0, 0.0, 0.0, v.Size.x, v.Size.y, v.Size.z, Config.MarkerColor.r, Config.MarkerColor.g, Config.MarkerColor.b, 100, false, true, 2, false, false, false, false) + if PlayerData.job ~= nil and PlayerData.job.name == 'ambulance' then + DrawMarker(v.Type, v.Pos.x, v.Pos.y, v.Pos.z, 0.0, 0.0, 0.0, 0, 0.0, 0.0, v.Size.x, v.Size.y, v.Size.z, Config.MarkerColor.r, Config.MarkerColor.g, Config.MarkerColor.b, 100, false, true, 2, false, false, false, false) + elseif k ~= 'AmbulanceActions' and k ~= 'VehicleSpawner' and k ~= 'VehicleDeleter' + and k ~= 'Pharmacy' and k ~= 'StairsGoTopBottom' and k ~= 'StairsGoBottomTop' then + DrawMarker(v.Type, v.Pos.x, v.Pos.y, v.Pos.z, 0.0, 0.0, 0.0, 0, 0.0, 0.0, v.Size.x, v.Size.y, v.Size.z, Config.MarkerColor.r, Config.MarkerColor.g, Config.MarkerColor.b, 100, false, true, 2, false, false, false, false) + end end end - end end) -- Activate menu when player is inside marker Citizen.CreateThread(function() while true do - Wait(0) - local coords = GetEntityCoords(GetPlayerPed(-1)) local isInMarker = false local currentZone = nil - for k,v in pairs(Config.Zones) do - if(GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < v.Size.x) then - isInMarker = true - currentZone = k - end + if PlayerData.job ~= nil and PlayerData.job.name == 'ambulance' then + if(GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < v.Size.x) then + isInMarker = true + currentZone = k + end + elseif k ~= 'AmbulanceActions' and k ~= 'VehicleSpawner' and k ~= 'VehicleDeleter' + and k ~= 'Pharmacy' and k ~= 'StairsGoTopBottom' and k ~= 'StairsGoBottomTop' then + if(GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < v.Size.x) then + isInMarker = true + currentZone = k + end + end end - if isInMarker and not hasAlreadyEnteredMarker then hasAlreadyEnteredMarker = true lastZone = currentZone TriggerEvent('esx_ambulancejob:hasEnteredMarker', currentZone) end - if not isInMarker and hasAlreadyEnteredMarker then hasAlreadyEnteredMarker = false TriggerEvent('esx_ambulancejob:hasExitedMarker', lastZone) end - end end) @@ -846,7 +856,7 @@ Citizen.CreateThread(function() AddTextComponentString(CurrentActionMsg) DisplayHelpTextFromStringLabel(0, 0, 1, -1) - if IsControlPressed(0, Keys['E']) and PlayerData.job ~= nil and PlayerData.job.name == 'ambulance' and (GetGameTimer() - GUI.Time) > 150 then + if IsControlJustReleased(0, Keys['E']) and PlayerData.job ~= nil and PlayerData.job.name == 'ambulance' then if CurrentAction == 'ambulance_actions_menu' then OpenAmbulanceActionsMenu() @@ -856,26 +866,30 @@ Citizen.CreateThread(function() OpenVehicleSpawnerMenu() end - if CurrentAction == 'delete_vehicle' then + if CurrentAction == 'pharmacy' then + OpenPharmacyMenu() + end + if CurrentAction == 'fast_travel_goto_top' or CurrentAction == 'fast_travel_goto_bottom' then + FastTravel(CurrentActionData.pos) + end + + if CurrentAction == 'delete_vehicle' then if Config.EnableSocietyOwnedVehicles then local vehicleProps = ESX.Game.GetVehicleProperties(CurrentActionData.vehicle) TriggerServerEvent('esx_society:putVehicleInGarage', 'ambulance', vehicleProps) end - ESX.Game.DeleteVehicle(CurrentActionData.vehicle) end CurrentAction = nil - GUI.Time = GetGameTimer() end end - if IsControlPressed(0, Keys['F6']) and PlayerData.job ~= nil and PlayerData.job.name == 'ambulance' and (GetGameTimer() - GUI.Time) > 150 then + if IsControlJustReleased(0, Keys['F6']) and PlayerData.job ~= nil and PlayerData.job.name == 'ambulance' then OpenMobileAmbulanceActionsMenu() - GUI.Time = GetGameTimer() end end @@ -890,13 +904,13 @@ end) -- String string function stringsplit(inputstr, sep) - if sep == nil then - sep = "%s" - end - local t={} ; i=1 - for str in string.gmatch(inputstr, "([^"..sep.."]+)") do - t[i] = str - i = i + 1 - end - return t + if sep == nil then + sep = "%s" + end + local t={} ; i=1 + for str in string.gmatch(inputstr, "([^"..sep.."]+)") do + t[i] = str + i = i + 1 + end + return t end diff --git a/esx_ambulancejob.sql b/esx_ambulancejob.sql index aae0c0d8..a099281c 100644 --- a/esx_ambulancejob.sql +++ b/esx_ambulancejob.sql @@ -14,3 +14,8 @@ INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_ INSERT INTO `jobs` (name, label) VALUES ('ambulance','Ambulance') ; + +INSERT INTO `items` (name, label, `limit`) VALUES + ('bandage','Bandage', 20), + ('medikit','Medikit', 5) +; diff --git a/locales/fr.lua b/locales/fr.lua index decee714..5343d810 100644 --- a/locales/fr.lua +++ b/locales/fr.lua @@ -26,22 +26,38 @@ Locales['fr'] = { ['open_menu'] = 'appuyez sur ~INPUT_CONTEXT~ pour ouvrir le menu', ['deposit_amount'] = 'montant du dépôt', ['money_withdraw'] = 'montant du retrait', + ['fast_travel'] = 'appuyez sur ~INPUT_CONTEXT~ pour vous déplacer rapidement.', + ['open_pharmacy'] = 'appuyez sur ~INPUT_CONTEXT~ pour ouvrir la pharmacie.', + ['pharmacy_menu_title'] = 'Pharmacie', + ['pharmacy_take'] = 'Prendre', + ['medikit'] = 'medikit', + ['bandage'] = 'bandage', + ['max_item'] = 'vous en portez déjà assez sur vous.', -- F6 Menu ['ems_menu'] = 'interaction citoyen', ['ems_menu_title'] = 'ambulance - Interactions Citoyen', ['ems_menu_revive'] = 'réanimer', ['ems_menu_putincar'] = 'mettre dans véhicule', + ['ems_menu_small'] = 'soigner petites blessures', + ['ems_menu_big'] = 'soigner blessures graves', -- Phone ['alert_ambulance'] = 'alerte Ambulance', -- Death ['respawn_at_hospital'] = 'voulez-vous être transporté à l\'hôpital ?', ['yes'] = 'oui', - ['please_wait'] = 's\'il vous plaît, attendez ~b~', + ['please_wait'] = 'Vous serez automatiquement transporté à l\'hôpital dans ~b~', ['minutes'] = ' minutes ', ['seconds_fine'] = ' secondes ~w~ pour réapparaître \nRéapparaître maintenant pour ~g~$', - ['seconds'] = ' secondes ~w~ pour réapparaître.', - ['press_respawn_fine'] = '~w~ [Presse ~b~E~w~]', - ['press_respawn'] = 'appuyez [~b~E~w~] sur pour réapparaître.', + ['seconds'] = ' secondes ~w~.', + ['press_respawn_fine'] = 'vous payerez ~g~', + ['press_respawn'] = 'appuyez sur [~b~E~w~] pour réapparaître.', -- Revive ['revive_help'] = 'relancer un joueur', + -- Item + ['used_medikit'] = 'vous avez utilisé 1x medikit', + ['used_bandage'] = 'vous avez utilisé 1x bandage', + ['not_enough_medikit'] = 'vous n\'avez pas de ~b~medikit~w~.', + ['not_enough_bandage'] = 'vous n\'avez pas de ~b~bandage~w~.', + ['healed'] = 'vous avez été soigné.', + -- Misc } diff --git a/server/main.lua b/server/main.lua index 1085e4a2..acb36847 100644 --- a/server/main.lua +++ b/server/main.lua @@ -7,7 +7,13 @@ AddEventHandler('esx_ambulancejob:revive', function(target) TriggerClientEvent('esx_ambulancejob:revive', target) end) +RegisterServerEvent('esx_ambulancejob:heal') +AddEventHandler('esx_ambulancejob:heal', function(target, type) + TriggerClientEvent('esx_ambulancejob:heal', target, type) +end) + TriggerEvent('esx_phone:registerNumber', 'ambulance', _U('alert_ambulance'), true, true) + TriggerEvent('esx_society:registerSociety', 'ambulance', 'Ambulance', 'society_ambulance', 'society_ambulance', 'society_ambulance', {type = 'public'}) ESX.RegisterServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function(source, cb) @@ -40,64 +46,71 @@ ESX.RegisterServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function( end end + if Config.RespawnFine then + xPlayer.removeAccountMoney('bank', Config.RespawnFineAmount) + end + cb() end) -ESX.RegisterServerCallback('esx_ambulancejob:removeItemsAfterRPDeathRemoveMoney', function(source, cb) - +ESX.RegisterServerCallback('esx_ambulancejob:getItemAmount', function(source, cb, item) local xPlayer = ESX.GetPlayerFromId(source) - - if Config.RemoveCashAfterRPDeath then - - if xPlayer.getMoney() > 0 then - xPlayer.removeMoney(xPlayer.getMoney()) - end - - if xPlayer.getAccount('black_money').money > 0 then - xPlayer.setAccountMoney('black_money', 0) - end - - end - - if Config.EarlyRespawn and Config.EarlyRespawnFine then - xPlayer.removeAccountMoney('bank', Config.EarlyRespawnFineAmount) - end - - if Config.RemoveItemsAfterRPDeath then - for i=1, #xPlayer.inventory, 1 do - if xPlayer.inventory[i].count > 0 and not xPlayer.inventory[i].rare then - xPlayer.setInventoryItem(xPlayer.inventory[i].name, 0) - end - end - end - - if Config.RemoveWeaponsAfterRPDeath then - for i=1, #xPlayer.loadout, 1 do - xPlayer.removeWeapon(xPlayer.loadout[i].name) - end - end - - cb() - + local qtty = xPlayer.getInventoryItem(item).count + cb(qtty) end) -ESX.RegisterServerCallback('esx_ambulancejob:getBankMoney', function(source, cb) - - local xPlayer = ESX.GetPlayerFromId(source) - local money = xPlayer.getAccount('bank').money - - cb(money) +RegisterServerEvent('esx_ambulancejob:removeItem') +AddEventHandler('esx_ambulancejob:removeItem', function(item) + local _source = source + local xPlayer = ESX.GetPlayerFromId(_source) + xPlayer.removeInventoryItem(item, 1) + if item == 'bandage' then + TriggerClientEvent('esx:showNotification', _source, _U('used_bandage')) + elseif item == 'medikit' then + TriggerClientEvent('esx:showNotification', _source, _U('used_medikit')) + end end) +RegisterServerEvent('esx_ambulancejob:giveItem') +AddEventHandler('esx_ambulancejob:giveItem', function(item) + local _source = source + local xPlayer = ESX.GetPlayerFromId(_source) + local limit = xPlayer.getInventoryItem(item).limit + local delta = 1 + local qtty = xPlayer.getInventoryItem(item).count + if limit ~= -1 then + delta = limit - qtty + end + if qtty < limit then + xPlayer.addInventoryItem(item, delta) + else + TriggerClientEvent('esx:showNotification', _source, _U('max_item')) + end +end) + + TriggerEvent('es:addGroupCommand', 'revive', 'admin', function(source, args, user) - + print('revive by /revive') if args[2] ~= nil then TriggerClientEvent('esx_ambulancejob:revive', tonumber(args[2])) else TriggerClientEvent('esx_ambulancejob:revive', source) end - end, function(source, args, user) TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "Insufficient Permissions.") end, {help = _U('revive_help'), params = {{name = 'id'}}}) + +ESX.RegisterUsableItem('medikit', function(source) + local xPlayer = ESX.GetPlayerFromId(source) + xPlayer.removeInventoryItem('medikit', 1) + TriggerClientEvent('esx_ambulancejob:heal', source, 'big') + TriggerClientEvent('esx:showNotification', source, _U('used_medikit')) +end) + +ESX.RegisterUsableItem('bandage', function(source) + local xPlayer = ESX.GetPlayerFromId(source) + xPlayer.removeInventoryItem('bandage', 1) + TriggerClientEvent('esx_ambulancejob:heal', source, 'small') + TriggerClientEvent('esx:showNotification', source, _U('used_bandage')) +end) From 11c67debe6bcbc6641cc3e899128dd11a5b192e6 Mon Sep 17 00:00:00 2001 From: renaiku Date: Tue, 17 Oct 2017 23:33:44 +0200 Subject: [PATCH 059/177] repush of config.lua --- config.lua | 159 +++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 118 insertions(+), 41 deletions(-) diff --git a/config.lua b/config.lua index 47124b45..26e4ab3d 100644 --- a/config.lua +++ b/config.lua @@ -1,99 +1,176 @@ Config = {} Config.DrawDistance = 100.0 Config.MarkerColor = { r = 102, g = 0, b = 102 } -Config.RespawnDelayAfterRPDeath = 4 * 60 * 1000 -Config.MenuRespawnToHospitalDelay = 1 * 60 * 1000 -Config.EnableSocietyOwnedVehicles = false -Config.RemoveWeaponsAfterRPDeath = true -Config.RemoveCashAfterRPDeath = true -Config.RemoveItemsAfterRPDeath = true -Config.EnablePlayerManagement = false -Config.ShowDeathTimer = true -Config.EarlyRespawn = true -Config.EarlyRespawnFine = true -Config.EarlyRespawnFineAmount = 500 -Config.Locale = 'fr' + +local second = 1000 +local minute = 60 * second + +-- How much time before auto respawn at hospital +Config.RespawnDelayAfterRPDeath = 10 * minute + +-- How much time before a menu opens to ask the player if he wants to respawn at hospital now +-- The player is not obliged to select YES, but he will be auto respawn +-- at the end of RespawnDelayAfterRPDeath just above. +Config.RespawnToHospitalMenuTimer = true +Config.MenuRespawnToHospitalDelay = 5 * minute + +Config.EnablePlayerManagement = false +Config.EnableSocietyOwnedVehicles = false + +Config.RemoveWeaponsAfterRPDeath = true +Config.RemoveCashAfterRPDeath = true +Config.RemoveItemsAfterRPDeath = true + +-- Will display a timer that shows RespawnDelayAfterRPDeath time remaining +Config.ShowDeathTimer = true + +-- Will allow to respawn at any time, don't use RespawnToHospitalMenuTimer at the same time ! +Config.EarlyRespawn = false +-- The player can have a fine (on bank account) +Config.RespawnFine = false +Config.RespawnFineAmount = 500 + +Config.Locale = 'fr' Config.Blip = { - Pos = { x = 1153.364, y = -1525.731, z = 33.843 }, + Pos = { x = 307.76, y = -1433.47, z = 28.97 }, Sprite = 61, Display = 4, Scale = 1.2, Colour = 2, } +Config.HelicopterSpawner = { + SpawnPoint = { x = 313.33, y = -1465.2, z = 45.5 }, + Heading = 0.0 +} + Config.Zones = { - HospitalInteriorEntering1 = { - Pos = { x = 1151.447, y = -1529.491, z = 34.375 }, - Size = { x = 1.5, y = 1.5, z = 1.0 }, + HospitalInteriorEntering1 = { -- ok + Pos = { x = 294.6, y = -1448.01, z = 28.9 }, + Size = { x = 1.5, y = 1.5, z = 0.4 }, Type = 1 }, - HospitalInteriorInside1 = { - Pos = { x = 251.464, y = -1369.770, z = 28.648 }, + HospitalInteriorInside1 = { -- ok + Pos = { x = 272.8, y = -1358.8, z = 23.5 }, Size = { x = 1.5, y = 1.5, z = 1.0 }, Type = -1 }, - HospitalInteriorOutside1 = { - Pos = { x = 1153.364, y = -1525.731, z = 33.843 }, + HospitalInteriorOutside1 = { -- ok + Pos = { x = 295.8, y = -1446.5, z = 28.9 }, Size = { x = 1.5, y = 1.5, z = 1.0 }, Type = -1 }, - HospitalInteriorExit1 = { - Pos = { x = 253.612, y = -1371.66, z = 28.647 }, - Size = { x = 1.5, y = 1.5, z = 1.0 }, + HospitalInteriorExit1 = { -- ok + Pos = { x = 275.7, y = -1361.5, z = 23.5 }, + Size = { x = 1.5, y = 1.5, z = 0.4 }, Type = 1 }, - HospitalInteriorEntering2 = { - Pos = { x = 1137.181, y = -1597.504, z = 33.692 }, - Size = { x = 1.5, y = 1.5, z = 1.0 }, + HospitalInteriorEntering2 = { -- Ascenseur aller au toit + Pos = { x = 247.1, y = -1371.4, z = 23.5 }, + Size = { x = 1.5, y = 1.5, z = 0.4 }, Type = 1 }, - HospitalInteriorInside2 = { - Pos = { x = 240.508, y = -1360.565, z = 28.647 }, + HospitalInteriorInside2 = { -- Toit sortie + Pos = { x = 333.1, y = -1434.9, z = 45.5 }, Size = { x = 1.5, y = 1.5, z = 1.0 }, Type = -1 }, - HospitalInteriorOutside2 = { - Pos = { x = 1137.922, y = -1601.434, z = 33.692 }, + HospitalInteriorOutside2 = { -- Ascenseur retour depuis toit + Pos = { x = 249.1, y = -1369.6, z = 23.5 }, Size = { x = 1.5, y = 1.5, z = 1.0 }, Type = -1 }, - HospitalInteriorExit2 = { - Pos = { x = 238.587, y = -1359.113, z = 28.647 }, - Size = { x = 1.5, y = 1.5, z = 1.0 }, + HospitalInteriorExit2 = { -- Toit entrée + Pos = { x = 335.5, y = -1432.0, z = 45.5 }, + Size = { x = 1.5, y = 1.5, z = 0.4 }, Type = 1 }, - AmbulanceActions = { - Pos = { x = 244.048, y = -1366.330, z = 28.647 }, - Size = { x = 1.5, y = 1.5, z = 1.0 }, + AmbulanceActions = { -- CLOACKROOM + Pos = { x = 268.4, y = -1363.330, z = 23.5 }, + Size = { x = 1.5, y = 1.5, z = 0.4 }, Type = 1 }, VehicleSpawner = { - Pos = { x = 1128.290, y = -1601.451, z = 33.893 }, - Size = { x = 1.5, y = 1.5, z = 1.0 }, + Pos = { x = 307.76, y = -1433.47, z = 28.97 }, + Size = { x = 1.5, y = 1.5, z = 0.4 }, Type = 1 }, VehicleSpawnPoint = { - Pos = { x = 1138.061, y = -1607.882, z = 34.692 }, + Pos = { x = 304.87, y = -1437.69, z = 28.80 }, Size = { x = 1.5, y = 1.5, z = 1.0 }, Type = -1 }, VehicleDeleter = { - Pos = { x = 1122.436, y = -1617.600, z = 33.692 }, - Size = { x = 3.0, y = 3.0, z = 2.0 }, + Pos = { x = 327.67, y = -1481.1, z = 28.83 }, + Size = { x = 3.0, y = 3.0, z = 0.4 }, Type = 1 + }, + + Pharmacy = { + Pos = { x = 230.13, y = -1366.18, z = 38.53 }, + Size = { x = 1.5, y = 1.5, z = 0.4 }, + Type = 1 + }, + + ParkingDoorGoOutInside = { + Pos = { x = 234.56, y = -1373.77, z = 20.97 }, + Size = { x = 1.5, y = 1.5, z = 0.4 }, + Type = 1 + }, + + ParkingDoorGoOutOutside = { + Pos = { x = 320.98, y = -1478.62, z = 28.81 }, + Size = { x = 1.5, y = 1.5, z = 1.5 }, + Type = -1 + }, + + ParkingDoorGoInInside = { + Pos = { x = 238.64, y = -1368.48, z = 23.53 }, + Size = { x = 1.5, y = 1.5, z = 1.5 }, + Type = -1 + }, + + ParkingDoorGoInOutside = { + Pos = { x = 317.97, y = -1476.13, z = 28.97 }, + Size = { x = 1.5, y = 1.5, z = 0.4 }, + Type = 1 + }, + + StairsGoTopTop = { + Pos = { x = 251.91, y = -1363.3, z = 38.53 }, + Size = { x = 1.5, y = 1.5, z = 1.5 }, + Type = -1 + }, + + StairsGoTopBottom = { + Pos = { x = 237.45, y = -1373.89, z = 26.30 }, + Size = { x = 3.5, y = 3.5, z = 0.4 }, + Type = -1 + }, + + StairsGoBottomTop = { + Pos = { x = 256.58, y = -1357.7, z = 37.30 }, + Size = { x = 3.5, y = 3.5, z = 0.4 }, + Type = -1 + }, + + StairsGoBottomBottom = { + Pos = { x = 240.94, y = -1369.91, z = 23.53 }, + Size = { x = 1.5, y = 1.5, z = 1.5 }, + Type = -1 } } From 1dade566c52e1ea5df0cc7e96b349bf0cd08bf72 Mon Sep 17 00:00:00 2001 From: CMDTelhada <31828535+CMDTelhada@users.noreply.github.com> Date: Tue, 17 Oct 2017 20:07:14 -0200 Subject: [PATCH 060/177] br.lua portuguese translation --- locales/br | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 locales/br diff --git a/locales/br b/locales/br new file mode 100644 index 00000000..c369afca --- /dev/null +++ b/locales/br @@ -0,0 +1,63 @@ +Locales['br'] = { + -- Cloakroom + ['cloakroom'] = 'Vestiário', + ['ems_clothes_civil'] = 'Roupa Normal', + ['ems_clothes_ems'] = 'Entrar como Socorrista', + -- Vehicles + ['veh_menu'] = 'véhicule', + ['veh_spawn'] = 'Aperte ~INPUT_CONTEXT~ para pegar veiculo', + ['store_veh'] = 'Aperte ~INPUT_CONTEXT~ para guardar Veiculo ', + ['ambulance'] = 'Ambulancia', + ['helicopter'] = 'Helicoptero', + -- Action Menu + ['hospital'] = 'Hôspital', + ['revive_inprogress'] = 'Reanimação em andamento', + ['revive_complete'] = 'Você ressuscitou ', + ['no_players'] = 'Nenhum jogador nas proximidades', + ['no_vehicles'] = 'Sem veículos nas proximidades', + ['isdead'] = 'Está morto', + ['unconscious'] = 'Não está inconsciente', + -- Boss Menu + ['deposit_society'] = 'Depositar dinheiro', + ['withdraw_society'] = 'Retirar dinheiro da empresa', + ['boss_actions'] = 'Menu Administração', + -- Misc + ['invalid_amount'] = '~r~Quantidade inválida', + ['open_menu'] = 'Aperte ~INPUT_CONTEXT~ para abrir o menu', + ['deposit_amount'] = 'Quantidade inválida para deposito', + ['money_withdraw'] = 'Quantidade a ser retirada', + ['fast_travel'] = 'Aperte ~INPUT_CONTEXT~ para mover-se rapidamente.', + ['open_pharmacy'] = 'Aperte ~INPUT_CONTEXT~ para abrir a farmácia.', + ['pharmacy_menu_title'] = 'Farmácia', + ['pharmacy_take'] = 'Tomar', + ['medikit'] = 'Seringa', + ['bandage'] = 'Vendagem', + ['max_item'] = 'você já carrega o suficiente sobre você.', + -- F6 Menu + ['ems_menu'] = 'Interação com cidadão', + ['ems_menu_title'] = 'Ambulância - Interação com cidadão', + ['ems_menu_revive'] = 'Reanimar', + ['ems_menu_putincar'] = 'Colocar no veiculo', + ['ems_menu_small'] = 'Curar pequenas feridas', + ['ems_menu_big'] = 'Tratando lesões graves', + -- Phone + ['alert_ambulance'] = 'Alerta Socorro', + -- Death + ['respawn_at_hospital'] = 'Você quer ser transportado para o hospital ?', + ['yes'] = 'Sim', + ['please_wait'] = 'Você será automaticamente transportado para o hospital em ~b~', + ['minutes'] = ' minutos ', + ['seconds_fine'] = ' segundos ~w~ para renascer \nRenascer agora ~g~$', + ['seconds'] = ' segundos ~w~.', + ['press_respawn_fine'] = 'Você pagará ~g~', + ['press_respawn'] = 'Aperte [~b~E~w~] para renascer.', + -- Revive + ['revive_help'] = 'reviver um jogador', + -- Item + ['used_medikit'] = 'você usou 1x Seringa', + ['used_bandage'] = 'você usou 1x Vendagem', + ['not_enough_medikit'] = 'Você não tem ~b~Seringa~w~.', + ['not_enough_bandage'] = 'Você não tem ~b~Vendagem~w~.', + ['healed'] = 'Você foi tratado.', + -- Misc +} From a4c57ea2848e5ebfc623fd23fee1432f28586368 Mon Sep 17 00:00:00 2001 From: renaiku Date: Thu, 16 Nov 2017 02:15:11 +0100 Subject: [PATCH 061/177] Essential 5 /revive command compatibility --- server/main.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/main.lua b/server/main.lua index acb36847..0d1b1e94 100644 --- a/server/main.lua +++ b/server/main.lua @@ -92,8 +92,8 @@ end) TriggerEvent('es:addGroupCommand', 'revive', 'admin', function(source, args, user) print('revive by /revive') - if args[2] ~= nil then - TriggerClientEvent('esx_ambulancejob:revive', tonumber(args[2])) + if args[1] ~= nil then + TriggerClientEvent('esx_ambulancejob:revive', tonumber(args[1])) else TriggerClientEvent('esx_ambulancejob:revive', source) end From c92d71e7ff663050c95def4376b51e795e2d53b2 Mon Sep 17 00:00:00 2001 From: Jarrett B Date: Sun, 14 Jan 2018 21:04:21 -0800 Subject: [PATCH 062/177] Universal marker size. --- client/main.lua | 8 ++++---- config.lua | 23 +---------------------- 2 files changed, 5 insertions(+), 26 deletions(-) diff --git a/client/main.lua b/client/main.lua index 4ad24d7f..f8cdeaa1 100644 --- a/client/main.lua +++ b/client/main.lua @@ -801,10 +801,10 @@ Citizen.CreateThread(function() for k,v in pairs(Config.Zones) do if(v.Type ~= -1 and GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < Config.DrawDistance) then if PlayerData.job ~= nil and PlayerData.job.name == 'ambulance' then - DrawMarker(v.Type, v.Pos.x, v.Pos.y, v.Pos.z, 0.0, 0.0, 0.0, 0, 0.0, 0.0, v.Size.x, v.Size.y, v.Size.z, Config.MarkerColor.r, Config.MarkerColor.g, Config.MarkerColor.b, 100, false, true, 2, false, false, false, false) + DrawMarker(v.Type, v.Pos.x, v.Pos.y, v.Pos.z, 0.0, 0.0, 0.0, 0, 0.0, 0.0, Config.MarkerSize.x, Config.MarkerSize.y, Config.MarkerSize.z, Config.MarkerColor.r, Config.MarkerColor.g, Config.MarkerColor.b, 100, false, true, 2, false, false, false, false) elseif k ~= 'AmbulanceActions' and k ~= 'VehicleSpawner' and k ~= 'VehicleDeleter' and k ~= 'Pharmacy' and k ~= 'StairsGoTopBottom' and k ~= 'StairsGoBottomTop' then - DrawMarker(v.Type, v.Pos.x, v.Pos.y, v.Pos.z, 0.0, 0.0, 0.0, 0, 0.0, 0.0, v.Size.x, v.Size.y, v.Size.z, Config.MarkerColor.r, Config.MarkerColor.g, Config.MarkerColor.b, 100, false, true, 2, false, false, false, false) + DrawMarker(v.Type, v.Pos.x, v.Pos.y, v.Pos.z, 0.0, 0.0, 0.0, 0, 0.0, 0.0, Config.MarkerSize.x, Config.MarkerSize.y, Config.MarkerSize.z, Config.MarkerColor.r, Config.MarkerColor.g, Config.MarkerColor.b, 100, false, true, 2, false, false, false, false) end end end @@ -820,13 +820,13 @@ Citizen.CreateThread(function() local currentZone = nil for k,v in pairs(Config.Zones) do if PlayerData.job ~= nil and PlayerData.job.name == 'ambulance' then - if(GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < v.Size.x) then + if(GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < Config.MarkerSize.x) then isInMarker = true currentZone = k end elseif k ~= 'AmbulanceActions' and k ~= 'VehicleSpawner' and k ~= 'VehicleDeleter' and k ~= 'Pharmacy' and k ~= 'StairsGoTopBottom' and k ~= 'StairsGoBottomTop' then - if(GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < v.Size.x) then + if(GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < Config.MarkerSize.x) then isInMarker = true currentZone = k end diff --git a/config.lua b/config.lua index 26e4ab3d..d23a8de9 100644 --- a/config.lua +++ b/config.lua @@ -1,6 +1,7 @@ Config = {} Config.DrawDistance = 100.0 Config.MarkerColor = { r = 102, g = 0, b = 102 } +Config.MarkerSize = { x = 1.5, y = 1.5, z = 1.0 } local second = 1000 local minute = 60 * second @@ -49,127 +50,105 @@ Config.Zones = { HospitalInteriorEntering1 = { -- ok Pos = { x = 294.6, y = -1448.01, z = 28.9 }, - Size = { x = 1.5, y = 1.5, z = 0.4 }, Type = 1 }, HospitalInteriorInside1 = { -- ok Pos = { x = 272.8, y = -1358.8, z = 23.5 }, - Size = { x = 1.5, y = 1.5, z = 1.0 }, Type = -1 }, HospitalInteriorOutside1 = { -- ok Pos = { x = 295.8, y = -1446.5, z = 28.9 }, - Size = { x = 1.5, y = 1.5, z = 1.0 }, Type = -1 }, HospitalInteriorExit1 = { -- ok Pos = { x = 275.7, y = -1361.5, z = 23.5 }, - Size = { x = 1.5, y = 1.5, z = 0.4 }, Type = 1 }, HospitalInteriorEntering2 = { -- Ascenseur aller au toit Pos = { x = 247.1, y = -1371.4, z = 23.5 }, - Size = { x = 1.5, y = 1.5, z = 0.4 }, Type = 1 }, HospitalInteriorInside2 = { -- Toit sortie Pos = { x = 333.1, y = -1434.9, z = 45.5 }, - Size = { x = 1.5, y = 1.5, z = 1.0 }, Type = -1 }, HospitalInteriorOutside2 = { -- Ascenseur retour depuis toit Pos = { x = 249.1, y = -1369.6, z = 23.5 }, - Size = { x = 1.5, y = 1.5, z = 1.0 }, Type = -1 }, HospitalInteriorExit2 = { -- Toit entrée Pos = { x = 335.5, y = -1432.0, z = 45.5 }, - Size = { x = 1.5, y = 1.5, z = 0.4 }, Type = 1 }, AmbulanceActions = { -- CLOACKROOM Pos = { x = 268.4, y = -1363.330, z = 23.5 }, - Size = { x = 1.5, y = 1.5, z = 0.4 }, Type = 1 }, VehicleSpawner = { Pos = { x = 307.76, y = -1433.47, z = 28.97 }, - Size = { x = 1.5, y = 1.5, z = 0.4 }, Type = 1 }, VehicleSpawnPoint = { Pos = { x = 304.87, y = -1437.69, z = 28.80 }, - Size = { x = 1.5, y = 1.5, z = 1.0 }, Type = -1 }, VehicleDeleter = { Pos = { x = 327.67, y = -1481.1, z = 28.83 }, - Size = { x = 3.0, y = 3.0, z = 0.4 }, Type = 1 }, Pharmacy = { Pos = { x = 230.13, y = -1366.18, z = 38.53 }, - Size = { x = 1.5, y = 1.5, z = 0.4 }, Type = 1 }, ParkingDoorGoOutInside = { Pos = { x = 234.56, y = -1373.77, z = 20.97 }, - Size = { x = 1.5, y = 1.5, z = 0.4 }, Type = 1 }, ParkingDoorGoOutOutside = { Pos = { x = 320.98, y = -1478.62, z = 28.81 }, - Size = { x = 1.5, y = 1.5, z = 1.5 }, Type = -1 }, ParkingDoorGoInInside = { Pos = { x = 238.64, y = -1368.48, z = 23.53 }, - Size = { x = 1.5, y = 1.5, z = 1.5 }, Type = -1 }, ParkingDoorGoInOutside = { Pos = { x = 317.97, y = -1476.13, z = 28.97 }, - Size = { x = 1.5, y = 1.5, z = 0.4 }, Type = 1 }, StairsGoTopTop = { Pos = { x = 251.91, y = -1363.3, z = 38.53 }, - Size = { x = 1.5, y = 1.5, z = 1.5 }, Type = -1 }, StairsGoTopBottom = { Pos = { x = 237.45, y = -1373.89, z = 26.30 }, - Size = { x = 3.5, y = 3.5, z = 0.4 }, Type = -1 }, StairsGoBottomTop = { Pos = { x = 256.58, y = -1357.7, z = 37.30 }, - Size = { x = 3.5, y = 3.5, z = 0.4 }, Type = -1 }, StairsGoBottomBottom = { - Pos = { x = 240.94, y = -1369.91, z = 23.53 }, - Size = { x = 1.5, y = 1.5, z = 1.5 }, Type = -1 } From 06d18cba5321745ac659864ff6b9cd0fa20bd137 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Mon, 22 Jan 2018 00:21:48 +0100 Subject: [PATCH 063/177] Updated en and fixed de sql file --- locales/en.lua | 16 ++++++++++++++++ localization/de_esx_ambulancejob.sql | 5 +++++ localization/en_esx_ambulancejob.sql | 21 +++++++++++++++++++++ 3 files changed, 42 insertions(+) create mode 100644 localization/en_esx_ambulancejob.sql diff --git a/locales/en.lua b/locales/en.lua index f3d8982b..780b0a71 100644 --- a/locales/en.lua +++ b/locales/en.lua @@ -26,11 +26,20 @@ Locales['en'] = { ['open_menu'] = 'press ~INPUT_CONTEXT~ to open the menu', ['deposit_amount'] = 'deposit Amount', ['money_withdraw'] = 'amount withdrawn', + ['fast_travel'] = 'Press on ~INPUT_CONTEXT~ to fast travel.', + ['open_pharmacy'] = 'Press on ~INPUT_CONTEXT~ to open the pharmacy.', + ['pharmacy_menu_title'] = 'Pharmacy', + ['pharmacy_take'] = 'Take', + ['medikit'] = 'medikit', + ['bandage'] = 'bandage', + ['max_item'] = 'You are already carrying enough on yourself.', -- F6 Menu ['ems_menu'] = 'eMS Menu', ['ems_menu_title'] = 'ambulance - EMS Menu', ['ems_menu_revive'] = 'revive Player', ['ems_menu_putincar'] = 'put in Vehicle', + ['ems_menu_small'] = 'heal small wounds', + ['ems_menu_big'] = 'treat serious injuries', -- Phone ['alert_ambulance'] = 'alert Ambulance', -- Death @@ -44,4 +53,11 @@ Locales['en'] = { ['press_respawn'] = 'press [~b~E~w~] to respawn.', -- Revive ['revive_help'] = 'revive a player', + -- Item + ['used_medikit'] = 'You have used 1x medikit', + ['used_bandage'] = 'You have used 1x bandage', + ['not_enough_medikit'] = 'You do not have ~b~medikit~w~.', + ['not_enough_bandage'] = 'You do not have ~b~bandage~w~.', + ['healed'] = 'you have been treated.', + -- Misc } diff --git a/localization/de_esx_ambulancejob.sql b/localization/de_esx_ambulancejob.sql index c2b62522..d26036c2 100644 --- a/localization/de_esx_ambulancejob.sql +++ b/localization/de_esx_ambulancejob.sql @@ -14,3 +14,8 @@ INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_ INSERT INTO `jobs` (name, label) VALUES ('ambulance','Notdienst') ; + +INSERT INTO `items` (name, label, `limit`) VALUES + ('bandage','Bandage', 20), + ('medikit','Medikit', 5) +; diff --git a/localization/en_esx_ambulancejob.sql b/localization/en_esx_ambulancejob.sql new file mode 100644 index 00000000..1b9d1776 --- /dev/null +++ b/localization/en_esx_ambulancejob.sql @@ -0,0 +1,21 @@ +USE `essentialmode`; + +INSERT INTO `addon_account` (name, label, shared) VALUES + ('society_ambulance', 'Ambulance', 1) +; + +INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_female) VALUES + ('ambulance',0,'ambulance','Ambulance',20,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), + ('ambulance',1,'doctor','Doctor',40,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), + ('ambulance',2,'chief_doctor','Chief doctor',60,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), + ('ambulance',3,'boss','Surgeon',80,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}') +; + +INSERT INTO `jobs` (name, label) VALUES + ('ambulance','Ambulance') +; + +INSERT INTO `items` (name, label, `limit`) VALUES + ('bandage','Bandage', 20), + ('medikit','Medikit', 5) +; From 8e4a2c5ab52608df563f3ebdef9f3949ffddf3a1 Mon Sep 17 00:00:00 2001 From: Unknown Date: Thu, 22 Feb 2018 01:48:19 +0100 Subject: [PATCH 064/177] Fix message pack Error --- server/main.lua | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/server/main.lua b/server/main.lua index 0d1b1e94..014bca39 100644 --- a/server/main.lua +++ b/server/main.lua @@ -17,8 +17,8 @@ TriggerEvent('esx_phone:registerNumber', 'ambulance', _U('alert_ambulance'), tru TriggerEvent('esx_society:registerSociety', 'ambulance', 'Ambulance', 'society_ambulance', 'society_ambulance', 'society_ambulance', {type = 'public'}) ESX.RegisterServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function(source, cb) - - local xPlayer = ESX.GetPlayerFromId(source) + local _source = source + local xPlayer = ESX.GetPlayerFromId(_source) if Config.RemoveCashAfterRPDeath then @@ -55,7 +55,8 @@ ESX.RegisterServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function( end) ESX.RegisterServerCallback('esx_ambulancejob:getItemAmount', function(source, cb, item) - local xPlayer = ESX.GetPlayerFromId(source) + local _source = source + local xPlayer = ESX.GetPlayerFromId(_source) local qtty = xPlayer.getInventoryItem(item).count cb(qtty) end) @@ -102,14 +103,16 @@ end, function(source, args, user) end, {help = _U('revive_help'), params = {{name = 'id'}}}) ESX.RegisterUsableItem('medikit', function(source) - local xPlayer = ESX.GetPlayerFromId(source) + local _source = source + local xPlayer = ESX.GetPlayerFromId(_source) xPlayer.removeInventoryItem('medikit', 1) TriggerClientEvent('esx_ambulancejob:heal', source, 'big') TriggerClientEvent('esx:showNotification', source, _U('used_medikit')) end) ESX.RegisterUsableItem('bandage', function(source) - local xPlayer = ESX.GetPlayerFromId(source) + local _source = source + local xPlayer = ESX.GetPlayerFromId(_source) xPlayer.removeInventoryItem('bandage', 1) TriggerClientEvent('esx_ambulancejob:heal', source, 'small') TriggerClientEvent('esx:showNotification', source, _U('used_bandage')) From 7f7ed876f4c4181fbba32cacd48190fc69100597 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Tue, 10 Apr 2018 20:20:10 +0200 Subject: [PATCH 065/177] Added missing coords --- config.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/config.lua b/config.lua index d23a8de9..acd002bd 100644 --- a/config.lua +++ b/config.lua @@ -149,6 +149,7 @@ Config.Zones = { }, StairsGoBottomBottom = { + Pos = { x = 235.45, y = -1372.89, z = 26.30 }, Type = -1 } From 29d0d0db4cafb9fd98c358f12b08a6d14baa271b Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Tue, 10 Apr 2018 20:22:31 +0200 Subject: [PATCH 066/177] Translation improvements --- __resource.lua | 36 ++++++++++++----------- locales/br | 63 ----------------------------------------- locales/br.lua | 77 ++++++++++++++++++++++++++++++-------------------- locales/en.lua | 8 +++--- locales/sv.lua | 63 +++++++++++++++++++++++++++++++++++++++++ 5 files changed, 133 insertions(+), 114 deletions(-) delete mode 100644 locales/br create mode 100644 locales/sv.lua diff --git a/__resource.lua b/__resource.lua index b9f69210..134770ab 100644 --- a/__resource.lua +++ b/__resource.lua @@ -5,24 +5,26 @@ description 'ESX Ambulance Job' version '1.0.5' server_scripts { - '@mysql-async/lib/MySQL.lua', - '@es_extended/locale.lua', - 'locales/de.lua', - 'locales/br.lua', - 'locales/en.lua', - 'locales/fr.lua', - 'locales/es.lua', - 'config.lua', - 'server/main.lua' + '@mysql-async/lib/MySQL.lua', + '@es_extended/locale.lua', + 'locales/de.lua', + 'locales/br.lua', + 'locales/en.lua', + 'locales/fr.lua', + 'locales/es.lua', + 'locales/sv.lua', + 'config.lua', + 'server/main.lua' } client_scripts { - '@es_extended/locale.lua', - 'locales/de.lua', - 'locales/br.lua', - 'locales/en.lua', - 'locales/fr.lua', - 'locales/es.lua', - 'config.lua', - 'client/main.lua' + '@es_extended/locale.lua', + 'locales/de.lua', + 'locales/br.lua', + 'locales/en.lua', + 'locales/fr.lua', + 'locales/es.lua', + 'locales/sv.lua', + 'config.lua', + 'client/main.lua' } diff --git a/locales/br b/locales/br deleted file mode 100644 index c369afca..00000000 --- a/locales/br +++ /dev/null @@ -1,63 +0,0 @@ -Locales['br'] = { - -- Cloakroom - ['cloakroom'] = 'Vestiário', - ['ems_clothes_civil'] = 'Roupa Normal', - ['ems_clothes_ems'] = 'Entrar como Socorrista', - -- Vehicles - ['veh_menu'] = 'véhicule', - ['veh_spawn'] = 'Aperte ~INPUT_CONTEXT~ para pegar veiculo', - ['store_veh'] = 'Aperte ~INPUT_CONTEXT~ para guardar Veiculo ', - ['ambulance'] = 'Ambulancia', - ['helicopter'] = 'Helicoptero', - -- Action Menu - ['hospital'] = 'Hôspital', - ['revive_inprogress'] = 'Reanimação em andamento', - ['revive_complete'] = 'Você ressuscitou ', - ['no_players'] = 'Nenhum jogador nas proximidades', - ['no_vehicles'] = 'Sem veículos nas proximidades', - ['isdead'] = 'Está morto', - ['unconscious'] = 'Não está inconsciente', - -- Boss Menu - ['deposit_society'] = 'Depositar dinheiro', - ['withdraw_society'] = 'Retirar dinheiro da empresa', - ['boss_actions'] = 'Menu Administração', - -- Misc - ['invalid_amount'] = '~r~Quantidade inválida', - ['open_menu'] = 'Aperte ~INPUT_CONTEXT~ para abrir o menu', - ['deposit_amount'] = 'Quantidade inválida para deposito', - ['money_withdraw'] = 'Quantidade a ser retirada', - ['fast_travel'] = 'Aperte ~INPUT_CONTEXT~ para mover-se rapidamente.', - ['open_pharmacy'] = 'Aperte ~INPUT_CONTEXT~ para abrir a farmácia.', - ['pharmacy_menu_title'] = 'Farmácia', - ['pharmacy_take'] = 'Tomar', - ['medikit'] = 'Seringa', - ['bandage'] = 'Vendagem', - ['max_item'] = 'você já carrega o suficiente sobre você.', - -- F6 Menu - ['ems_menu'] = 'Interação com cidadão', - ['ems_menu_title'] = 'Ambulância - Interação com cidadão', - ['ems_menu_revive'] = 'Reanimar', - ['ems_menu_putincar'] = 'Colocar no veiculo', - ['ems_menu_small'] = 'Curar pequenas feridas', - ['ems_menu_big'] = 'Tratando lesões graves', - -- Phone - ['alert_ambulance'] = 'Alerta Socorro', - -- Death - ['respawn_at_hospital'] = 'Você quer ser transportado para o hospital ?', - ['yes'] = 'Sim', - ['please_wait'] = 'Você será automaticamente transportado para o hospital em ~b~', - ['minutes'] = ' minutos ', - ['seconds_fine'] = ' segundos ~w~ para renascer \nRenascer agora ~g~$', - ['seconds'] = ' segundos ~w~.', - ['press_respawn_fine'] = 'Você pagará ~g~', - ['press_respawn'] = 'Aperte [~b~E~w~] para renascer.', - -- Revive - ['revive_help'] = 'reviver um jogador', - -- Item - ['used_medikit'] = 'você usou 1x Seringa', - ['used_bandage'] = 'você usou 1x Vendagem', - ['not_enough_medikit'] = 'Você não tem ~b~Seringa~w~.', - ['not_enough_bandage'] = 'Você não tem ~b~Vendagem~w~.', - ['healed'] = 'Você foi tratado.', - -- Misc -} diff --git a/locales/br.lua b/locales/br.lua index 359f6fe8..c369afca 100644 --- a/locales/br.lua +++ b/locales/br.lua @@ -1,46 +1,63 @@ Locales['br'] = { -- Cloakroom - ['cloakroom'] = 'Vestiario', - ['ems_clothes_civil'] = 'Roupa casual', - ['ems_clothes_ems'] = 'Uniforme paramedico', + ['cloakroom'] = 'Vestiário', + ['ems_clothes_civil'] = 'Roupa Normal', + ['ems_clothes_ems'] = 'Entrar como Socorrista', -- Vehicles - ['veh_menu'] = 'Veículo', - ['veh_spawn'] = 'Pressione ~INPUT_CONTEXT~ para escolher veículo ou helicoptero', - ['store_veh'] = 'Pressione ~INPUT_CONTEXT~ para gaurdar o veículo', - ['ambulance'] = 'Ambulância', + ['veh_menu'] = 'véhicule', + ['veh_spawn'] = 'Aperte ~INPUT_CONTEXT~ para pegar veiculo', + ['store_veh'] = 'Aperte ~INPUT_CONTEXT~ para guardar Veiculo ', + ['ambulance'] = 'Ambulancia', ['helicopter'] = 'Helicoptero', -- Action Menu - ['hospital'] = 'Hospital', - ['revive_inprogress'] = 'Reanimação em progresso', - ['revive_complete'] = 'Você reviveu', + ['hospital'] = 'Hôspital', + ['revive_inprogress'] = 'Reanimação em andamento', + ['revive_complete'] = 'Você ressuscitou ', ['no_players'] = 'Nenhum jogador nas proximidades', - ['no_vehicles'] = 'Nenhum veículo nas proximidades', - ['isdead'] = 'esta morto', + ['no_vehicles'] = 'Sem veículos nas proximidades', + ['isdead'] = 'Está morto', ['unconscious'] = 'Não está inconsciente', -- Boss Menu - ['deposit_society'] = 'eMS Depositou', - ['withdraw_society'] = 'eMS Sacou', + ['deposit_society'] = 'Depositar dinheiro', + ['withdraw_society'] = 'Retirar dinheiro da empresa', + ['boss_actions'] = 'Menu Administração', -- Misc - ['invalid_amount'] = '~r~quantidade inválida', - ['open_menu'] = 'Pressione ~INPUT_CONTEXT~ para abrir o menu', - ['deposit_amount'] = 'Quantidade para deposito', - ['money_withdraw'] = 'Quantidade para sacar', + ['invalid_amount'] = '~r~Quantidade inválida', + ['open_menu'] = 'Aperte ~INPUT_CONTEXT~ para abrir o menu', + ['deposit_amount'] = 'Quantidade inválida para deposito', + ['money_withdraw'] = 'Quantidade a ser retirada', + ['fast_travel'] = 'Aperte ~INPUT_CONTEXT~ para mover-se rapidamente.', + ['open_pharmacy'] = 'Aperte ~INPUT_CONTEXT~ para abrir a farmácia.', + ['pharmacy_menu_title'] = 'Farmácia', + ['pharmacy_take'] = 'Tomar', + ['medikit'] = 'Seringa', + ['bandage'] = 'Vendagem', + ['max_item'] = 'você já carrega o suficiente sobre você.', -- F6 Menu - ['ems_menu'] = 'eMS Menu', - ['ems_menu_title'] = 'Paramedico - EMS Menu', - ['ems_menu_revive'] = 'Reviver jogador', - ['ems_menu_putincar'] = 'Colocar no veículo', + ['ems_menu'] = 'Interação com cidadão', + ['ems_menu_title'] = 'Ambulância - Interação com cidadão', + ['ems_menu_revive'] = 'Reanimar', + ['ems_menu_putincar'] = 'Colocar no veiculo', + ['ems_menu_small'] = 'Curar pequenas feridas', + ['ems_menu_big'] = 'Tratando lesões graves', -- Phone - ['alert_ambulance'] = 'ambulância de alerta', + ['alert_ambulance'] = 'Alerta Socorro', -- Death - ['respawn_at_hospital'] = 'você quer ser transportado para o hospital?', - ['yes'] = 'sim', - ['please_wait'] = 'por favor, espere ~b~', + ['respawn_at_hospital'] = 'Você quer ser transportado para o hospital ?', + ['yes'] = 'Sim', + ['please_wait'] = 'Você será automaticamente transportado para o hospital em ~b~', ['minutes'] = ' minutos ', - ['seconds_fine'] = ' segundos ~w~para respawn \nRespawn agora para ~g~$', - ['seconds'] = ' segundos ~w~para respawn.', - ['press_respawn_fine'] = '~w~ [Pressione ~b~E~w~]', - ['press_respawn'] = 'pressione [~b~E~w~] para respawn.', + ['seconds_fine'] = ' segundos ~w~ para renascer \nRenascer agora ~g~$', + ['seconds'] = ' segundos ~w~.', + ['press_respawn_fine'] = 'Você pagará ~g~', + ['press_respawn'] = 'Aperte [~b~E~w~] para renascer.', -- Revive ['revive_help'] = 'reviver um jogador', + -- Item + ['used_medikit'] = 'você usou 1x Seringa', + ['used_bandage'] = 'você usou 1x Vendagem', + ['not_enough_medikit'] = 'Você não tem ~b~Seringa~w~.', + ['not_enough_bandage'] = 'Você não tem ~b~Vendagem~w~.', + ['healed'] = 'Você foi tratado.', + -- Misc } diff --git a/locales/en.lua b/locales/en.lua index 780b0a71..5eb7177f 100644 --- a/locales/en.lua +++ b/locales/en.lua @@ -43,12 +43,12 @@ Locales['en'] = { -- Phone ['alert_ambulance'] = 'alert Ambulance', -- Death - ['respawn_at_hospital'] = 'do you want to be transported to the hospital?', + ['respawn_at_hospital'] = 'do you want to force respawn and spawn in the hospital?', ['yes'] = 'yes', - ['please_wait'] = 'please wait ~b~', + ['please_wait'] = 'You are unconscious and will bleed out in ~b~', ['minutes'] = ' minutes ', - ['seconds_fine'] = ' seconds ~w~to respawn \nRespawn now for ~g~$', - ['seconds'] = ' seconds ~w~to respawn.', + ['seconds_fine'] = ' seconds ~w~to respawn \nForce respawn now by pressing ~g~$', + ['seconds'] = ' seconds', ['press_respawn_fine'] = '~w~ [Press ~b~E~w~]', ['press_respawn'] = 'press [~b~E~w~] to respawn.', -- Revive diff --git a/locales/sv.lua b/locales/sv.lua new file mode 100644 index 00000000..7238230c --- /dev/null +++ b/locales/sv.lua @@ -0,0 +1,63 @@ +Locales['sv'] = { + -- Cloakroom + ['cloakroom'] = 'Omklädnignsrum', + ['ems_clothes_civil'] = 'Civilkläder', + ['ems_clothes_ems'] = 'Ambulanskläder', + -- Vehicles + ['veh_menu'] = 'Fordon', + ['veh_spawn'] = 'Tryck ~INPUT_CONTEXT~ för att ta fram ett fordon', + ['store_veh'] = 'Tryck ~INPUT_CONTEXT~ för att lagra fordonet', + ['ambulance'] = 'Ambulans', + ['helicopter'] = 'Helikopter', + -- Action Menu + ['hospital'] = 'Sjukhus', + ['revive_inprogress'] = 'Återupplivning pågår...', + ['revive_complete'] = 'Du har återupplivat ~y~%s~w~ och tjärnat ~g~$2000~w~ i processen, bra jobbat!', + ['no_players'] = 'Inga spelare i närheten!', + ['no_vehicles'] = 'Inga fordon i närheten!', + ['isdead'] = 'är död', + ['unconscious'] = 'är medvetslös', + -- Boss Menu + ['deposit_society'] = 'Sjukvårdens insättning', + ['withdraw_society'] = 'Sjukvårdens uttagning', + ['boss_actions'] = 'Chef meny', + -- Misc + ['invalid_amount'] = '~r~Ogiltig mängd', + ['open_menu'] = 'Teyck ~INPUT_CONTEXT~ för att öppna menyn', + ['deposit_amount'] = 'Mängd att sätta in', + ['money_withdraw'] = 'Mängd att ta ut', + ['fast_travel'] = 'Tryck på ~INPUT_CONTEXT~ för att snabbresa.', + ['open_pharmacy'] = 'Tryck på ~INPUT_CONTEXT~ för att öppna apoteket.', + ['pharmacy_menu_title'] = 'Apotek', + ['pharmacy_take'] = 'Ta', + ['medikit'] = 'Medicinkit', + ['bandage'] = 'Bandage', + ['max_item'] = 'Du har redan tillräckligt mycket på dig.', + -- F6 Menu + ['ems_menu'] = 'Ambulansmeny', + ['ems_menu_title'] = 'Ambulansmeny', + ['ems_menu_revive'] = 'Återuppliva spelare', + ['ems_menu_putincar'] = 'Sätt i fordon', + ['ems_menu_small'] = 'Behandla mindre skador', + ['ems_menu_big'] = 'Behandla svåra skador', + -- Phone + ['alert_ambulance'] = 'Ring ambulansen', + -- Death + ['respawn_at_hospital'] = 'Vill du snabbresa till sjukhuset?', + ['yes'] = 'Ja!', + ['please_wait'] = 'Du är medvetslös och kommer att dö om ~b~', + ['minutes'] = ' minuter ', + ['seconds_fine'] = ' sekunder ~w~till respawn \nForce respawna nu genom att trycka på ~g~$', + ['seconds'] = ' sekunder', + ['press_respawn_fine'] = '~w~ [Tryck ~b~E~w~]', + ['press_respawn'] = 'Tryck [~b~E~w~] för att respawna.', + -- Revive + ['revive_help'] = 'Återuppliva en spelare', + -- Item + ['used_medikit'] = 'Du har använt 1x Medecinkit', + ['used_bandage'] = 'Du har använt 1x Bandage', + ['not_enough_medikit'] = 'Du har inget ~b~Medecinkit~w~.', + ['not_enough_bandage'] = 'Du har inget ~b~Bandage~w~.', + ['healed'] = 'Du har blivit upplivad.', + -- Misc +} From 12e1963e992cad755cced6731f1b89bb179c8509 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Tue, 10 Apr 2018 20:29:43 +0200 Subject: [PATCH 067/177] Added revive reward ($700) --- config.lua | 1 + server/main.lua | 42 +++++++++++++++++++++++------------------- 2 files changed, 24 insertions(+), 19 deletions(-) diff --git a/config.lua b/config.lua index acd002bd..baaecda1 100644 --- a/config.lua +++ b/config.lua @@ -2,6 +2,7 @@ Config = {} Config.DrawDistance = 100.0 Config.MarkerColor = { r = 102, g = 0, b = 102 } Config.MarkerSize = { x = 1.5, y = 1.5, z = 1.0 } +Config.ReviveReward = 700 local second = 1000 local minute = 60 * second diff --git a/server/main.lua b/server/main.lua index 014bca39..6229ad4a 100644 --- a/server/main.lua +++ b/server/main.lua @@ -4,7 +4,11 @@ TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) RegisterServerEvent('esx_ambulancejob:revive') AddEventHandler('esx_ambulancejob:revive', function(target) - TriggerClientEvent('esx_ambulancejob:revive', target) + local _source = source + local xPlayer = ESX.GetPlayerFromId(_source) + + xPlayer.addMoney(Config.ReviveReward) + TriggerClientEvent('esx_ambulancejob:revive', target) end) RegisterServerEvent('esx_ambulancejob:heal') @@ -17,8 +21,8 @@ TriggerEvent('esx_phone:registerNumber', 'ambulance', _U('alert_ambulance'), tru TriggerEvent('esx_society:registerSociety', 'ambulance', 'Ambulance', 'society_ambulance', 'society_ambulance', 'society_ambulance', {type = 'public'}) ESX.RegisterServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function(source, cb) - local _source = source - local xPlayer = ESX.GetPlayerFromId(_source) + + local xPlayer = ESX.GetPlayerFromId(source) if Config.RemoveCashAfterRPDeath then @@ -55,8 +59,7 @@ ESX.RegisterServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function( end) ESX.RegisterServerCallback('esx_ambulancejob:getItemAmount', function(source, cb, item) - local _source = source - local xPlayer = ESX.GetPlayerFromId(_source) + local xPlayer = ESX.GetPlayerFromId(source) local qtty = xPlayer.getInventoryItem(item).count cb(qtty) end) @@ -90,30 +93,31 @@ AddEventHandler('esx_ambulancejob:giveItem', function(item) end end) - TriggerEvent('es:addGroupCommand', 'revive', 'admin', function(source, args, user) - print('revive by /revive') - if args[1] ~= nil then - TriggerClientEvent('esx_ambulancejob:revive', tonumber(args[1])) - else - TriggerClientEvent('esx_ambulancejob:revive', source) - end + if args[1] ~= nil then + if GetPlayerName(tonumber(args[1])) ~= nil then + print('esx_ambulancejob: ' .. GetPlayerName(source) .. ' is reviving a player!') + TriggerClientEvent('esx_ambulancejob:revive', tonumber(args[1])) + end + else + TriggerClientEvent('esx_ambulancejob:revive', source) + end end, function(source, args, user) - TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "Insufficient Permissions.") + TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "Insufficient Permissions.") end, {help = _U('revive_help'), params = {{name = 'id'}}}) ESX.RegisterUsableItem('medikit', function(source) local _source = source - local xPlayer = ESX.GetPlayerFromId(_source) + local xPlayer = ESX.GetPlayerFromId(_source) xPlayer.removeInventoryItem('medikit', 1) - TriggerClientEvent('esx_ambulancejob:heal', source, 'big') - TriggerClientEvent('esx:showNotification', source, _U('used_medikit')) + TriggerClientEvent('esx_ambulancejob:heal', _source, 'big') + TriggerClientEvent('esx:showNotification', _source, _U('used_medikit')) end) ESX.RegisterUsableItem('bandage', function(source) local _source = source - local xPlayer = ESX.GetPlayerFromId(_source) + local xPlayer = ESX.GetPlayerFromId(_source) xPlayer.removeInventoryItem('bandage', 1) - TriggerClientEvent('esx_ambulancejob:heal', source, 'small') - TriggerClientEvent('esx:showNotification', source, _U('used_bandage')) + TriggerClientEvent('esx_ambulancejob:heal', _source, 'small') + TriggerClientEvent('esx:showNotification', _source, _U('used_bandage')) end) From be480476b17ac57a67ed1ed10d6d8d89084c111d Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Sat, 14 Apr 2018 14:25:00 +0200 Subject: [PATCH 068/177] Use new trigger, fixed urls in readme --- README.md | 12 +++++------- client/main.lua | 9 ++------- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 8701fc26..b763c909 100644 --- a/README.md +++ b/README.md @@ -1,27 +1,25 @@ -# fxserver-esx_ambulancejob -FXServer ESX Ambulance Job +# esx_ambulancejob [REQUIREMENTS] * Auto mode - - esx_skin => https://github.com/FXServer-ESX/fxserver-esx_skin - + - [esx_skin](https://github.com/ESX-Org/esx_skin) + * Player management (boss actions **There is no way to earn money for now**) - * esx_society => https://github.com/FXServer-ESX/fxserver-esx_society + - [esx_society](https://github.com/ESX-Org/esx_society) [INSTALLATION] 1) CD in your resources/[esx] folder 2) Clone the repository ``` -git clone https://github.com/FXServer-ESX/fxserver-esx_ambulancejob esx_ambulancejob +git clone [esx_ambulancejob](https://github.com/ESX-Org/esx_ambulancejob) ``` 3) Import esx_ambulancejob.sql in your database 4) Add this in your server.cfg : ``` -start baseevents start esx_ambulancejob ``` 5) * If you want player management you have to set Config.EnablePlayerManagement to true in config.lua diff --git a/client/main.lua b/client/main.lua index f8cdeaa1..3a04bd39 100644 --- a/client/main.lua +++ b/client/main.lua @@ -58,7 +58,6 @@ AddEventHandler('esx_ambulancejob:heal', function(_type) ESX.ShowNotification(_U('healed')) end) - function StartRespawnToHospitalMenuTimer() ESX.SetTimeout(Config.MenuRespawnToHospitalDelay, function() if IsDead then @@ -621,12 +620,8 @@ AddEventHandler('esx_phone:loaded', function(phoneNumber, contacts) end) -AddEventHandler('baseevents:onPlayerDied', function(killerType, coords) - OnPlayerDeath() -end) - -AddEventHandler('baseevents:onPlayerKilled', function(killerId, data) - OnPlayerDeath() +AddEventHandler('esx:onPlayerDeath', function() + OnPlayerDeath() end) RegisterNetEvent('esx_ambulancejob:revive') From 65100a8abd844a0ae0d90152cb1b09f379a5c8ed Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Sat, 14 Apr 2018 23:22:09 +0200 Subject: [PATCH 069/177] Implemented anti-combat log --- client/main.lua | 109 ++++++++++++++------------- esx_ambulancejob.sql | 2 + localization/de_esx_ambulancejob.sql | 2 + localization/en_esx_ambulancejob.sql | 2 + server/main.lua | 25 ++++++ 5 files changed, 87 insertions(+), 53 deletions(-) diff --git a/client/main.lua b/client/main.lua index 3a04bd39..9212e52c 100644 --- a/client/main.lua +++ b/client/main.lua @@ -103,7 +103,7 @@ function ShowTimer() Citizen.CreateThread(function() while timer > 0 and IsDead do - Wait(0) + Citizen.Wait(0) raw_seconds = timer/1000 raw_minutes = raw_seconds/60 @@ -142,7 +142,7 @@ function ShowTimer() if Config.EarlyRespawn then while timer <= 0 and IsDead do - Wait(0) + Citizen.Wait(0) SetTextFont(4) SetTextProportional(0) @@ -161,7 +161,7 @@ function ShowTimer() if IsControlPressed(0, Keys['E']) then RemoveItemsAfterRPDeath() - break + break end end end @@ -170,10 +170,11 @@ function ShowTimer() end function RemoveItemsAfterRPDeath() + TriggerServerEvent('esx_ambulancejob:setDeathStatus', 0) Citizen.CreateThread(function() DoScreenFadeOut(800) while not IsScreenFadedOut() do - Citizen.Wait(0) + Citizen.Wait(1) end ESX.TriggerServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function() @@ -191,15 +192,17 @@ function RemoveItemsAfterRPDeath() end function OnPlayerDeath() - IsDead = true - if Config.ShowDeathTimer == true then - ShowTimer() - end - StartRespawnTimer() - if Config.RespawnToHospitalMenuTimer == true then - StartRespawnToHospitalMenuTimer() - end - StartScreenEffect('DeathFailOut', 0, false) + IsDead = true + TriggerServerEvent('esx_ambulancejob:setDeathStatus', 1) + + if Config.ShowDeathTimer == true then + ShowTimer() + end + StartRespawnTimer() + if Config.RespawnToHospitalMenuTimer == true then + StartRespawnToHospitalMenuTimer() + end + StartScreenEffect('DeathFailOut', 0, false) end function TeleportFadeEffect(entity, coords) @@ -318,8 +321,8 @@ function OpenMobileAmbulanceActionsMenu() title = _U('ems_menu_title'), elements = { {label = _U('ems_menu_revive'), value = 'revive'}, - {label = _U('ems_menu_small'), value = 'small'}, - {label = _U('ems_menu_big'), value = 'big'}, + {label = _U('ems_menu_small'), value = 'small'}, + {label = _U('ems_menu_big'), value = 'big'}, {label = _U('ems_menu_putincar'), value = 'put_in_vehicle'}, } }, @@ -587,14 +590,13 @@ function OpenPharmacyMenu() end AddEventHandler('playerSpawned', function() + IsDead = false - IsDead = false - - if FirstSpawn then - exports.spawnmanager:setAutoSpawn(false) - FirstSpawn = false - end - + if FirstSpawn then + TriggerServerEvent('esx_ambulancejob:firstSpawn') + exports.spawnmanager:setAutoSpawn(false) -- disable respawn + FirstSpawn = false + end end) RegisterNetEvent('esx:playerLoaded') @@ -629,7 +631,8 @@ AddEventHandler('esx_ambulancejob:revive', function() local playerPed = GetPlayerPed(-1) local coords = GetEntityCoords(playerPed) - + TriggerServerEvent('esx_ambulancejob:setDeathStatus', 0) + Citizen.CreateThread(function() DoScreenFadeOut(800) @@ -696,25 +699,25 @@ AddEventHandler('esx_ambulancejob:hasEnteredMarker', function(zone) TeleportFadeEffect(GetPlayerPed(-1), Config.Zones.HospitalInteriorOutside2.Pos) end - if zone == 'ParkingDoorGoOutInside' then - TeleportFadeEffect(GetPlayerPed(-1), Config.Zones.ParkingDoorGoOutOutside.Pos) - end + if zone == 'ParkingDoorGoOutInside' then + TeleportFadeEffect(GetPlayerPed(-1), Config.Zones.ParkingDoorGoOutOutside.Pos) + end - if zone == 'ParkingDoorGoInOutside' then - TeleportFadeEffect(GetPlayerPed(-1), Config.Zones.ParkingDoorGoInInside.Pos) - end + if zone == 'ParkingDoorGoInOutside' then + TeleportFadeEffect(GetPlayerPed(-1), Config.Zones.ParkingDoorGoInInside.Pos) + end - if zone == 'StairsGoTopBottom' then - CurrentAction = 'fast_travel_goto_top' - CurrentActionMsg = _U('fast_travel') - CurrentActionData = {pos = Config.Zones.StairsGoTopTop.Pos} - end + if zone == 'StairsGoTopBottom' then + CurrentAction = 'fast_travel_goto_top' + CurrentActionMsg = _U('fast_travel') + CurrentActionData = {pos = Config.Zones.StairsGoTopTop.Pos} + end - if zone == 'StairsGoBottomTop' then - CurrentAction = 'fast_travel_goto_bottom' - CurrentActionMsg = _U('fast_travel') - CurrentActionData = {pos = Config.Zones.StairsGoBottomBottom.Pos} - end + if zone == 'StairsGoBottomTop' then + CurrentAction = 'fast_travel_goto_bottom' + CurrentActionMsg = _U('fast_travel') + CurrentActionData = {pos = Config.Zones.StairsGoBottomBottom.Pos} + end if zone == 'AmbulanceActions' then CurrentAction = 'ambulance_actions_menu' @@ -728,11 +731,11 @@ AddEventHandler('esx_ambulancejob:hasEnteredMarker', function(zone) CurrentActionData = {} end - if zone == 'Pharmacy' then - CurrentAction = 'pharmacy' - CurrentActionMsg = _U('open_pharmacy') - CurrentActionData = {} - end + if zone == 'Pharmacy' then + CurrentAction = 'pharmacy' + CurrentActionMsg = _U('open_pharmacy') + CurrentActionData = {} + end if zone == 'VehicleDeleter' then @@ -790,7 +793,7 @@ end) -- Display markers Citizen.CreateThread(function() while true do - Wait(0) + Citizen.Wait(0) local coords = GetEntityCoords(GetPlayerPed(-1)) for k,v in pairs(Config.Zones) do @@ -809,7 +812,7 @@ end) -- Activate menu when player is inside marker Citizen.CreateThread(function() while true do - Wait(0) + Citizen.Wait(0) local coords = GetEntityCoords(GetPlayerPed(-1)) local isInMarker = false local currentZone = nil @@ -843,7 +846,7 @@ end) Citizen.CreateThread(function() while true do - Citizen.Wait(0) + Citizen.Wait(10) if CurrentAction ~= nil then @@ -861,13 +864,13 @@ Citizen.CreateThread(function() OpenVehicleSpawnerMenu() end - if CurrentAction == 'pharmacy' then - OpenPharmacyMenu() - end + if CurrentAction == 'pharmacy' then + OpenPharmacyMenu() + end - if CurrentAction == 'fast_travel_goto_top' or CurrentAction == 'fast_travel_goto_bottom' then - FastTravel(CurrentActionData.pos) - end + if CurrentAction == 'fast_travel_goto_top' or CurrentAction == 'fast_travel_goto_bottom' then + FastTravel(CurrentActionData.pos) + end if CurrentAction == 'delete_vehicle' then if Config.EnableSocietyOwnedVehicles then diff --git a/esx_ambulancejob.sql b/esx_ambulancejob.sql index a099281c..efdf13ce 100644 --- a/esx_ambulancejob.sql +++ b/esx_ambulancejob.sql @@ -19,3 +19,5 @@ INSERT INTO `items` (name, label, `limit`) VALUES ('bandage','Bandage', 20), ('medikit','Medikit', 5) ; + +ALTER TABLE `users` ADD `isDead` BIT(1) DEFAULT b'0' \ No newline at end of file diff --git a/localization/de_esx_ambulancejob.sql b/localization/de_esx_ambulancejob.sql index d26036c2..99f13a94 100644 --- a/localization/de_esx_ambulancejob.sql +++ b/localization/de_esx_ambulancejob.sql @@ -19,3 +19,5 @@ INSERT INTO `items` (name, label, `limit`) VALUES ('bandage','Bandage', 20), ('medikit','Medikit', 5) ; + +ALTER TABLE `users` ADD `isDead` BIT(1) DEFAULT b'0' \ No newline at end of file diff --git a/localization/en_esx_ambulancejob.sql b/localization/en_esx_ambulancejob.sql index 1b9d1776..1c713441 100644 --- a/localization/en_esx_ambulancejob.sql +++ b/localization/en_esx_ambulancejob.sql @@ -19,3 +19,5 @@ INSERT INTO `items` (name, label, `limit`) VALUES ('bandage','Bandage', 20), ('medikit','Medikit', 5) ; + +ALTER TABLE `users` ADD `isDead` BIT(1) DEFAULT b'0' \ No newline at end of file diff --git a/server/main.lua b/server/main.lua index 6229ad4a..9f8780b7 100644 --- a/server/main.lua +++ b/server/main.lua @@ -121,3 +121,28 @@ ESX.RegisterUsableItem('bandage', function(source) TriggerClientEvent('esx_ambulancejob:heal', _source, 'small') TriggerClientEvent('esx:showNotification', _source, _U('used_bandage')) end) + +RegisterServerEvent('esx_ambulancejob:firstSpawn') +AddEventHandler('esx_ambulancejob:firstSpawn', function() + local _source = source + local identifier = GetPlayerIdentifiers(_source)[1] + MySQL.Async.fetchScalar('SELECT isDead FROM users WHERE identifier=@identifier', + { + ['@identifier'] = identifier + }, function(isDead) + if isDead == 1 then + print('esx_ambulancejob: ' .. GetPlayerName(_source) .. ' (' .. identifier .. ') attempted combat logging!') + TriggerClientEvent('esx_ambulancejob:requestDeath', _source) + end + end) +end) + +RegisterServerEvent('esx_ambulancejob:setDeathStatus') +AddEventHandler('esx_ambulancejob:setDeathStatus', function(isDead) + local _source = source + MySQL.Sync.execute("UPDATE users SET isDead=@isDead WHERE identifier=@identifier", + { + ['@identifier'] = GetPlayerIdentifiers(_source)[1], + ['@isDead'] = isDead + }) +end) \ No newline at end of file From 9e18a0f0c45939c3e5676fd4efa1d58476cafc54 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Sun, 15 Apr 2018 01:41:37 +0200 Subject: [PATCH 070/177] Moved anti-combat to config (enabled by default) --- client/main.lua | 8 ++++++++ config.lua | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/client/main.lua b/client/main.lua index 9212e52c..ee310ab7 100644 --- a/client/main.lua +++ b/client/main.lua @@ -893,6 +893,14 @@ Citizen.CreateThread(function() end end) +RegisterNetEvent('esx_ambulancejob:requestDeath') +AddEventHandler('esx_ambulancejob:requestDeath', function() + if Config.AntiCombatLog then + Citizen.Wait(5000) + SetEntityHealth(GetPlayerPed(-1), 0) + end +end) + -- Load unloaded IPLs Citizen.CreateThread(function() LoadMpDlcMaps() diff --git a/config.lua b/config.lua index baaecda1..2f8efb28 100644 --- a/config.lua +++ b/config.lua @@ -2,8 +2,8 @@ Config = {} Config.DrawDistance = 100.0 Config.MarkerColor = { r = 102, g = 0, b = 102 } Config.MarkerSize = { x = 1.5, y = 1.5, z = 1.0 } -Config.ReviveReward = 700 - +Config.ReviveReward = 700 -- revive reward, set to 0 if you don't want it enabled +Config.AntiCombatLog = true -- enable anti-combat logging? local second = 1000 local minute = 60 * second From bac6df219dcd45785fe69c83c18669f370d4f876 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Tue, 24 Apr 2018 20:34:09 +0200 Subject: [PATCH 071/177] Refactored vehicle list to config (closes #37), fixed restarting script, code improvements - A lot of minor changes here aswell, for example proper aligment, the menu wont close if you don't have a medkit when attempting to revive players - Moved to four space (tab) indents - Proper i18n formatting --- client/main.lua | 641 +++++++++++++++++++++++------------------------- config.lua | 194 ++++++++------- locales/br.lua | 13 +- locales/de.lua | 14 +- locales/en.lua | 15 +- locales/es.lua | 15 +- locales/fr.lua | 13 +- locales/sv.lua | 19 +- server/main.lua | 1 + 9 files changed, 451 insertions(+), 474 deletions(-) diff --git a/client/main.lua b/client/main.lua index ee310ab7..a5b82dec 100644 --- a/client/main.lua +++ b/client/main.lua @@ -25,37 +25,41 @@ ESX = nil GUI.Time = 0 Citizen.CreateThread(function() - while ESX == nil do - TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) - Citizen.Wait(0) - end + while ESX == nil do + TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) + Citizen.Wait(0) + end + + Citizen.Wait(5000) + PlayerData = ESX.GetPlayerData() end) function RespawnPed(ped, coords) - SetEntityCoordsNoOffset(ped, coords.x, coords.y, coords.z, false, false, false, true) - NetworkResurrectLocalPlayer(coords.x, coords.y, coords.z, coords.heading, true, false) - SetPlayerInvincible(ped, false) - TriggerEvent('playerSpawned', coords.x, coords.y, coords.z, coords.heading) - ClearPedBloodDamage(ped) - if RespawnToHospitalMenu ~= nil then - RespawnToHospitalMenu.close() - RespawnToHospitalMenu = nil - end - ESX.UI.Menu.CloseAll() + SetEntityCoordsNoOffset(ped, coords.x, coords.y, coords.z, false, false, false, true) + NetworkResurrectLocalPlayer(coords.x, coords.y, coords.z, coords.heading, true, false) + SetPlayerInvincible(ped, false) + TriggerEvent('playerSpawned', coords.x, coords.y, coords.z, coords.heading) + ClearPedBloodDamage(ped) + if RespawnToHospitalMenu ~= nil then + RespawnToHospitalMenu.close() + RespawnToHospitalMenu = nil + end + + ESX.UI.Menu.CloseAll() end RegisterNetEvent('esx_ambulancejob:heal') AddEventHandler('esx_ambulancejob:heal', function(_type) - local playerPed = GetPlayerPed(-1) - local maxHealth = GetEntityMaxHealth(playerPed) - if _type == 'small' then - local health = GetEntityHealth(playerPed) - local newHealth = math.min(maxHealth , math.floor(health + maxHealth/8)) - SetEntityHealth(playerPed, newHealth) - elseif _type == 'big' then - SetEntityHealth(playerPed, maxHealth) - end - ESX.ShowNotification(_U('healed')) + local playerPed = GetPlayerPed(-1) + local maxHealth = GetEntityMaxHealth(playerPed) + if _type == 'small' then + local health = GetEntityHealth(playerPed) + local newHealth = math.min(maxHealth , math.floor(health + maxHealth/8)) + SetEntityHealth(playerPed, newHealth) + elseif _type == 'big' then + SetEntityHealth(playerPed, maxHealth) + end + ESX.ShowNotification(_U('healed')) end) function StartRespawnToHospitalMenuTimer() @@ -99,74 +103,71 @@ function StartRespawnTimer() end function ShowTimer() - local timer = Config.RespawnDelayAfterRPDeath - Citizen.CreateThread(function() + local timer = Config.RespawnDelayAfterRPDeath + + Citizen.CreateThread(function() + while timer > 0 and IsDead do + Citizen.Wait(0) - while timer > 0 and IsDead do - Citizen.Wait(0) + raw_seconds = timer/1000 + raw_minutes = raw_seconds/60 + minutes = stringsplit(raw_minutes, ".")[1] + seconds = stringsplit(raw_seconds-(minutes*60), ".")[1] + + SetTextFont(4) + SetTextProportional(0) + SetTextScale(0.0, 0.5) + SetTextColour(255, 255, 255, 255) + SetTextDropshadow(0, 0, 0, 0, 255) + SetTextEdge(1, 0, 0, 0, 255) + SetTextDropShadow() + SetTextOutline() + SetTextEntry("STRING") - raw_seconds = timer/1000 - raw_minutes = raw_seconds/60 - minutes = stringsplit(raw_minutes, ".")[1] - seconds = stringsplit(raw_seconds-(minutes*60), ".")[1] + local text = _U('please_wait', minutes, seconds) - SetTextFont(4) - SetTextProportional(0) - SetTextScale(0.0, 0.5) - SetTextColour(255, 255, 255, 255) - SetTextDropshadow(0, 0, 0, 0, 255) - SetTextEdge(1, 0, 0, 0, 255) + if Config.EarlyRespawn then + text = text .. '\n[~b~E~s~]' + end - SetTextDropShadow() - SetTextOutline() - SetTextEntry("STRING") + AddTextComponentString(text) + SetTextCentre(true) + DrawText(0.5, 0.8) - local text = _U('please_wait') .. minutes .. _U('minutes') .. seconds .. _U('seconds') + if Config.EarlyRespawn then + if IsControlPressed(0, Keys['E']) then + RemoveItemsAfterRPDeath() + break + end + end + timer = timer - 15 + end - if Config.EarlyRespawn then - text = text .. '\n[~b~E~w~]' - end + if Config.EarlyRespawn then + while timer <= 0 and IsDead do + Citizen.Wait(0) - AddTextComponentString(text) - SetTextCentre(true) - DrawText(0.5, 0.8) + SetTextFont(4) + SetTextProportional(0) + SetTextScale(0.0, 0.5) + SetTextColour(255, 255, 255, 255) + SetTextDropshadow(0, 0, 0, 0, 255) + SetTextEdge(1, 0, 0, 0, 255) + SetTextDropShadow() + SetTextOutline() + SetTextEntry("STRING") - if Config.EarlyRespawn then - if IsControlPressed(0, Keys['E']) then - RemoveItemsAfterRPDeath() - break - end - end - timer = timer - 15 - end + AddTextComponentString(_U('press_respawn')) + SetTextCentre(true) + DrawText(0.5, 0.8) - if Config.EarlyRespawn then - while timer <= 0 and IsDead do - Citizen.Wait(0) - - SetTextFont(4) - SetTextProportional(0) - SetTextScale(0.0, 0.5) - SetTextColour(255, 255, 255, 255) - SetTextDropshadow(0, 0, 0, 0, 255) - SetTextEdge(1, 0, 0, 0, 255) - - SetTextDropShadow() - SetTextOutline() - SetTextEntry("STRING") - - AddTextComponentString(_U('press_respawn')) - SetTextCentre(true) - DrawText(0.5, 0.8) - - if IsControlPressed(0, Keys['E']) then - RemoveItemsAfterRPDeath() - break - end - end - end - - end) + if IsControlPressed(0, Keys['E']) then + RemoveItemsAfterRPDeath() + break + end + end + end + end) end function RemoveItemsAfterRPDeath() @@ -301,136 +302,134 @@ end function OpenMobileAmbulanceActionsMenu() - ESX.UI.Menu.CloseAll() + ESX.UI.Menu.CloseAll() - ESX.UI.Menu.Open( - 'default', GetCurrentResourceName(), 'mobile_ambulance_actions', - { - title = _U('ambulance'), - elements = { - {label = _U('ems_menu'), value = 'citizen_interaction'}, - } - }, - function(data, menu) + ESX.UI.Menu.Open( + 'default', GetCurrentResourceName(), 'mobile_ambulance_actions', + { + title = _U('ambulance'), + align = 'top-left', + elements = { + {label = _U('ems_menu'), value = 'citizen_interaction'}, + } + }, function(data, menu) + if data.current.value == 'citizen_interaction' then + ESX.UI.Menu.Open( + 'default', GetCurrentResourceName(), 'citizen_interaction', + { + title = _U('ems_menu_title'), + align = 'top-left', + elements = { + {label = _U('ems_menu_revive'), value = 'revive'}, + {label = _U('ems_menu_small'), value = 'small'}, + {label = _U('ems_menu_big'), value = 'big'}, + {label = _U('ems_menu_putincar'), value = 'put_in_vehicle'}, + } + }, function(data, menu) + if data.current.value == 'revive' then -- revive + + local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() + + if closestPlayer == -1 or closestDistance > 3.0 then + ESX.ShowNotification(_U('no_players')) + else + ESX.TriggerServerCallback('esx_ambulancejob:getItemAmount', function(qtty) + if qtty > 0 then + local closestPlayerPed = GetPlayerPed(closestPlayer) + local health = GetEntityHealth(closestPlayerPed) + + if health == 0 then + menu.close() + local playerPed = GetPlayerPed(-1) + + ESX.ShowNotification(_U('revive_inprogress')) + TaskStartScenarioInPlace(playerPed, 'CODE_HUMAN_MEDIC_TEND_TO_DEAD', 0, true) + Citizen.Wait(10000) + ClearPedTasks(playerPed) + + TriggerServerEvent('esx_ambulancejob:removeItem', 'medikit') + TriggerServerEvent('esx_ambulancejob:revive', GetPlayerServerId(closestPlayer)) + + -- Show revive award? + if Config.ReviveReward > 0 then + ESX.ShowNotification(_U('revive_complete_award', GetPlayerName(closestPlayer), Config.ReviveReward)) + else + ESX.ShowNotification(_U('revive_complete', GetPlayerName(closestPlayer))) + end + else + ESX.ShowNotification(_U('player_not_unconscious')) + end + else + ESX.ShowNotification(_U('not_enough_medikit')) + end + end, 'medikit') + end + elseif data.current.value == 'small' then + + local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() + if closestPlayer == -1 or closestDistance > 3.0 then + ESX.ShowNotification(_U('no_players')) + else + ESX.TriggerServerCallback('esx_ambulancejob:getItemAmount', function(qtty) + if qtty > 0 then + menu.close() + local playerPed = GetPlayerPed(-1) + ESX.ShowNotification(_U('heal_inprogress')) + TaskStartScenarioInPlace(playerPed, 'CODE_HUMAN_MEDIC_TEND_TO_DEAD', 0, true) + Citizen.Wait(10000) + ClearPedTasks(playerPed) + + TriggerServerEvent('esx_ambulancejob:removeItem', 'bandage') + TriggerServerEvent('esx_ambulancejob:heal', GetPlayerServerId(closestPlayer), 'small') + ESX.ShowNotification(_U('heal_complete')) + else + ESX.ShowNotification(_U('not_enough_bandage')) + end + end, 'bandage') + end + elseif data.current.value == 'big' then + + local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() + if closestPlayer == -1 or closestDistance > 3.0 then + ESX.ShowNotification(_U('no_players')) + else + ESX.TriggerServerCallback('esx_ambulancejob:getItemAmount', function(qtty) + if qtty > 0 then + menu.close() + local playerPed = GetPlayerPed(-1) + ESX.ShowNotification(_U('heal_inprogress')) + TaskStartScenarioInPlace(playerPed, 'CODE_HUMAN_MEDIC_TEND_TO_DEAD', 0, true) + Citizen.Wait(10000) + ClearPedTasks(playerPed) + TriggerServerEvent('esx_ambulancejob:removeItem', 'medikit') + TriggerServerEvent('esx_ambulancejob:heal', GetPlayerServerId(closestPlayer), 'big') + ESX.ShowNotification(_U('heal_complete')) + else + ESX.ShowNotification(_U('not_enough_medikit')) + end + end, 'medikit') + end + elseif data.current.value == 'put_in_vehicle' then + + local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() + if closestPlayer == -1 or closestDistance > 3.0 then + ESX.ShowNotification(_U('no_vehicles')) + else + menu.close() + WarpPedInClosestVehicle(GetPlayerPed(closestPlayer)) + end + end + end, function(data, menu) + menu.close() + end + ) - if data.current.value == 'citizen_interaction' then + end - ESX.UI.Menu.Open( - 'default', GetCurrentResourceName(), 'citizen_interaction', - { - title = _U('ems_menu_title'), - elements = { - {label = _U('ems_menu_revive'), value = 'revive'}, - {label = _U('ems_menu_small'), value = 'small'}, - {label = _U('ems_menu_big'), value = 'big'}, - {label = _U('ems_menu_putincar'), value = 'put_in_vehicle'}, - } - }, - function(data, menu) - - if data.current.value == 'revive' then - menu.close() - local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() - if closestPlayer == -1 or closestDistance > 3.0 then - ESX.ShowNotification(_U('no_players')) - else - ESX.TriggerServerCallback('esx_ambulancejob:getItemAmount', function(qtty) - if qtty > 0 then - local closestPlayerPed = GetPlayerPed(closestPlayer) - local health = GetEntityHealth(closestPlayerPed) - if health == 0 then - local playerPed = GetPlayerPed(-1) - Citizen.CreateThread(function() - ESX.ShowNotification(_U('revive_inprogress')) - TaskStartScenarioInPlace(playerPed, 'CODE_HUMAN_MEDIC_TEND_TO_DEAD', 0, true) - Wait(10000) - ClearPedTasks(playerPed) - if GetEntityHealth(closestPlayerPed) == 0 then - TriggerServerEvent('esx_ambulancejob:removeItem', 'medikit') - TriggerServerEvent('esx_ambulancejob:revive', GetPlayerServerId(closestPlayer)) - ESX.ShowNotification(_U('revive_complete')) - else - ESX.ShowNotification(_U('isdead')) - end - end) - else - ESX.ShowNotification(_U('unconscious')) - end - else - ESX.ShowNotification(_U('not_enough_medikit')) - end - end, 'medikit') - end - end - - if data.current.value == 'small' then - menu.close() - local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() - if closestPlayer == -1 or closestDistance > 3.0 then - ESX.ShowNotification(_U('no_players')) - else - ESX.TriggerServerCallback('esx_ambulancejob:getItemAmount', function(qtty) - if qtty > 0 then - local playerPed = GetPlayerPed(-1) - Citizen.CreateThread(function() - ESX.ShowNotification(_U('heal_inprogress')) - TaskStartScenarioInPlace(playerPed, 'CODE_HUMAN_MEDIC_TEND_TO_DEAD', 0, true) - Wait(10000) - ClearPedTasks(playerPed) - TriggerServerEvent('esx_ambulancejob:removeItem', 'bandage') - TriggerServerEvent('esx_ambulancejob:heal', GetPlayerServerId(closestPlayer), 'small') - ESX.ShowNotification(_U('heal_complete')) - end) - else - ESX.ShowNotification(_U('not_enough_bandage')) - end - end, 'bandage') - end - end - - if data.current.value == 'big' then - menu.close() - local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() - if closestPlayer == -1 or closestDistance > 3.0 then - ESX.ShowNotification(_U('no_players')) - else - ESX.TriggerServerCallback('esx_ambulancejob:getItemAmount', function(qtty) - if qtty > 0 then - local playerPed = GetPlayerPed(-1) - Citizen.CreateThread(function() - ESX.ShowNotification(_U('heal_inprogress')) - TaskStartScenarioInPlace(playerPed, 'CODE_HUMAN_MEDIC_TEND_TO_DEAD', 0, true) - Wait(10000) - ClearPedTasks(playerPed) - TriggerServerEvent('esx_ambulancejob:removeItem', 'medikit') - TriggerServerEvent('esx_ambulancejob:heal', GetPlayerServerId(closestPlayer), 'big') - ESX.ShowNotification(_U('heal_complete')) - end) - else - ESX.ShowNotification(_U('not_enough_medikit')) - end - end, 'medikit') - end - end - - if data.current.value == 'put_in_vehicle' then - menu.close() - WarpPedInClosestVehicle(GetPlayerPed(closestPlayer)) - end - - end, - function(data, menu) - menu.close() - end - ) - - end - - end, - function(data, menu) - menu.close() - end - ) + end, function(data, menu) + menu.close() + end + ) end @@ -486,107 +485,90 @@ end function OpenVehicleSpawnerMenu() - ESX.UI.Menu.CloseAll() + ESX.UI.Menu.CloseAll() - if Config.EnableSocietyOwnedVehicles then + if Config.EnableSocietyOwnedVehicles then - local elements = {} + local elements = {} - ESX.TriggerServerCallback('esx_society:getVehiclesInGarage', function(vehicles) + ESX.TriggerServerCallback('esx_society:getVehiclesInGarage', function(vehicles) - for i=1, #vehicles, 1 do - table.insert(elements, {label = GetDisplayNameFromVehicleModel(vehicles[i].model) .. ' [' .. vehicles[i].plate .. ']', value = vehicles[i]}) - end + for i=1, #vehicles, 1 do + table.insert(elements, {label = GetDisplayNameFromVehicleModel(vehicles[i].model) .. ' [' .. vehicles[i].plate .. ']', value = vehicles[i]}) + end - ESX.UI.Menu.Open( - 'default', GetCurrentResourceName(), 'vehicle_spawner', - { - title = _U('veh_menu'), - align = 'top-left', - elements = elements, - }, - function(data, menu) + ESX.UI.Menu.Open( + 'default', GetCurrentResourceName(), 'vehicle_spawner', + { + title = _U('veh_menu'), + align = 'top-left', + elements = elements, + }, function(data, menu) + menu.close() - menu.close() - - local vehicleProps = data.current.value - - ESX.Game.SpawnVehicle(vehicleProps.model, Config.Zones.VehicleSpawnPoint.Pos, 270.0, function(vehicle) - ESX.Game.SetVehicleProperties(vehicle, vehicleProps) - local playerPed = GetPlayerPed(-1) - TaskWarpPedIntoVehicle(playerPed, vehicle, -1) - end) - - TriggerServerEvent('esx_society:removeVehicleFromGarage', 'ambulance', vehicleProps) - - end, - function(data, menu) - - menu.close() - - CurrentAction = 'vehicle_spawner_menu' - CurrentActionMsg = _U('veh_spawn') - CurrentActionData = {} - - end - ) - - end, 'ambulance') - - else - - ESX.UI.Menu.Open( - 'default', GetCurrentResourceName(), 'vehicle_spawner', - { - title = _U('veh_menu'), - align = 'top-left', - elements = { - {label = _U('ambulance'), value = 'ambulance'} - }, - }, - function(data, menu) - menu.close() - local model = data.current.value - ESX.Game.SpawnVehicle(model, Config.Zones.VehicleSpawnPoint.Pos, 230.0, function(vehicle) - local playerPed = GetPlayerPed(-1) - TaskWarpPedIntoVehicle(playerPed, vehicle, -1) - end) - end, - function(data, menu) - menu.close() - CurrentAction = 'vehicle_spawner_menu' - CurrentActionMsg = _U('veh_spawn') - CurrentActionData = {} - end - ) - - end + local vehicleProps = data.current.value + ESX.Game.SpawnVehicle(vehicleProps.model, Config.Zones.VehicleSpawnPoint.Pos, 270.0, function(vehicle) + ESX.Game.SetVehicleProperties(vehicle, vehicleProps) + local playerPed = GetPlayerPed(-1) + TaskWarpPedIntoVehicle(playerPed, vehicle, -1) + end) + TriggerServerEvent('esx_society:removeVehicleFromGarage', 'ambulance', vehicleProps) + + end, function(data, menu) + menu.close() + CurrentAction = 'vehicle_spawner_menu' + CurrentActionMsg = _U('veh_spawn') + CurrentActionData = {} + end + ) + end, 'ambulance') + + else -- not society vehicles + ESX.UI.Menu.Open( + 'default', GetCurrentResourceName(), 'vehicle_spawner', + { + title = _U('veh_menu'), + align = 'top-left', + elements = Config.AuthorizedVehicles + }, function(data, menu) + menu.close() + ESX.Game.SpawnVehicle(data.current.model, Config.Zones.VehicleSpawnPoint.Pos, 230.0, function(vehicle) + local playerPed = GetPlayerPed(-1) + TaskWarpPedIntoVehicle(playerPed, vehicle, -1) + end) + end, function(data, menu) + menu.close() + CurrentAction = 'vehicle_spawner_menu' + CurrentActionMsg = _U('veh_spawn') + CurrentActionData = {} + end + ) + end end function OpenPharmacyMenu() - ESX.UI.Menu.CloseAll() + ESX.UI.Menu.CloseAll() - ESX.UI.Menu.Open( - 'default', GetCurrentResourceName(), 'pharmacy', - { - title = _U('pharmacy_menu_title'), - align = 'top-left', - elements = { - {label = _U('pharmacy_take') .. ' ' .. _('medikit'), value = 'medikit'}, - {label = _U('pharmacy_take') .. ' ' .. _('bandage'), value = 'bandage'} - }, - }, - function(data, menu) - TriggerServerEvent('esx_ambulancejob:giveItem', data.current.value) - end, - function(data, menu) - menu.close() - CurrentAction = 'pharmacy' - CurrentActionMsg = _U('open_pharmacy') - CurrentActionData = {} - end - ) + ESX.UI.Menu.Open( + 'default', GetCurrentResourceName(), 'pharmacy', + { + title = _U('pharmacy_menu_title'), + align = 'top-left', + elements = { + {label = _U('pharmacy_take') .. ' ' .. _('medikit'), value = 'medikit'}, + {label = _U('pharmacy_take') .. ' ' .. _('bandage'), value = 'bandage'} + }, + }, function(data, menu) + TriggerServerEvent('esx_ambulancejob:giveItem', data.current.value) + + end, function(data, menu) + menu.close() + CurrentAction = 'pharmacy' + CurrentActionMsg = _U('open_pharmacy') + CurrentActionData = {} + end + ) end AddEventHandler('playerSpawned', function() @@ -811,35 +793,36 @@ end) -- Activate menu when player is inside marker Citizen.CreateThread(function() - while true do - Citizen.Wait(0) - local coords = GetEntityCoords(GetPlayerPed(-1)) - local isInMarker = false - local currentZone = nil - for k,v in pairs(Config.Zones) do - if PlayerData.job ~= nil and PlayerData.job.name == 'ambulance' then - if(GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < Config.MarkerSize.x) then - isInMarker = true - currentZone = k - end - elseif k ~= 'AmbulanceActions' and k ~= 'VehicleSpawner' and k ~= 'VehicleDeleter' - and k ~= 'Pharmacy' and k ~= 'StairsGoTopBottom' and k ~= 'StairsGoBottomTop' then - if(GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < Config.MarkerSize.x) then - isInMarker = true - currentZone = k - end - end - end - if isInMarker and not hasAlreadyEnteredMarker then - hasAlreadyEnteredMarker = true - lastZone = currentZone - TriggerEvent('esx_ambulancejob:hasEnteredMarker', currentZone) - end - if not isInMarker and hasAlreadyEnteredMarker then - hasAlreadyEnteredMarker = false - TriggerEvent('esx_ambulancejob:hasExitedMarker', lastZone) - end - end + while true do + Citizen.Wait(10) + + local coords = GetEntityCoords(GetPlayerPed(-1)) + local isInMarker = false + local currentZone = nil + for k,v in pairs(Config.Zones) do + if PlayerData.job ~= nil and PlayerData.job.name == 'ambulance' then + if(GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < Config.MarkerSize.x) then + isInMarker = true + currentZone = k + end + elseif k ~= 'AmbulanceActions' and k ~= 'VehicleSpawner' and k ~= 'VehicleDeleter' and k ~= 'Pharmacy' and k ~= 'StairsGoTopBottom' and k ~= 'StairsGoBottomTop' then + if(GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < Config.MarkerSize.x) then + isInMarker = true + currentZone = k + end + end + end + if isInMarker and not hasAlreadyEnteredMarker then + hasAlreadyEnteredMarker = true + lastZone = currentZone + TriggerEvent('esx_ambulancejob:hasEnteredMarker', currentZone) + end + + if not isInMarker and hasAlreadyEnteredMarker then + hasAlreadyEnteredMarker = false + TriggerEvent('esx_ambulancejob:hasExitedMarker', lastZone) + end + end end) -- Key Controls diff --git a/config.lua b/config.lua index 2f8efb28..1ce952f5 100644 --- a/config.lua +++ b/config.lua @@ -26,7 +26,7 @@ Config.RemoveItemsAfterRPDeath = true -- Will display a timer that shows RespawnDelayAfterRPDeath time remaining Config.ShowDeathTimer = true --- Will allow to respawn at any time, don't use RespawnToHospitalMenuTimer at the same time ! +-- Will allow to respawn at any time, don't use with RespawnToHospitalMenuTimer enabled! Config.EarlyRespawn = false -- The player can have a fine (on bank account) Config.RespawnFine = false @@ -35,123 +35,133 @@ Config.RespawnFineAmount = 500 Config.Locale = 'fr' Config.Blip = { - Pos = { x = 307.76, y = -1433.47, z = 28.97 }, - Sprite = 61, - Display = 4, - Scale = 1.2, - Colour = 2, + Pos = { x = 307.76, y = -1433.47, z = 28.97 }, + Sprite = 61, + Display = 4, + Scale = 1.2, + Colour = 2, } Config.HelicopterSpawner = { - SpawnPoint = { x = 313.33, y = -1465.2, z = 45.5 }, - Heading = 0.0 + SpawnPoint = { x = 313.33, y = -1465.2, z = 45.5 }, + Heading = 0.0 +} + +-- https://wiki.fivem.net/wiki/Vehicles +Config.AuthorizedVehicles = { + + { + model = 'ambulance', + label = 'Ambulance' + } + } Config.Zones = { - HospitalInteriorEntering1 = { -- ok - Pos = { x = 294.6, y = -1448.01, z = 28.9 }, - Type = 1 - }, + HospitalInteriorEntering1 = { -- Main entrance + Pos = { x = 294.2, y = -1448.60, z = 29.0 }, + Type = 1 + }, - HospitalInteriorInside1 = { -- ok - Pos = { x = 272.8, y = -1358.8, z = 23.5 }, - Type = -1 - }, + HospitalInteriorInside1 = { + Pos = { x = 272.8, y = -1358.8, z = 23.5 }, + Type = -1 + }, - HospitalInteriorOutside1 = { -- ok - Pos = { x = 295.8, y = -1446.5, z = 28.9 }, - Type = -1 - }, + HospitalInteriorOutside1 = { + Pos = { x = 295.8, y = -1446.5, z = 28.9 }, + Type = -1 + }, - HospitalInteriorExit1 = { -- ok - Pos = { x = 275.7, y = -1361.5, z = 23.5 }, - Type = 1 - }, + HospitalInteriorExit1 = { + Pos = { x = 275.7, y = -1361.5, z = 23.5 }, + Type = 1 + }, - HospitalInteriorEntering2 = { -- Ascenseur aller au toit - Pos = { x = 247.1, y = -1371.4, z = 23.5 }, - Type = 1 - }, + HospitalInteriorEntering2 = { -- Lift go to the roof + Pos = { x = 247.1, y = -1371.4, z = 23.5 }, + Type = 1 + }, - HospitalInteriorInside2 = { -- Toit sortie - Pos = { x = 333.1, y = -1434.9, z = 45.5 }, - Type = -1 - }, + HospitalInteriorInside2 = { -- Roof outlet + Pos = { x = 333.1, y = -1434.9, z = 45.5 }, + Type = -1 + }, - HospitalInteriorOutside2 = { -- Ascenseur retour depuis toit - Pos = { x = 249.1, y = -1369.6, z = 23.5 }, - Type = -1 - }, + HospitalInteriorOutside2 = { -- Lift back from roof + Pos = { x = 249.1, y = -1369.6, z = 23.5 }, + Type = -1 + }, - HospitalInteriorExit2 = { -- Toit entrée - Pos = { x = 335.5, y = -1432.0, z = 45.5 }, - Type = 1 - }, + HospitalInteriorExit2 = { -- Roof entrance + Pos = { x = 335.5, y = -1432.0, z = 45.5 }, + Type = 1 + }, - AmbulanceActions = { -- CLOACKROOM - Pos = { x = 268.4, y = -1363.330, z = 23.5 }, - Type = 1 - }, + AmbulanceActions = { -- Cloakroom + Pos = { x = 268.4, y = -1363.330, z = 23.5 }, + Type = 1 + }, - VehicleSpawner = { - Pos = { x = 307.76, y = -1433.47, z = 28.97 }, - Type = 1 - }, + VehicleSpawner = { + Pos = { x = 307.76, y = -1433.47, z = 28.97 }, + Type = 1 + }, - VehicleSpawnPoint = { - Pos = { x = 304.87, y = -1437.69, z = 28.80 }, - Type = -1 - }, + VehicleSpawnPoint = { + Pos = { x = 304.87, y = -1437.69, z = 28.80 }, + Type = -1 + }, - VehicleDeleter = { - Pos = { x = 327.67, y = -1481.1, z = 28.83 }, - Type = 1 - }, + VehicleDeleter = { + Pos = { x = 327.67, y = -1481.1, z = 28.83 }, + Type = 1 + }, - Pharmacy = { - Pos = { x = 230.13, y = -1366.18, z = 38.53 }, - Type = 1 - }, + Pharmacy = { + Pos = { x = 230.13, y = -1366.18, z = 38.53 }, + Type = 1 + }, - ParkingDoorGoOutInside = { - Pos = { x = 234.56, y = -1373.77, z = 20.97 }, - Type = 1 - }, + ParkingDoorGoOutInside = { + Pos = { x = 234.56, y = -1373.77, z = 20.97 }, + Type = 1 + }, - ParkingDoorGoOutOutside = { - Pos = { x = 320.98, y = -1478.62, z = 28.81 }, - Type = -1 - }, + ParkingDoorGoOutOutside = { + Pos = { x = 320.98, y = -1478.62, z = 28.81 }, + Type = -1 + }, - ParkingDoorGoInInside = { - Pos = { x = 238.64, y = -1368.48, z = 23.53 }, - Type = -1 - }, + ParkingDoorGoInInside = { + Pos = { x = 238.64, y = -1368.48, z = 23.53 }, + Type = -1 + }, - ParkingDoorGoInOutside = { - Pos = { x = 317.97, y = -1476.13, z = 28.97 }, - Type = 1 - }, + ParkingDoorGoInOutside = { + Pos = { x = 317.97, y = -1476.13, z = 28.97 }, + Type = 1 + }, - StairsGoTopTop = { - Pos = { x = 251.91, y = -1363.3, z = 38.53 }, - Type = -1 - }, + StairsGoTopTop = { + Pos = { x = 251.91, y = -1363.3, z = 38.53 }, + Type = -1 + }, - StairsGoTopBottom = { - Pos = { x = 237.45, y = -1373.89, z = 26.30 }, - Type = -1 - }, + StairsGoTopBottom = { + Pos = { x = 237.45, y = -1373.89, z = 26.30 }, + Type = -1 + }, - StairsGoBottomTop = { - Pos = { x = 256.58, y = -1357.7, z = 37.30 }, - Type = -1 - }, + StairsGoBottomTop = { + Pos = { x = 256.58, y = -1357.7, z = 37.30 }, + Type = -1 + }, - StairsGoBottomBottom = { - Pos = { x = 235.45, y = -1372.89, z = 26.30 }, - Type = -1 - } + StairsGoBottomBottom = { + Pos = { x = 235.45, y = -1372.89, z = 26.30 }, + Type = -1 + } } diff --git a/locales/br.lua b/locales/br.lua index c369afca..cb23085f 100644 --- a/locales/br.lua +++ b/locales/br.lua @@ -12,11 +12,11 @@ Locales['br'] = { -- Action Menu ['hospital'] = 'Hôspital', ['revive_inprogress'] = 'Reanimação em andamento', - ['revive_complete'] = 'Você ressuscitou ', + ['revive_complete'] = 'você ressuscitou ~y~%s~s~', + ['revive_complete_award'] = 'você ressuscitou ~y~%s~s~, ~g~$%s~s~', ['no_players'] = 'Nenhum jogador nas proximidades', ['no_vehicles'] = 'Sem veículos nas proximidades', - ['isdead'] = 'Está morto', - ['unconscious'] = 'Não está inconsciente', + ['player_not_unconscious'] = 'Não está inconsciente', -- Boss Menu ['deposit_society'] = 'Depositar dinheiro', ['withdraw_society'] = 'Retirar dinheiro da empresa', @@ -45,12 +45,9 @@ Locales['br'] = { -- Death ['respawn_at_hospital'] = 'Você quer ser transportado para o hospital ?', ['yes'] = 'Sim', - ['please_wait'] = 'Você será automaticamente transportado para o hospital em ~b~', - ['minutes'] = ' minutos ', - ['seconds_fine'] = ' segundos ~w~ para renascer \nRenascer agora ~g~$', - ['seconds'] = ' segundos ~w~.', - ['press_respawn_fine'] = 'Você pagará ~g~', + ['please_wait'] = 'Você será automaticamente transportado para o hospital em ~b~%s minutos %s segundos~s~', ['press_respawn'] = 'Aperte [~b~E~w~] para renascer.', + ['respawn_fine'] = 'you paid ~r~$%s~s~ for respawning.', -- Revive ['revive_help'] = 'reviver um jogador', -- Item diff --git a/locales/de.lua b/locales/de.lua index 5f3b0328..6b964884 100644 --- a/locales/de.lua +++ b/locales/de.lua @@ -12,14 +12,15 @@ Locales['de'] = { -- Action Menu ['hospital'] = 'Krankenhaus', ['revive_inprogress'] = 'wiederbeleben im Gange', - ['revive_complete'] = 'du wurdest wiederbelebt ', + ['revive_complete'] = 'du wurdest wiederbelebt ~y~%s~s~', + ['revive_complete_award'] = 'du wurdest wiederbelebt ~y~%s~s~, ~g~$%s~s~', ['no_players'] = 'keine Spieler in der Nähe', ['no_vehicles'] = 'keine Fahrzeuge in der Nähe', - ['isdead'] = 'ist gestorben', - ['unconscious'] = 'ist nicht im Koma', + ['player_not_unconscious'] = 'ist nicht im Koma', -- Boss Menu ['deposit_society'] = 'Notdienst einzahlen', ['withdraw_society'] = 'Notdienst abheben', + ['boss_actions'] = 'boss actions', -- Misc ['invalid_amount'] = '~r~ungültiger Betrag', ['open_menu'] = 'Drücke ~INPUT_CONTEXT~ um das Menü zu öffnen', @@ -35,12 +36,9 @@ Locales['de'] = { -- Death ['respawn_at_hospital'] = 'Willst du ins Krankenhaus gebracht werden?', ['yes'] = 'ja', - ['please_wait'] = 'bitte warte ~b~', - ['minutes'] = ' minuten ', - ['seconds_fine'] = ' sekunden ~w~zum respawnen\nRespawn jetzt für ~g~$', - ['seconds'] = ' sekunden ~w~bis zum respawn.', - ['press_respawn_fine'] = '~w~ [Drücke ~b~E~w~]', + ['please_wait'] = 'bitte warte ~b~%s minuten %s sekunden~s~ bis zum respawn', ['press_respawn'] = 'Drücke [~b~E~w~] zum respawnen.', + ['respawn_fine'] = 'you paid ~r~$%s~s~ for respawning.', -- Revive ['revive_help'] = 'Spieler wiederbeleben', } diff --git a/locales/en.lua b/locales/en.lua index 5eb7177f..fb5c005d 100644 --- a/locales/en.lua +++ b/locales/en.lua @@ -11,12 +11,12 @@ Locales['en'] = { ['helicopter'] = 'helicopter', -- Action Menu ['hospital'] = 'hospital', - ['revive_inprogress'] = 'revive in progress', - ['revive_complete'] = 'you have been revived ', + ['revive_inprogress'] = 'a revive is in progress!', + ['revive_complete'] = 'you have revived ~y~%s~s~', + ['revive_complete_award'] = 'you have revived ~y~%s~s~ and earned ~g~$%s~s~!', ['no_players'] = 'no players nearby', ['no_vehicles'] = 'no vehicles nearby', - ['isdead'] = 'is dead', - ['unconscious'] = 'is not unconscious', + ['player_not_unconscious'] = 'that player is not unconscious!', -- Boss Menu ['deposit_society'] = 'eMS Deposit', ['withdraw_society'] = 'eMS Withdraw', @@ -45,12 +45,9 @@ Locales['en'] = { -- Death ['respawn_at_hospital'] = 'do you want to force respawn and spawn in the hospital?', ['yes'] = 'yes', - ['please_wait'] = 'You are unconscious and will bleed out in ~b~', - ['minutes'] = ' minutes ', - ['seconds_fine'] = ' seconds ~w~to respawn \nForce respawn now by pressing ~g~$', - ['seconds'] = ' seconds', - ['press_respawn_fine'] = '~w~ [Press ~b~E~w~]', + ['please_wait'] = 'you are unconscious and will bleed out in ~b~%s minutes and %s seconds~s~', ['press_respawn'] = 'press [~b~E~w~] to respawn.', + ['respawn_fine'] = 'you paid ~r~$%s~s~ for respawning.', -- Revive ['revive_help'] = 'revive a player', -- Item diff --git a/locales/es.lua b/locales/es.lua index 139404ca..371c77d8 100644 --- a/locales/es.lua +++ b/locales/es.lua @@ -3,7 +3,7 @@ Locales['es'] = { ['cloakroom'] = 'Guardarropa', ['ems_clothes_civil'] = 'Camiseta', ['ems_clothes_ems'] = 'Equipo de ambulancia', --- Vehicles + -- Vehicles ['veh_menu'] = 'vehículo', ['veh_spawn'] = 'Presione ~INPUT_CONTEXT~ para sacar un vehículo', ['store_veh'] = 'Presione ~INPUT_CONTEXT~ para alamcenar un vehículo', @@ -12,11 +12,11 @@ Locales['es'] = { -- Action Menu ['hospital'] = 'hospital', ['revive_inprogress'] = 'reanimación en curso', - ['revive_complete'] = 'has sido reanimado ', + ['revive_complete'] = 'has sido reanimado ~y~%s~s~', + ['revive_complete_award'] = 'has sido reanimado ~y~%s~s~, ~g~$%s~s~', ['no_players'] = 'ningún jugador cerca', ['no_vehicles'] = 'ningún vehículo cerca', - ['isdead'] = 'Has muerto', - ['unconscious'] = 'n\'estás inconsciente', + ['player_not_unconscious'] = 'n\'estás inconsciente', -- oss Menu ['deposit_society'] = 'depositar dinero', ['withdraw_society'] = 'retirar dinero', @@ -35,12 +35,9 @@ Locales['es'] = { -- Death ['respawn_at_hospital'] = '¿Quieres ser transportado al hospital?', ['yes'] = 'oui', - ['please_wait'] = 's\'por favor, espere ~b~', - ['minutes'] = ' minutos ', - ['seconds_fine'] = ' segundos ~w~to reparecer \nReapareciendo ahora por ~g~€', - ['seconds'] = ' segundos ~w~para reparecer.', - ['press_respawn_fine'] = '~w~ [Pulsa ~b~E~w~]', + ['please_wait'] = 's\'por favor, espere ~b~%s minutos %s segundos para reparecer~s~', ['press_respawn'] = 'presione [~b~E~w~] para reparecer.', + ['respawn_fine'] = 'you paid ~r~$%s~s~ for respawning.', -- Revive ['revive_help'] = 'reviver un jugador', } diff --git a/locales/fr.lua b/locales/fr.lua index 5343d810..0a60983c 100644 --- a/locales/fr.lua +++ b/locales/fr.lua @@ -12,11 +12,11 @@ Locales['fr'] = { -- Action Menu ['hospital'] = 'hôpital', ['revive_inprogress'] = 'réanimation en cours', - ['revive_complete'] = 'vous avez réanimé ', + ['revive_complete'] = 'vous avez réanimé ~y~%s~s~', + ['revive_complete_award'] = 'vous avez réanimé ~y~%s~s~, ~g~$%s~s~', ['no_players'] = 'aucun joueur à proximité', ['no_vehicles'] = 'aucun véhicule à proximité', - ['isdead'] = 'a succombé', - ['unconscious'] = 'n\'est pas inconscient', + ['player_not_unconscious'] = 'n\'est pas inconscient', -- Boss Menu ['deposit_society'] = 'déposer argent', ['withdraw_society'] = 'retirer argent société', @@ -45,12 +45,9 @@ Locales['fr'] = { -- Death ['respawn_at_hospital'] = 'voulez-vous être transporté à l\'hôpital ?', ['yes'] = 'oui', - ['please_wait'] = 'Vous serez automatiquement transporté à l\'hôpital dans ~b~', - ['minutes'] = ' minutes ', - ['seconds_fine'] = ' secondes ~w~ pour réapparaître \nRéapparaître maintenant pour ~g~$', - ['seconds'] = ' secondes ~w~.', - ['press_respawn_fine'] = 'vous payerez ~g~', + ['please_wait'] = 'Vous serez automatiquement transporté à l\'hôpital dans ~b~%s minutes %s secondes~s~', ['press_respawn'] = 'appuyez sur [~b~E~w~] pour réapparaître.', + ['respawn_fine'] = 'you paid ~r~$%s~s~ for respawning.', -- Revive ['revive_help'] = 'relancer un joueur', -- Item diff --git a/locales/sv.lua b/locales/sv.lua index 7238230c..578928f8 100644 --- a/locales/sv.lua +++ b/locales/sv.lua @@ -12,11 +12,11 @@ Locales['sv'] = { -- Action Menu ['hospital'] = 'Sjukhus', ['revive_inprogress'] = 'Återupplivning pågår...', - ['revive_complete'] = 'Du har återupplivat ~y~%s~w~ och tjärnat ~g~$2000~w~ i processen, bra jobbat!', + ['revive_complete'] = 'du har återupplivat ~y~%s~s~, bra jobbat!', + ['revive_complete_award'] = 'du har återupplivat ~y~%s~s~ och tjärnat ~g~$%s~s~ i processen, bra jobbat!', ['no_players'] = 'Inga spelare i närheten!', ['no_vehicles'] = 'Inga fordon i närheten!', - ['isdead'] = 'är död', - ['unconscious'] = 'är medvetslös', + ['player_not_unconscious'] = 'spelaren är inte medvetslös!', -- Boss Menu ['deposit_society'] = 'Sjukvårdens insättning', ['withdraw_society'] = 'Sjukvårdens uttagning', @@ -45,19 +45,16 @@ Locales['sv'] = { -- Death ['respawn_at_hospital'] = 'Vill du snabbresa till sjukhuset?', ['yes'] = 'Ja!', - ['please_wait'] = 'Du är medvetslös och kommer att dö om ~b~', - ['minutes'] = ' minuter ', - ['seconds_fine'] = ' sekunder ~w~till respawn \nForce respawna nu genom att trycka på ~g~$', - ['seconds'] = ' sekunder', - ['press_respawn_fine'] = '~w~ [Tryck ~b~E~w~]', + ['please_wait'] = 'du är medvetslös och kommer att dö om ~b~%s minuter och %s sekunder~s~', ['press_respawn'] = 'Tryck [~b~E~w~] för att respawna.', + ['respawn_fine'] = 'du betalade ~r~$%s~s~ för att respawna.', -- Revive ['revive_help'] = 'Återuppliva en spelare', -- Item - ['used_medikit'] = 'Du har använt 1x Medecinkit', - ['used_bandage'] = 'Du har använt 1x Bandage', + ['used_medikit'] = 'Du har använt ~y~1x~s~ ~b~Medecinkit~s~', + ['used_bandage'] = 'Du har använt ~y~1x~s~ ~b~Bandage~s~', ['not_enough_medikit'] = 'Du har inget ~b~Medecinkit~w~.', ['not_enough_bandage'] = 'Du har inget ~b~Bandage~w~.', - ['healed'] = 'Du har blivit upplivad.', + ['healed'] = 'Du har blivit återupplivad.', -- Misc } diff --git a/server/main.lua b/server/main.lua index 9f8780b7..87aad058 100644 --- a/server/main.lua +++ b/server/main.lua @@ -51,6 +51,7 @@ ESX.RegisterServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function( end if Config.RespawnFine then + TriggerClientEvent('esx:showNotification', xPlayer.source, _U('respawn_fine', Config.RespawnFineAmount)) xPlayer.removeAccountMoney('bank', Config.RespawnFineAmount) end From 1bb79aa4bea835d9ab7ff7e3d827e01bda81cc8a Mon Sep 17 00:00:00 2001 From: Samuel Date: Tue, 24 Apr 2018 21:57:10 +0200 Subject: [PATCH 072/177] Update README.md --- README.md | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index b763c909..f34520e6 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # esx_ambulancejob -[REQUIREMENTS] +## Requirements * Auto mode - [esx_skin](https://github.com/ESX-Org/esx_skin) @@ -8,19 +8,39 @@ * Player management (boss actions **There is no way to earn money for now**) - [esx_society](https://github.com/ESX-Org/esx_society) -[INSTALLATION] +## Download & Installation -1) CD in your resources/[esx] folder -2) Clone the repository +### Using [fvm](https://github.com/qlaffont/fvm-installer) ``` -git clone [esx_ambulancejob](https://github.com/ESX-Org/esx_ambulancejob) +fvm install --save --folder=esx esx-org/esx_ambulancejob ``` -3) Import esx_ambulancejob.sql in your database -4) Add this in your server.cfg : +### Using Git +``` +cd resources +git clone https://github.com/ESX-Org/esx_ambulancejob [esx]/esx_ambulancejob +``` + +### Manually +- Download https://github.com/ESX-Org/esx_ambulancejob/archive/master.zip +- Put it in the `[esx]` directory + +- Import `esx_ambulancejob.sql` in your database +- Add this in your `server.cfg`: ``` start esx_ambulancejob ``` -5) * If you want player management you have to set Config.EnablePlayerManagement to true in config.lua +- If you want player management you have to set `Config.EnablePlayerManagement` to `true` in `config.lua` +# Legal +### License +esx_ambulancejob - ambulance script for fivem + +Copyright (C) 2015-2018 Jérémie N'gadi + +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 http://www.gnu.org/licenses/. From 8b5f2bdf71f7a49f371c1a0eae89b969fe67a0c6 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Wed, 25 Apr 2018 21:55:09 +0200 Subject: [PATCH 073/177] Check for if player is concious, fixed missing translations --- client/main.lua | 50 ++++++++++++++++++++++++++++++------------------- locales/br.lua | 3 +++ locales/de.lua | 3 +++ locales/en.lua | 3 +++ locales/es.lua | 3 +++ locales/fr.lua | 3 +++ locales/sv.lua | 5 ++++- 7 files changed, 50 insertions(+), 20 deletions(-) diff --git a/client/main.lua b/client/main.lua index a5b82dec..52b3fae2 100644 --- a/client/main.lua +++ b/client/main.lua @@ -339,7 +339,6 @@ function OpenMobileAmbulanceActionsMenu() local health = GetEntityHealth(closestPlayerPed) if health == 0 then - menu.close() local playerPed = GetPlayerPed(-1) ESX.ShowNotification(_U('revive_inprogress')) @@ -372,16 +371,22 @@ function OpenMobileAmbulanceActionsMenu() else ESX.TriggerServerCallback('esx_ambulancejob:getItemAmount', function(qtty) if qtty > 0 then - menu.close() - local playerPed = GetPlayerPed(-1) - ESX.ShowNotification(_U('heal_inprogress')) - TaskStartScenarioInPlace(playerPed, 'CODE_HUMAN_MEDIC_TEND_TO_DEAD', 0, true) - Citizen.Wait(10000) - ClearPedTasks(playerPed) + local closestPlayerPed = GetPlayerPed(closestPlayer) + local health = GetEntityHealth(closestPlayerPed) - TriggerServerEvent('esx_ambulancejob:removeItem', 'bandage') - TriggerServerEvent('esx_ambulancejob:heal', GetPlayerServerId(closestPlayer), 'small') - ESX.ShowNotification(_U('heal_complete')) + if health > 0 then + local playerPed = GetPlayerPed(-1) + ESX.ShowNotification(_U('heal_inprogress')) + TaskStartScenarioInPlace(playerPed, 'CODE_HUMAN_MEDIC_TEND_TO_DEAD', 0, true) + Citizen.Wait(10000) + ClearPedTasks(playerPed) + + TriggerServerEvent('esx_ambulancejob:removeItem', 'bandage') + TriggerServerEvent('esx_ambulancejob:heal', GetPlayerServerId(closestPlayer), 'small') + ESX.ShowNotification(_U('heal_complete', GetPlayerName(closestPlayer))) + else + ESX.ShowNotification(_U('player_not_conscious')) + end else ESX.ShowNotification(_U('not_enough_bandage')) end @@ -395,15 +400,22 @@ function OpenMobileAmbulanceActionsMenu() else ESX.TriggerServerCallback('esx_ambulancejob:getItemAmount', function(qtty) if qtty > 0 then - menu.close() - local playerPed = GetPlayerPed(-1) - ESX.ShowNotification(_U('heal_inprogress')) - TaskStartScenarioInPlace(playerPed, 'CODE_HUMAN_MEDIC_TEND_TO_DEAD', 0, true) - Citizen.Wait(10000) - ClearPedTasks(playerPed) - TriggerServerEvent('esx_ambulancejob:removeItem', 'medikit') - TriggerServerEvent('esx_ambulancejob:heal', GetPlayerServerId(closestPlayer), 'big') - ESX.ShowNotification(_U('heal_complete')) + local closestPlayerPed = GetPlayerPed(closestPlayer) + local health = GetEntityHealth(closestPlayerPed) + + if health > 0 then + local playerPed = GetPlayerPed(-1) + ESX.ShowNotification(_U('heal_inprogress')) + TaskStartScenarioInPlace(playerPed, 'CODE_HUMAN_MEDIC_TEND_TO_DEAD', 0, true) + Citizen.Wait(10000) + ClearPedTasks(playerPed) + + TriggerServerEvent('esx_ambulancejob:removeItem', 'medikit') + TriggerServerEvent('esx_ambulancejob:heal', GetPlayerServerId(closestPlayer), 'big') + ESX.ShowNotification(_U('heal_complete', GetPlayerName(closestPlayer))) + else + ESX.ShowNotification(_U('player_not_conscious')) + end else ESX.ShowNotification(_U('not_enough_medikit')) end diff --git a/locales/br.lua b/locales/br.lua index cb23085f..3658c8f5 100644 --- a/locales/br.lua +++ b/locales/br.lua @@ -14,9 +14,12 @@ Locales['br'] = { ['revive_inprogress'] = 'Reanimação em andamento', ['revive_complete'] = 'você ressuscitou ~y~%s~s~', ['revive_complete_award'] = 'você ressuscitou ~y~%s~s~, ~g~$%s~s~', + ['heal_inprogress'] = 'you are healing!', + ['heal_complete'] = 'you have healed ~y~%s~s~', ['no_players'] = 'Nenhum jogador nas proximidades', ['no_vehicles'] = 'Sem veículos nas proximidades', ['player_not_unconscious'] = 'Não está inconsciente', + ['player_not_conscious'] = 'that player is not conscious!', -- Boss Menu ['deposit_society'] = 'Depositar dinheiro', ['withdraw_society'] = 'Retirar dinheiro da empresa', diff --git a/locales/de.lua b/locales/de.lua index 6b964884..125998c2 100644 --- a/locales/de.lua +++ b/locales/de.lua @@ -14,9 +14,12 @@ Locales['de'] = { ['revive_inprogress'] = 'wiederbeleben im Gange', ['revive_complete'] = 'du wurdest wiederbelebt ~y~%s~s~', ['revive_complete_award'] = 'du wurdest wiederbelebt ~y~%s~s~, ~g~$%s~s~', + ['heal_inprogress'] = 'you are healing!', + ['heal_complete'] = 'you have healed ~y~%s~s~', ['no_players'] = 'keine Spieler in der Nähe', ['no_vehicles'] = 'keine Fahrzeuge in der Nähe', ['player_not_unconscious'] = 'ist nicht im Koma', + ['player_not_conscious'] = 'that player is not conscious!', -- Boss Menu ['deposit_society'] = 'Notdienst einzahlen', ['withdraw_society'] = 'Notdienst abheben', diff --git a/locales/en.lua b/locales/en.lua index fb5c005d..db01877c 100644 --- a/locales/en.lua +++ b/locales/en.lua @@ -14,9 +14,12 @@ Locales['en'] = { ['revive_inprogress'] = 'a revive is in progress!', ['revive_complete'] = 'you have revived ~y~%s~s~', ['revive_complete_award'] = 'you have revived ~y~%s~s~ and earned ~g~$%s~s~!', + ['heal_inprogress'] = 'you are healing!', + ['heal_complete'] = 'you have healed ~y~%s~s~', ['no_players'] = 'no players nearby', ['no_vehicles'] = 'no vehicles nearby', ['player_not_unconscious'] = 'that player is not unconscious!', + ['player_not_conscious'] = 'that player is not conscious!', -- Boss Menu ['deposit_society'] = 'eMS Deposit', ['withdraw_society'] = 'eMS Withdraw', diff --git a/locales/es.lua b/locales/es.lua index 371c77d8..185b1740 100644 --- a/locales/es.lua +++ b/locales/es.lua @@ -14,9 +14,12 @@ Locales['es'] = { ['revive_inprogress'] = 'reanimación en curso', ['revive_complete'] = 'has sido reanimado ~y~%s~s~', ['revive_complete_award'] = 'has sido reanimado ~y~%s~s~, ~g~$%s~s~', + ['heal_inprogress'] = 'you are healing!', + ['heal_complete'] = 'you have healed ~y~%s~s~', ['no_players'] = 'ningún jugador cerca', ['no_vehicles'] = 'ningún vehículo cerca', ['player_not_unconscious'] = 'n\'estás inconsciente', + ['player_not_conscious'] = 'that player is not conscious!', -- oss Menu ['deposit_society'] = 'depositar dinero', ['withdraw_society'] = 'retirar dinero', diff --git a/locales/fr.lua b/locales/fr.lua index 0a60983c..5ac27c7d 100644 --- a/locales/fr.lua +++ b/locales/fr.lua @@ -14,9 +14,12 @@ Locales['fr'] = { ['revive_inprogress'] = 'réanimation en cours', ['revive_complete'] = 'vous avez réanimé ~y~%s~s~', ['revive_complete_award'] = 'vous avez réanimé ~y~%s~s~, ~g~$%s~s~', + ['heal_inprogress'] = 'you are healing!', + ['heal_complete'] = 'you have healed ~y~%s~s~', ['no_players'] = 'aucun joueur à proximité', ['no_vehicles'] = 'aucun véhicule à proximité', ['player_not_unconscious'] = 'n\'est pas inconscient', + ['player_not_conscious'] = 'that player is not conscious!', -- Boss Menu ['deposit_society'] = 'déposer argent', ['withdraw_society'] = 'retirer argent société', diff --git a/locales/sv.lua b/locales/sv.lua index 578928f8..20a05630 100644 --- a/locales/sv.lua +++ b/locales/sv.lua @@ -14,9 +14,12 @@ Locales['sv'] = { ['revive_inprogress'] = 'Återupplivning pågår...', ['revive_complete'] = 'du har återupplivat ~y~%s~s~, bra jobbat!', ['revive_complete_award'] = 'du har återupplivat ~y~%s~s~ och tjärnat ~g~$%s~s~ i processen, bra jobbat!', + ['heal_inprogress'] = 'du behandlar patienten!', + ['heal_complete'] = 'du har behandlat ~y~%s~s~', ['no_players'] = 'Inga spelare i närheten!', ['no_vehicles'] = 'Inga fordon i närheten!', ['player_not_unconscious'] = 'spelaren är inte medvetslös!', + ['player_not_conscious'] = 'spelaren är inte vid medvetande!', -- Boss Menu ['deposit_society'] = 'Sjukvårdens insättning', ['withdraw_society'] = 'Sjukvårdens uttagning', @@ -55,6 +58,6 @@ Locales['sv'] = { ['used_bandage'] = 'Du har använt ~y~1x~s~ ~b~Bandage~s~', ['not_enough_medikit'] = 'Du har inget ~b~Medecinkit~w~.', ['not_enough_bandage'] = 'Du har inget ~b~Bandage~w~.', - ['healed'] = 'Du har blivit återupplivad.', + ['healed'] = 'dina skador har blivit behandlade.', -- Misc } From ea9635a515bfdd8f07ff5ecb72eff081a2c12882 Mon Sep 17 00:00:00 2001 From: Mathis Cucci Date: Sat, 28 Apr 2018 21:10:32 +0200 Subject: [PATCH 074/177] fixed some french translations --- locales/fr.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/locales/fr.lua b/locales/fr.lua index 5ac27c7d..402ea787 100644 --- a/locales/fr.lua +++ b/locales/fr.lua @@ -15,11 +15,11 @@ Locales['fr'] = { ['revive_complete'] = 'vous avez réanimé ~y~%s~s~', ['revive_complete_award'] = 'vous avez réanimé ~y~%s~s~, ~g~$%s~s~', ['heal_inprogress'] = 'you are healing!', - ['heal_complete'] = 'you have healed ~y~%s~s~', + ['heal_complete'] = 'vous avez soigné ~y~%s~s~', ['no_players'] = 'aucun joueur à proximité', ['no_vehicles'] = 'aucun véhicule à proximité', ['player_not_unconscious'] = 'n\'est pas inconscient', - ['player_not_conscious'] = 'that player is not conscious!', + ['player_not_conscious'] = 'Cette personne est inconsciente!', -- Boss Menu ['deposit_society'] = 'déposer argent', ['withdraw_society'] = 'retirer argent société', @@ -33,7 +33,7 @@ Locales['fr'] = { ['open_pharmacy'] = 'appuyez sur ~INPUT_CONTEXT~ pour ouvrir la pharmacie.', ['pharmacy_menu_title'] = 'Pharmacie', ['pharmacy_take'] = 'Prendre', - ['medikit'] = 'medikit', + ['medikit'] = 'kit de soin', ['bandage'] = 'bandage', ['max_item'] = 'vous en portez déjà assez sur vous.', -- F6 Menu @@ -50,13 +50,13 @@ Locales['fr'] = { ['yes'] = 'oui', ['please_wait'] = 'Vous serez automatiquement transporté à l\'hôpital dans ~b~%s minutes %s secondes~s~', ['press_respawn'] = 'appuyez sur [~b~E~w~] pour réapparaître.', - ['respawn_fine'] = 'you paid ~r~$%s~s~ for respawning.', + ['respawn_fine'] = 'vous avez payer ~r~$%s~s~ pour réapparaître.', -- Revive ['revive_help'] = 'relancer un joueur', -- Item - ['used_medikit'] = 'vous avez utilisé 1x medikit', + ['used_medikit'] = 'vous avez utilisé 1x kit de soin', ['used_bandage'] = 'vous avez utilisé 1x bandage', - ['not_enough_medikit'] = 'vous n\'avez pas de ~b~medikit~w~.', + ['not_enough_medikit'] = 'vous n\'avez pas de ~b~kit de soin~w~.', ['not_enough_bandage'] = 'vous n\'avez pas de ~b~bandage~w~.', ['healed'] = 'vous avez été soigné.', -- Misc From 20174d68764e91821e38d0981df61df5e9695398 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Wed, 6 Jun 2018 13:12:02 +0200 Subject: [PATCH 075/177] Possible fix for invisable players, 3rd party ipl loader compability --- client/main.lua | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/client/main.lua b/client/main.lua index 52b3fae2..d6cf9ee8 100644 --- a/client/main.lua +++ b/client/main.lua @@ -77,8 +77,8 @@ function StartRespawnToHospitalMenuTimer() function(data, menu) --Submit Cb menu.close() Citizen.CreateThread(function() - RemoveItemsAfterRPDeath() - end) + RemoveItemsAfterRPDeath() + end) end, function(data, menu) --Cancel Cb --menu.close() @@ -195,14 +195,18 @@ end function OnPlayerDeath() IsDead = true TriggerServerEvent('esx_ambulancejob:setDeathStatus', 1) - + if Config.ShowDeathTimer == true then ShowTimer() end + StartRespawnTimer() + if Config.RespawnToHospitalMenuTimer == true then StartRespawnToHospitalMenuTimer() end + + ClearPedTasksImmediately(GetPlayerPed(-1)) StartScreenEffect('DeathFailOut', 0, false) end @@ -272,6 +276,7 @@ function OpenAmbulanceActionsMenu() 'default', GetCurrentResourceName(), 'ambulance_actions', { title = _U('ambulance'), + align = 'top-left', elements = elements }, function(data, menu) @@ -897,11 +902,13 @@ AddEventHandler('esx_ambulancejob:requestDeath', function() end) -- Load unloaded IPLs -Citizen.CreateThread(function() - LoadMpDlcMaps() - EnableMpDlcMaps(true) - RequestIpl('Coroner_Int_on') -- Morgue -end) +if Config.LoadIpl then + Citizen.CreateThread(function() + LoadMpDlcMaps() + EnableMpDlcMaps(true) + RequestIpl('Coroner_Int_on') -- Morgue + end) +end -- String string function stringsplit(inputstr, sep) From 485e91c3f7ca70ec68d44ffb14414d4256049379 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Wed, 6 Jun 2018 13:12:22 +0200 Subject: [PATCH 076/177] Config update --- config.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/config.lua b/config.lua index 1ce952f5..622bcd6a 100644 --- a/config.lua +++ b/config.lua @@ -1,9 +1,13 @@ Config = {} + Config.DrawDistance = 100.0 Config.MarkerColor = { r = 102, g = 0, b = 102 } Config.MarkerSize = { x = 1.5, y = 1.5, z = 1.0 } Config.ReviveReward = 700 -- revive reward, set to 0 if you don't want it enabled Config.AntiCombatLog = true -- enable anti-combat logging? +Config.LoadIpl = true -- disable if you're using fivem-ipl or other IPL loaders +Config.Locale = 'fr' + local second = 1000 local minute = 60 * second @@ -32,8 +36,6 @@ Config.EarlyRespawn = false Config.RespawnFine = false Config.RespawnFineAmount = 500 -Config.Locale = 'fr' - Config.Blip = { Pos = { x = 307.76, y = -1433.47, z = 28.97 }, Sprite = 61, From 01aea0a71d6f4bce86f2f935645a80837daa2708 Mon Sep 17 00:00:00 2001 From: Samuel Date: Wed, 6 Jun 2018 13:13:16 +0200 Subject: [PATCH 077/177] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f34520e6..0cbb8348 100644 --- a/README.md +++ b/README.md @@ -25,13 +25,14 @@ git clone https://github.com/ESX-Org/esx_ambulancejob [esx]/esx_ambulancejob - Download https://github.com/ESX-Org/esx_ambulancejob/archive/master.zip - Put it in the `[esx]` directory +## Installation - Import `esx_ambulancejob.sql` in your database +- If you want player management you have to set `Config.EnablePlayerManagement` to `true` in `config.lua` - Add this in your `server.cfg`: ``` start esx_ambulancejob ``` -- If you want player management you have to set `Config.EnablePlayerManagement` to `true` in `config.lua` # Legal ### License From b0011647a66872291cfb57e80ef99967196759fa Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Wed, 6 Jun 2018 22:43:47 +0200 Subject: [PATCH 078/177] Added sending distress signals to available medics --- client/main.lua | 152 +++++++++++++++++++++++++++--------------------- locales/br.lua | 4 ++ locales/de.lua | 4 ++ locales/en.lua | 4 ++ locales/es.lua | 4 ++ locales/fr.lua | 4 ++ locales/sv.lua | 8 ++- 7 files changed, 113 insertions(+), 67 deletions(-) diff --git a/client/main.lua b/client/main.lua index d6cf9ee8..71730d3e 100644 --- a/client/main.lua +++ b/client/main.lua @@ -19,7 +19,6 @@ local LastZone = nil local CurrentAction = nil local CurrentActionMsg = '' local CurrentActionData = {} -local RespawnToHospitalMenu = nil ESX = nil GUI.Time = 0 @@ -29,7 +28,7 @@ Citizen.CreateThread(function() TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) Citizen.Wait(0) end - + Citizen.Wait(5000) PlayerData = ESX.GetPlayerData() end) @@ -40,11 +39,7 @@ function RespawnPed(ped, coords) SetPlayerInvincible(ped, false) TriggerEvent('playerSpawned', coords.x, coords.y, coords.z, coords.heading) ClearPedBloodDamage(ped) - if RespawnToHospitalMenu ~= nil then - RespawnToHospitalMenu.close() - RespawnToHospitalMenu = nil - end - + ESX.UI.Menu.CloseAll() end @@ -63,43 +58,69 @@ AddEventHandler('esx_ambulancejob:heal', function(_type) end) function StartRespawnToHospitalMenuTimer() - ESX.SetTimeout(Config.MenuRespawnToHospitalDelay, function() - if IsDead then - local elements = {} - table.insert(elements, {label = _U('yes'), value = 'yes'}) - RespawnToHospitalMenu = ESX.UI.Menu.Open( - 'default', GetCurrentResourceName(), 'menuName', - { - title = _U('respawn_at_hospital'), - align = 'top-left', - elements = elements - }, - function(data, menu) --Submit Cb - menu.close() - Citizen.CreateThread(function() - RemoveItemsAfterRPDeath() - end) - end, - function(data, menu) --Cancel Cb - --menu.close() - end, - function(data, menu) --Change Cb - --print(data.current.value) - end, - function(data, menu) --Close Cb - RespawnToHospitalMenu = nil - end - ) - end - end) + ESX.SetTimeout(Config.MenuRespawnToHospitalDelay, function() + ESX.UI.Menu.Open( + 'default', GetCurrentResourceName(), 'respawn_hospital', + { + title = _U('respawn_at_hospital'), + align = 'top-left', + elements = { + {label = _U('no'), value = 'no'}, + {label = _U('yes'), value = 'yes'} + } + }, function(data, menu) + if data.current.value == 'yes' then + RemoveItemsAfterRPDeath() + end + menu.close() + end) + end) end function StartRespawnTimer() - ESX.SetTimeout(Config.RespawnDelayAfterRPDeath, function() - if IsDead then - RemoveItemsAfterRPDeath() - end - end) + ESX.SetTimeout(Config.RespawnDelayAfterRPDeath, function() + RemoveItemsAfterRPDeath() + end) +end + +function StartDistressSignal() + Citizen.CreateThread(function() + local timer = Config.RespawnDelayAfterRPDeath + + while timer > 0 and IsDead do + Citizen.Wait(2) + timer = timer - 30 + + SetTextFont(4) + SetTextProportional(1) + SetTextScale(0.45, 0.45) + SetTextColour(185, 185, 185, 255) + SetTextDropShadow(0, 0, 0, 0, 255) + SetTextEdge(1, 0, 0, 0, 255) + SetTextDropShadow() + SetTextOutline() + BeginTextCommandDisplayText('STRING') + AddTextComponentSubstringPlayerName(_U('distress_send')) + EndTextCommandDisplayText(0.175, 0.805) + + if IsControlPressed(0, Keys['G']) then + SendDistressSignal() + break + end + end + end) +end + +function SendDistressSignal() + local playerPed = GetPlayerPed(-1) + local coords = GetEntityCoords(playerPed) + + ESX.ShowNotification(_U('distress_sent')) + TriggerServerEvent('esx_phone:send', 'ambulance', _U('distress_message'), false, { + x = coords.x, + y = coords.y, + z = coords.z + }) end function ShowTimer() @@ -113,7 +134,7 @@ function ShowTimer() raw_minutes = raw_seconds/60 minutes = stringsplit(raw_minutes, ".")[1] seconds = stringsplit(raw_seconds-(minutes*60), ".")[1] - + SetTextFont(4) SetTextProportional(0) SetTextScale(0.0, 0.5) @@ -122,7 +143,6 @@ function ShowTimer() SetTextEdge(1, 0, 0, 0, 255) SetTextDropShadow() SetTextOutline() - SetTextEntry("STRING") local text = _U('please_wait', minutes, seconds) @@ -130,9 +150,10 @@ function ShowTimer() text = text .. '\n[~b~E~s~]' end - AddTextComponentString(text) SetTextCentre(true) - DrawText(0.5, 0.8) + BeginTextCommandDisplayText("STRING") + AddTextComponentSubstringPlayerName(text) + EndTextCommandDisplayText(0.5, 0.8) if Config.EarlyRespawn then if IsControlPressed(0, Keys['E']) then @@ -155,11 +176,11 @@ function ShowTimer() SetTextEdge(1, 0, 0, 0, 255) SetTextDropShadow() SetTextOutline() - SetTextEntry("STRING") - - AddTextComponentString(_U('press_respawn')) SetTextCentre(true) - DrawText(0.5, 0.8) + + BeginTextCommandDisplayText("STRING") + AddTextComponentSubstringPlayerName(_U('press_respawn')) + EndTextCommandDisplayText(0.5, 0.8) if IsControlPressed(0, Keys['E']) then RemoveItemsAfterRPDeath() @@ -172,24 +193,24 @@ end function RemoveItemsAfterRPDeath() TriggerServerEvent('esx_ambulancejob:setDeathStatus', 0) - Citizen.CreateThread(function() - DoScreenFadeOut(800) - while not IsScreenFadedOut() do - Citizen.Wait(1) - end - ESX.TriggerServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function() - ESX.SetPlayerData('lastPosition', Config.Zones.HospitalInteriorInside1.Pos) - ESX.SetPlayerData('loadout', {}) + Citizen.CreateThread(function() + DoScreenFadeOut(800) + while not IsScreenFadedOut() do + Citizen.Wait(10) + end - TriggerServerEvent('esx:updateLastPosition', Config.Zones.HospitalInteriorInside1.Pos) + ESX.TriggerServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function() + ESX.SetPlayerData('lastPosition', Config.Zones.HospitalInteriorInside1.Pos) + ESX.SetPlayerData('loadout', {}) - RespawnPed(GetPlayerPed(-1), Config.Zones.HospitalInteriorInside1.Pos) + TriggerServerEvent('esx:updateLastPosition', Config.Zones.HospitalInteriorInside1.Pos) + RespawnPed(GetPlayerPed(-1), Config.Zones.HospitalInteriorInside1.Pos) - StopScreenEffect('DeathFailOut') - DoScreenFadeIn(800) - end) - end) + StopScreenEffect('DeathFailOut') + DoScreenFadeIn(800) + end) + end) end function OnPlayerDeath() @@ -201,13 +222,14 @@ function OnPlayerDeath() end StartRespawnTimer() + StartDistressSignal() - if Config.RespawnToHospitalMenuTimer == true then + if Config.RespawnToHospitalMenuTimer then StartRespawnToHospitalMenuTimer() end ClearPedTasksImmediately(GetPlayerPed(-1)) - StartScreenEffect('DeathFailOut', 0, false) + StartScreenEffect('DeathFailOut', 0, false) end function TeleportFadeEffect(entity, coords) diff --git a/locales/br.lua b/locales/br.lua index 3658c8f5..672bbc45 100644 --- a/locales/br.lua +++ b/locales/br.lua @@ -48,9 +48,13 @@ Locales['br'] = { -- Death ['respawn_at_hospital'] = 'Você quer ser transportado para o hospital ?', ['yes'] = 'Sim', + ['no'] = 'no', ['please_wait'] = 'Você será automaticamente transportado para o hospital em ~b~%s minutos %s segundos~s~', ['press_respawn'] = 'Aperte [~b~E~w~] para renascer.', ['respawn_fine'] = 'you paid ~r~$%s~s~ for respawning.', + ['distress_send'] = 'press ~b~[G]~s~ to send distress signal', + ['distress_sent'] = 'distress signal has been sent to available units!', + ['distress_message'] = 'medical attention required: unconscious citizen!', -- Revive ['revive_help'] = 'reviver um jogador', -- Item diff --git a/locales/de.lua b/locales/de.lua index 125998c2..7180521d 100644 --- a/locales/de.lua +++ b/locales/de.lua @@ -39,9 +39,13 @@ Locales['de'] = { -- Death ['respawn_at_hospital'] = 'Willst du ins Krankenhaus gebracht werden?', ['yes'] = 'ja', + ['no'] = 'no', ['please_wait'] = 'bitte warte ~b~%s minuten %s sekunden~s~ bis zum respawn', ['press_respawn'] = 'Drücke [~b~E~w~] zum respawnen.', ['respawn_fine'] = 'you paid ~r~$%s~s~ for respawning.', + ['distress_send'] = 'press ~b~[G]~s~ to send distress signal', + ['distress_sent'] = 'distress signal has been sent to available units!', + ['distress_message'] = 'medical attention required: unconscious citizen!', -- Revive ['revive_help'] = 'Spieler wiederbeleben', } diff --git a/locales/en.lua b/locales/en.lua index db01877c..603b80e1 100644 --- a/locales/en.lua +++ b/locales/en.lua @@ -48,9 +48,13 @@ Locales['en'] = { -- Death ['respawn_at_hospital'] = 'do you want to force respawn and spawn in the hospital?', ['yes'] = 'yes', + ['no'] = 'no', ['please_wait'] = 'you are unconscious and will bleed out in ~b~%s minutes and %s seconds~s~', ['press_respawn'] = 'press [~b~E~w~] to respawn.', ['respawn_fine'] = 'you paid ~r~$%s~s~ for respawning.', + ['distress_send'] = 'press ~b~[G]~s~ to send distress signal', + ['distress_sent'] = 'distress signal has been sent to available units!', + ['distress_message'] = 'medical attention required: unconscious citizen!', -- Revive ['revive_help'] = 'revive a player', -- Item diff --git a/locales/es.lua b/locales/es.lua index 185b1740..92c02650 100644 --- a/locales/es.lua +++ b/locales/es.lua @@ -38,9 +38,13 @@ Locales['es'] = { -- Death ['respawn_at_hospital'] = '¿Quieres ser transportado al hospital?', ['yes'] = 'oui', + ['no'] = 'no', ['please_wait'] = 's\'por favor, espere ~b~%s minutos %s segundos para reparecer~s~', ['press_respawn'] = 'presione [~b~E~w~] para reparecer.', ['respawn_fine'] = 'you paid ~r~$%s~s~ for respawning.', + ['distress_send'] = 'press ~b~[G]~s~ to send distress signal', + ['distress_sent'] = 'distress signal has been sent to available units!', + ['distress_message'] = 'medical attention required: unconscious citizen!', -- Revive ['revive_help'] = 'reviver un jugador', } diff --git a/locales/fr.lua b/locales/fr.lua index 402ea787..355a37a3 100644 --- a/locales/fr.lua +++ b/locales/fr.lua @@ -48,9 +48,13 @@ Locales['fr'] = { -- Death ['respawn_at_hospital'] = 'voulez-vous être transporté à l\'hôpital ?', ['yes'] = 'oui', + ['no'] = 'no', ['please_wait'] = 'Vous serez automatiquement transporté à l\'hôpital dans ~b~%s minutes %s secondes~s~', ['press_respawn'] = 'appuyez sur [~b~E~w~] pour réapparaître.', ['respawn_fine'] = 'vous avez payer ~r~$%s~s~ pour réapparaître.', + ['distress_send'] = 'press ~b~[G]~s~ to send distress signal', + ['distress_sent'] = 'distress signal has been sent to available units!', + ['distress_message'] = 'medical attention required: unconscious citizen!', -- Revive ['revive_help'] = 'relancer un joueur', -- Item diff --git a/locales/sv.lua b/locales/sv.lua index 20a05630..9f607914 100644 --- a/locales/sv.lua +++ b/locales/sv.lua @@ -47,10 +47,14 @@ Locales['sv'] = { ['alert_ambulance'] = 'Ring ambulansen', -- Death ['respawn_at_hospital'] = 'Vill du snabbresa till sjukhuset?', - ['yes'] = 'Ja!', + ['yes'] = 'ja', + ['no'] = 'nej', ['please_wait'] = 'du är medvetslös och kommer att dö om ~b~%s minuter och %s sekunder~s~', - ['press_respawn'] = 'Tryck [~b~E~w~] för att respawna.', + ['press_respawn'] = 'tryck [~b~E~w~] för att respawna.', ['respawn_fine'] = 'du betalade ~r~$%s~s~ för att respawna.', + ['distress_send'] = 'tryck ~b~[G]~s~ för att skicka nödsignal', + ['distress_sent'] = 'nödsignal har skickats till samtliga enheter!', + ['distress_message'] = 'läkarvård krävs: medvetslös medborgare!', -- Revive ['revive_help'] = 'Återuppliva en spelare', -- Item From f601b6dae72d7180ea12c1d03344522eeb779e08 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Wed, 6 Jun 2018 22:50:24 +0200 Subject: [PATCH 079/177] Bumped version --- __resource.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/__resource.lua b/__resource.lua index 134770ab..e1fc7001 100644 --- a/__resource.lua +++ b/__resource.lua @@ -2,7 +2,7 @@ resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937' description 'ESX Ambulance Job' -version '1.0.5' +version '1.0.7' server_scripts { '@mysql-async/lib/MySQL.lua', From bb2171b4f03cb9dac122d2294adee3a82414299a Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Sat, 9 Jun 2018 13:51:06 +0200 Subject: [PATCH 080/177] Added missing SQL information --- esx_ambulancejob.sql | 8 ++++++++ localization/de_esx_ambulancejob.sql | 8 ++++++++ localization/en_esx_ambulancejob.sql | 9 +++++++++ 3 files changed, 25 insertions(+) diff --git a/esx_ambulancejob.sql b/esx_ambulancejob.sql index efdf13ce..a2aa8fa9 100644 --- a/esx_ambulancejob.sql +++ b/esx_ambulancejob.sql @@ -4,6 +4,14 @@ INSERT INTO `addon_account` (name, label, shared) VALUES ('society_ambulance', 'Ambulance', 1) ; +INSERT INTO `addon_inventory` (name, label, shared) VALUES + ('society_ambulance', 'Ambulance', 1) +; + +INSERT INTO `datastore` (name, label, shared) VALUES + ('society_ambulance', 'Ambulance', 1) +; + INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_female) VALUES ('ambulance',0,'ambulance','Ambulancier',20,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), ('ambulance',1,'doctor','Medecin',40,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), diff --git a/localization/de_esx_ambulancejob.sql b/localization/de_esx_ambulancejob.sql index 99f13a94..fc1a52af 100644 --- a/localization/de_esx_ambulancejob.sql +++ b/localization/de_esx_ambulancejob.sql @@ -4,6 +4,14 @@ INSERT INTO `addon_account` (name, label, shared) VALUES ('society_ambulance', 'Notdienst', 1) ; +INSERT INTO `addon_inventory` (name, label, shared) VALUES + ('society_ambulance', 'Ambulance', 1) +; + +INSERT INTO `datastore` (name, label, shared) VALUES + ('society_ambulance', 'Ambulance', 1) +; + INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_female) VALUES ('ambulance',0,'ambulance','Sanitäter',20,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), ('ambulance',1,'doctor','Arzt',40,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), diff --git a/localization/en_esx_ambulancejob.sql b/localization/en_esx_ambulancejob.sql index 1c713441..87c43e10 100644 --- a/localization/en_esx_ambulancejob.sql +++ b/localization/en_esx_ambulancejob.sql @@ -4,6 +4,15 @@ INSERT INTO `addon_account` (name, label, shared) VALUES ('society_ambulance', 'Ambulance', 1) ; +INSERT INTO `addon_inventory` (name, label, shared) VALUES + ('society_ambulance', 'Ambulance', 1) +; + +INSERT INTO `datastore` (name, label, shared) VALUES + ('society_ambulance', 'Ambulance', 1) +; + + INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_female) VALUES ('ambulance',0,'ambulance','Ambulance',20,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), ('ambulance',1,'doctor','Doctor',40,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), From 784aa4e1df8ec78a1c765e77b2ab1c123b0669ef Mon Sep 17 00:00:00 2001 From: MarioRogue <34819886+MarioRogue@users.noreply.github.com> Date: Sat, 9 Jun 2018 23:27:44 +0300 Subject: [PATCH 081/177] No more respawn for no reason --- client/main.lua | 44 ++++++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/client/main.lua b/client/main.lua index 71730d3e..89b66ab5 100644 --- a/client/main.lua +++ b/client/main.lua @@ -58,29 +58,33 @@ AddEventHandler('esx_ambulancejob:heal', function(_type) end) function StartRespawnToHospitalMenuTimer() - ESX.SetTimeout(Config.MenuRespawnToHospitalDelay, function() - ESX.UI.Menu.Open( - 'default', GetCurrentResourceName(), 'respawn_hospital', - { - title = _U('respawn_at_hospital'), - align = 'top-left', - elements = { - {label = _U('no'), value = 'no'}, - {label = _U('yes'), value = 'yes'} - } - }, function(data, menu) - if data.current.value == 'yes' then - RemoveItemsAfterRPDeath() - end - menu.close() - end) - end) + ESX.SetTimeout(Config.MenuRespawnToHospitalDelay, function() + if IsDead then + ESX.UI.Menu.Open( + 'default', GetCurrentResourceName(), 'respawn_hospital', + { + title = _U('respawn_at_hospital'), + align = 'bottom-right', + elements = { + {label = _U('no'), value = 'no'}, + {label = _U('yes'), value = 'yes'} + } + }, function(data, menu) + if data.current.value == 'yes' then + RemoveItemsAfterRPDeath() + end + menu.close() + end) + end + end) end function StartRespawnTimer() - ESX.SetTimeout(Config.RespawnDelayAfterRPDeath, function() - RemoveItemsAfterRPDeath() - end) + ESX.SetTimeout(Config.RespawnDelayAfterRPDeath, function() + if IsDead then + RemoveItemsAfterRPDeath() + end + end) end function StartDistressSignal() From 21ebb24665d29f018420ac1a81fa79781d99ef3f Mon Sep 17 00:00:00 2001 From: AdrineX Date: Tue, 12 Jun 2018 19:09:38 +0300 Subject: [PATCH 082/177] Add Finnish lang... --- __resource.lua | 2 + locales/fi.lua | 67 ++++++++++++++++++++++++++++ localization/fi_esx_ambulancejob.sql | 32 +++++++++++++ 3 files changed, 101 insertions(+) create mode 100644 locales/fi.lua create mode 100644 localization/fi_esx_ambulancejob.sql diff --git a/__resource.lua b/__resource.lua index e1fc7001..587fa83f 100644 --- a/__resource.lua +++ b/__resource.lua @@ -10,6 +10,7 @@ server_scripts { 'locales/de.lua', 'locales/br.lua', 'locales/en.lua', + 'locales/fi.lua', 'locales/fr.lua', 'locales/es.lua', 'locales/sv.lua', @@ -22,6 +23,7 @@ client_scripts { 'locales/de.lua', 'locales/br.lua', 'locales/en.lua', + 'locales/fi.lua', 'locales/fr.lua', 'locales/es.lua', 'locales/sv.lua', diff --git a/locales/fi.lua b/locales/fi.lua new file mode 100644 index 00000000..4f49482c --- /dev/null +++ b/locales/fi.lua @@ -0,0 +1,67 @@ +Locales['fi'] = { + -- Cloakroom + ['cloakroom'] = 'Vaatelokero', + ['ems_clothes_civil'] = 'Siviilikamppeet', + ['ems_clothes_ems'] = 'Työkamppeet', + -- Vehicles + ['veh_menu'] = 'ajoneuvo', + ['veh_spawn'] = 'paina ~INPUT_CONTEXT~ otaaksesi ajoneuvon', + ['store_veh'] = 'paina ~INPUT_CONTEXT~ laittaaksesi auto säilöön', + ['ambulance'] = 'ambulanssi', + ['helicopter'] = 'helikopteri', + -- Action Menu + ['hospital'] = 'sairaala', + ['revive_inprogress'] = 'elvytys on menossa!', + ['revive_complete'] = 'sinä elvytit henkilön ~y~%s~s~', + ['revive_complete_award'] = 'sinä elvytit henkilön ~y~%s~s~ ja tienasit ~g~$%s~s~!', + ['heal_inprogress'] = 'sinä olet parantamassa!', + ['heal_complete'] = 'sinä paransit henkilön ~y~%s~s~', + ['no_players'] = 'ei pelaajia lähettyvillä', + ['no_vehicles'] = 'ei ajoneuvoja lähettyvillä', + ['player_not_unconscious'] = 'tämä pelaaja ei ole tajuton!', + ['player_not_conscious'] = 'tämä pelaaja ei ole tajuissaan!', + -- Boss Menu + ['deposit_society'] = 'ensihoito talletus', + ['withdraw_society'] = 'ensihoito nosto', + ['boss_actions'] = 'pomovalikko', + -- Misc + ['invalid_amount'] = '~r~Virheellinen summa', + ['open_menu'] = 'paina ~INPUT_CONTEXT~ avataksesi menun', + ['deposit_amount'] = 'talletettava summa', + ['money_withdraw'] = 'nostettava summa', + ['fast_travel'] = 'paina ~INPUT_CONTEXT~ liikkuaksesi nopeasti kerrosten välillä', + ['open_pharmacy'] = 'paina ~INPUT_CONTEXT~ avataksesi lääkekaappi', + ['pharmacy_menu_title'] = 'lääkekaappi', + ['pharmacy_take'] = 'ota', + ['medikit'] = 'ensiapupakkauksia', + ['bandage'] = 'sideharsoja', + ['max_item'] = 'sinulla on jo tarpeeksi mukana', + -- F6 Menu + ['ems_menu'] = 'ensihoito menu', + ['ems_menu_title'] = 'ensihoito - Siviilin kanssakäyminen', + ['ems_menu_revive'] = 'elvytä', + ['ems_menu_putincar'] = 'Laita ajoneuvoon', + ['ems_menu_small'] = 'hoida pieniä haavoja', + ['ems_menu_big'] = 'hoida isoja haavoja', + -- Phone + ['alert_ambulance'] = 'hälyytys Ensihoidolle', + -- Death + ['respawn_at_hospital'] = 'haluatko respawnata sairaalalle heti ?', + ['yes'] = 'kyllä', + ['no'] = 'ei', + ['please_wait'] = 'olet tajuton, vuodat kuiviin ~b~%s minuutin ja %s sekunnin~s~ kuluttua', + ['press_respawn'] = 'paina [~b~E~w~] respawnataksesi.', + ['respawn_fine'] = 'sinä maksoit ~r~$%s~s~ respawnaamisesta.', + ['distress_send'] = 'paina ~b~[G]~s~ lähettääksesi hätäsignaalin', + ['distress_sent'] = 'hätäsignaali lähetetty vapailla yksiköille.', + ['distress_message'] = 'tarvittava ensihoitoa: tajuton kansalainen!', + -- Revive + ['revive_help'] = 'elvytä pelaaja', + -- Item + ['used_medikit'] = 'sinä käytit ensiapupakkauksen', + ['used_bandage'] = 'sinä käytit sideharsoja', + ['not_enough_medikit'] = 'ei tarpeeksi ~b~ensiapupakkauksia~w~.', + ['not_enough_bandage'] = 'ei tarpeeksi ~b~sideharsoja~w~.', + ['healed'] = 'sinua parannettiin', + -- Misc +} diff --git a/localization/fi_esx_ambulancejob.sql b/localization/fi_esx_ambulancejob.sql new file mode 100644 index 00000000..4e6be961 --- /dev/null +++ b/localization/fi_esx_ambulancejob.sql @@ -0,0 +1,32 @@ +USE `essentialmode`; + +INSERT INTO `addon_account` (name, label, shared) VALUES + ('society_ambulance', 'Ensihoito', 1) +; + +INSERT INTO `addon_inventory` (name, label, shared) VALUES + ('society_ambulance', 'Ensihoito', 1) +; + +INSERT INTO `datastore` (name, label, shared) VALUES + ('society_ambulance', 'Ensihoito', 1) +; + + +INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_female) VALUES + ('ambulance',0,'ambulance','Ensihoitaja',20,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), + ('ambulance',1,'doctor','Lääkäri',40,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), + ('ambulance',2,'chief_doctor','Yli-lääkäri',60,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), + ('ambulance',3,'boss','Kirurgi',80,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}') +; + +INSERT INTO `jobs` (name, label) VALUES + ('ambulance','Ensihoito') +; + +INSERT INTO `items` (name, label, `limit`) VALUES + ('bandage','Sideharso', 20), + ('medikit','Ensiapupakkaus', 5) +; + +ALTER TABLE `users` ADD `isDead` BIT(1) DEFAULT b'0' \ No newline at end of file From fdcc9ab9e542e8fe1db247c28b09cde0c3796557 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Wed, 20 Jun 2018 21:24:00 +0200 Subject: [PATCH 083/177] Fixed RemoveWeaponsAfterRPDeath, fixes #21 --- __resource.lua | 2 ++ client/main.lua | 2 +- server/main.lua | 69 ++++++++++++++++++++++++++++--------------------- 3 files changed, 43 insertions(+), 30 deletions(-) diff --git a/__resource.lua b/__resource.lua index e1fc7001..2034722b 100644 --- a/__resource.lua +++ b/__resource.lua @@ -28,3 +28,5 @@ client_scripts { 'config.lua', 'client/main.lua' } + +dependency 'es_extended' \ No newline at end of file diff --git a/client/main.lua b/client/main.lua index 89b66ab5..f326b759 100644 --- a/client/main.lua +++ b/client/main.lua @@ -647,7 +647,7 @@ AddEventHandler('esx_phone:loaded', function(phoneNumber, contacts) end) -AddEventHandler('esx:onPlayerDeath', function() +AddEventHandler('esx:onPlayerDeath', function(reason) OnPlayerDeath() end) diff --git a/server/main.lua b/server/main.lua index 87aad058..4f72535e 100644 --- a/server/main.lua +++ b/server/main.lua @@ -21,42 +21,53 @@ TriggerEvent('esx_phone:registerNumber', 'ambulance', _U('alert_ambulance'), tru TriggerEvent('esx_society:registerSociety', 'ambulance', 'Ambulance', 'society_ambulance', 'society_ambulance', 'society_ambulance', {type = 'public'}) ESX.RegisterServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function(source, cb) + local xPlayer = ESX.GetPlayerFromId(source) - local xPlayer = ESX.GetPlayerFromId(source) + if Config.RemoveCashAfterRPDeath then + if xPlayer.getMoney() > 0 then + xPlayer.removeMoney(xPlayer.getMoney()) + end - if Config.RemoveCashAfterRPDeath then + if xPlayer.getAccount('black_money').money > 0 then + xPlayer.setAccountMoney('black_money', 0) + end + end - if xPlayer.getMoney() > 0 then - xPlayer.removeMoney(xPlayer.getMoney()) - end + if Config.RemoveItemsAfterRPDeath then + for i=1, #xPlayer.inventory, 1 do + if xPlayer.inventory[i].count > 0 then + xPlayer.setInventoryItem(xPlayer.inventory[i].name, 0) + end + end + end - if xPlayer.getAccount('black_money').money > 0 then - xPlayer.setAccountMoney('black_money', 0) - end + local playerLoadout = {} + if Config.RemoveWeaponsAfterRPDeath then + for i=1, #xPlayer.loadout, 1 do + xPlayer.removeWeapon(xPlayer.loadout[i].name) + end + else -- save weapons & restore em' since + for i=1, #xPlayer.loadout, 1 do + table.insert(playerLoadout, xPlayer.loadout[i]) + end - end + -- give back wepaons after a couple of seconds + Citizen.CreateThread(function() + Citizen.Wait(5000) + for i=1, #playerLoadout, 1 do + if playerLoadout[i].label ~= nil then + xPlayer.addWeapon(playerLoadout[i].name, playerLoadout[i].ammo) + end + end + end) + end - if Config.RemoveItemsAfterRPDeath then - for i=1, #xPlayer.inventory, 1 do - if xPlayer.inventory[i].count > 0 then - xPlayer.setInventoryItem(xPlayer.inventory[i].name, 0) - end - end - end - - if Config.RemoveWeaponsAfterRPDeath then - for i=1, #xPlayer.loadout, 1 do - xPlayer.removeWeapon(xPlayer.loadout[i].name) - end - end - - if Config.RespawnFine then - TriggerClientEvent('esx:showNotification', xPlayer.source, _U('respawn_fine', Config.RespawnFineAmount)) - xPlayer.removeAccountMoney('bank', Config.RespawnFineAmount) - end - - cb() + if Config.RespawnFine then + TriggerClientEvent('esx:showNotification', xPlayer.source, _U('respawn_fine', Config.RespawnFineAmount)) + xPlayer.removeAccountMoney('bank', Config.RespawnFineAmount) + end + cb() end) ESX.RegisterServerCallback('esx_ambulancejob:getItemAmount', function(source, cb, item) From d484bda786bde2540d95aaee5484e76a34d8cbd5 Mon Sep 17 00:00:00 2001 From: MajorMarcin Date: Thu, 28 Jun 2018 19:41:38 +0200 Subject: [PATCH 084/177] added Polish language --- locales/pl.lua | 63 ++++++++++++++++++++++++++++ localization/pl_esx_ambulancejob.sql | 32 ++++++++++++++ 2 files changed, 95 insertions(+) create mode 100644 locales/pl.lua create mode 100644 localization/pl_esx_ambulancejob.sql diff --git a/locales/pl.lua b/locales/pl.lua new file mode 100644 index 00000000..17a9c143 --- /dev/null +++ b/locales/pl.lua @@ -0,0 +1,63 @@ +Locales['pl'] = { + -- Cloakroom + ['cloakroom'] = 'szatnia', + ['ems_clothes_civil'] = 'ubrania cywilne', + ['ems_clothes_ems'] = 'Ubrania EMS', + -- Vehicles + ['veh_menu'] = 'pojazdy', + ['veh_spawn'] = 'Naciśnij ~INPUT_CONTEXT~ żeby wziąść Pojazd lub Helikopter', + ['store_veh'] = 'Naciśnij ~INPUT_CONTEXT~ żeby przechować pojazd', + ['ambulance'] = 'ambulans', + ['helicopter'] = 'helikopter', + -- Action Menu + ['hospital'] = 'szpital', + ['revive_inprogress'] = 'trwa wskrzeszenie', + ['revive_complete'] = 'Zostałeś wskrzeszony ~y~%s~s~', + ['revive_complete_award'] = 'Zostałeś wskrzeszony ~y~%s~s~ i zarobiono ~g~$%s~s~!', + ['heal_inprogress'] = 'Leczysz!', + ['heal_complete'] = 'Zostałeś uleczony ~y~%s~s~', + ['no_players'] = 'Brak graczy w pobliżu', + ['no_vehicles'] = 'Brak pojazdów w pobliżu', + ['player_not_unconscious'] = 'Ten gracz nie jest nieprzytomny!', + ['player_not_conscious'] = 'Ten gracz nie jest świadomy!', + -- Boss Menu + ['deposit_society'] = 'Zdeponuj do EMS', + ['withdraw_society'] = 'Wyjmij z depozytu EMS', + ['boss_actions'] = 'Akcje szefa', + -- Misc + ['invalid_amount'] = '~r~nieprawidłowa kwota', + ['open_menu'] = 'Naciśnij ~INPUT_CONTEXT~ aby otworzyc menu', + ['deposit_amount'] = 'kwota depozytu', + ['money_withdraw'] = 'wycofana kwota', + ['fast_travel'] = 'Naciśnij na ~INPUT_CONTEXT~ do szybkiej podróży.', + ['open_pharmacy'] = 'Naciśnij na ~INPUT_CONTEXT~ aby otworzyć aptekę', + ['pharmacy_menu_title'] = 'Apteka', + ['pharmacy_take'] = 'Weź', + ['medikit'] = 'apteczka', + ['bandage'] = 'bandaż', + ['max_item'] = 'Już masz na sobie dość.', + -- F6 Menu + ['ems_menu'] = 'Menu EMS', + ['ems_menu_title'] = 'EMS Menu - Ambulans', + ['ems_menu_revive'] = 'Ożyw gracza', + ['ems_menu_putincar'] = 'umieścić w pojeździe', + ['ems_menu_small'] = 'Ulecz małe rany', + ['ems_menu_big'] = 'Ulecz poważne obrażenia', + -- Phone + ['alert_ambulance'] = 'Wezwij ambulans', + -- Death + ['respawn_at_hospital'] = 'Czy chcesz odrodzić się w szpitalu?', + ['yes'] = 'tak', + ['please_wait'] = 'Jesteś nieprzytomny i będziesz się wykrwawiał ~b~%s minut i %s sekund~s~', + ['press_respawn'] = 'Naciśnij [~b~E~w~] aby się odrodzić.', + ['respawn_fine'] = 'Zapłaciłeś ~r~$%s~s~ za odrodzenie.', + -- Revive + ['revive_help'] = 'Ożyw gracza', + -- Item + ['used_medikit'] = 'Użyłeś 1x Apteczki', + ['used_bandage'] = 'Użyłeś 1x Bandaża', + ['not_enough_medikit'] = 'Nie posiadasz ~b~apteczki~w~.', + ['not_enough_bandage'] = 'Nie posiadasz ~b~bandaża~w~.', + ['healed'] = 'zostałeś potraktowany', + -- Misc +} diff --git a/localization/pl_esx_ambulancejob.sql b/localization/pl_esx_ambulancejob.sql new file mode 100644 index 00000000..abbad63c --- /dev/null +++ b/localization/pl_esx_ambulancejob.sql @@ -0,0 +1,32 @@ +USE `essentialmode`; + +INSERT INTO `addon_account` (name, label, shared) VALUES + ('society_ambulance', 'Ambulance', 1) +; + +INSERT INTO `addon_inventory` (name, label, shared) VALUES + ('society_ambulance', 'Ambulance', 1) +; + +INSERT INTO `datastore` (name, label, shared) VALUES + ('society_ambulance', 'Pogotowie ratunkowe', 1) +; + + +INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_female) VALUES + ('ambulance',0,'ambulance','Ratownik',20,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), + ('ambulance',1,'doctor','Lekarz',40,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), + ('ambulance',2,'chief_doctor','Chirurg',60,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), + ('ambulance',3,'boss','Ordynator',80,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}') +; + +INSERT INTO `jobs` (name, label) VALUES + ('ambulance','Pogotowie ratunkowe') +; + +INSERT INTO `items` (name, label, `limit`) VALUES + ('bandage','Bandaż', 20), + ('medikit','Defibrylator', 5) +; + +ALTER TABLE `users` ADD `isDead` BIT(1) DEFAULT b'0' \ No newline at end of file From fb7e6e537c81396a04e51ce251993fa786f1d0e6 Mon Sep 17 00:00:00 2001 From: MajorMarcin Date: Sat, 30 Jun 2018 19:06:02 +0200 Subject: [PATCH 085/177] fix lowercase --- locales/pl.lua | 70 +++++++++++++++++++++++++------------------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/locales/pl.lua b/locales/pl.lua index 17a9c143..483a843d 100644 --- a/locales/pl.lua +++ b/locales/pl.lua @@ -2,62 +2,62 @@ Locales['pl'] = { -- Cloakroom ['cloakroom'] = 'szatnia', ['ems_clothes_civil'] = 'ubrania cywilne', - ['ems_clothes_ems'] = 'Ubrania EMS', + ['ems_clothes_ems'] = 'ubrania EMS', -- Vehicles ['veh_menu'] = 'pojazdy', - ['veh_spawn'] = 'Naciśnij ~INPUT_CONTEXT~ żeby wziąść Pojazd lub Helikopter', - ['store_veh'] = 'Naciśnij ~INPUT_CONTEXT~ żeby przechować pojazd', + ['veh_spawn'] = 'naciśnij ~INPUT_CONTEXT~ żeby wziąść Pojazd lub Helikopter', + ['store_veh'] = 'naciśnij ~INPUT_CONTEXT~ żeby przechować pojazd', ['ambulance'] = 'ambulans', ['helicopter'] = 'helikopter', -- Action Menu ['hospital'] = 'szpital', ['revive_inprogress'] = 'trwa wskrzeszenie', - ['revive_complete'] = 'Zostałeś wskrzeszony ~y~%s~s~', - ['revive_complete_award'] = 'Zostałeś wskrzeszony ~y~%s~s~ i zarobiono ~g~$%s~s~!', - ['heal_inprogress'] = 'Leczysz!', - ['heal_complete'] = 'Zostałeś uleczony ~y~%s~s~', - ['no_players'] = 'Brak graczy w pobliżu', - ['no_vehicles'] = 'Brak pojazdów w pobliżu', - ['player_not_unconscious'] = 'Ten gracz nie jest nieprzytomny!', - ['player_not_conscious'] = 'Ten gracz nie jest świadomy!', + ['revive_complete'] = 'zostałeś wskrzeszony ~y~%s~s~', + ['revive_complete_award'] = 'zostałeś wskrzeszony ~y~%s~s~ i zarobiono ~g~$%s~s~!', + ['heal_inprogress'] = 'leczysz!', + ['heal_complete'] = 'zostałeś uleczony ~y~%s~s~', + ['no_players'] = 'brak graczy w pobliżu', + ['no_vehicles'] = 'brak pojazdów w pobliżu', + ['player_not_unconscious'] = 'ten gracz nie jest nieprzytomny!', + ['player_not_conscious'] = 'ten gracz nie jest świadomy!', -- Boss Menu - ['deposit_society'] = 'Zdeponuj do EMS', - ['withdraw_society'] = 'Wyjmij z depozytu EMS', - ['boss_actions'] = 'Akcje szefa', + ['deposit_society'] = 'zdeponuj do EMS', + ['withdraw_society'] = 'wyjmij z depozytu EMS', + ['boss_actions'] = 'akcje szefa', -- Misc ['invalid_amount'] = '~r~nieprawidłowa kwota', - ['open_menu'] = 'Naciśnij ~INPUT_CONTEXT~ aby otworzyc menu', + ['open_menu'] = 'naciśnij ~INPUT_CONTEXT~ aby otworzyc menu', ['deposit_amount'] = 'kwota depozytu', ['money_withdraw'] = 'wycofana kwota', - ['fast_travel'] = 'Naciśnij na ~INPUT_CONTEXT~ do szybkiej podróży.', - ['open_pharmacy'] = 'Naciśnij na ~INPUT_CONTEXT~ aby otworzyć aptekę', - ['pharmacy_menu_title'] = 'Apteka', - ['pharmacy_take'] = 'Weź', + ['fast_travel'] = 'naciśnij na ~INPUT_CONTEXT~ do szybkiej podróży.', + ['open_pharmacy'] = 'naciśnij na ~INPUT_CONTEXT~ aby otworzyć aptekę', + ['pharmacy_menu_title'] = 'apteka', + ['pharmacy_take'] = 'weź', ['medikit'] = 'apteczka', ['bandage'] = 'bandaż', - ['max_item'] = 'Już masz na sobie dość.', + ['max_item'] = 'już masz na sobie dość.', -- F6 Menu - ['ems_menu'] = 'Menu EMS', - ['ems_menu_title'] = 'EMS Menu - Ambulans', - ['ems_menu_revive'] = 'Ożyw gracza', + ['ems_menu'] = 'menu EMS', + ['ems_menu_title'] = 'eMS Menu - Ambulans', + ['ems_menu_revive'] = 'ożyw gracza', ['ems_menu_putincar'] = 'umieścić w pojeździe', - ['ems_menu_small'] = 'Ulecz małe rany', - ['ems_menu_big'] = 'Ulecz poważne obrażenia', + ['ems_menu_small'] = 'ulecz małe rany', + ['ems_menu_big'] = 'ulecz poważne obrażenia', -- Phone - ['alert_ambulance'] = 'Wezwij ambulans', + ['alert_ambulance'] = 'wezwij ambulans', -- Death - ['respawn_at_hospital'] = 'Czy chcesz odrodzić się w szpitalu?', + ['respawn_at_hospital'] = 'czy chcesz odrodzić się w szpitalu?', ['yes'] = 'tak', - ['please_wait'] = 'Jesteś nieprzytomny i będziesz się wykrwawiał ~b~%s minut i %s sekund~s~', - ['press_respawn'] = 'Naciśnij [~b~E~w~] aby się odrodzić.', - ['respawn_fine'] = 'Zapłaciłeś ~r~$%s~s~ za odrodzenie.', + ['please_wait'] = 'jesteś nieprzytomny i będziesz się wykrwawiał ~b~%s minut i %s sekund~s~', + ['press_respawn'] = 'naciśnij [~b~E~w~] aby się odrodzić.', + ['respawn_fine'] = 'zapłaciłeś ~r~$%s~s~ za odrodzenie.', -- Revive - ['revive_help'] = 'Ożyw gracza', + ['revive_help'] = 'ożyw gracza', -- Item - ['used_medikit'] = 'Użyłeś 1x Apteczki', - ['used_bandage'] = 'Użyłeś 1x Bandaża', - ['not_enough_medikit'] = 'Nie posiadasz ~b~apteczki~w~.', - ['not_enough_bandage'] = 'Nie posiadasz ~b~bandaża~w~.', + ['used_medikit'] = 'użyłeś 1x Apteczki', + ['used_bandage'] = 'użyłeś 1x Bandaża', + ['not_enough_medikit'] = 'nie posiadasz ~b~apteczki~w~.', + ['not_enough_bandage'] = 'nie posiadasz ~b~bandaża~w~.', ['healed'] = 'zostałeś potraktowany', -- Misc } From 83d0f2fc20eabdaa423a99ae050a4935117ffed8 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Tue, 3 Jul 2018 00:19:55 +0200 Subject: [PATCH 086/177] Yet a possible fix for auto-respawn bug, fixed money dupe by reviving multiple times --- client/main.lua | 278 ++++++++++++++++++++++++------------------------ 1 file changed, 140 insertions(+), 138 deletions(-) diff --git a/client/main.lua b/client/main.lua index f326b759..a201a96a 100644 --- a/client/main.lua +++ b/client/main.lua @@ -10,7 +10,6 @@ local Keys = { ["NENTER"] = 201, ["N4"] = 108, ["N5"] = 60, ["N6"] = 107, ["N+"] = 96, ["N-"] = 97, ["N7"] = 117, ["N8"] = 61, ["N9"] = 118 } -local GUI = {} local PlayerData = {} local FirstSpawn = true local IsDead = false @@ -19,9 +18,9 @@ local LastZone = nil local CurrentAction = nil local CurrentActionMsg = '' local CurrentActionData = {} +local IsBusy = false ESX = nil -GUI.Time = 0 Citizen.CreateThread(function() while ESX == nil do @@ -58,33 +57,32 @@ AddEventHandler('esx_ambulancejob:heal', function(_type) end) function StartRespawnToHospitalMenuTimer() - ESX.SetTimeout(Config.MenuRespawnToHospitalDelay, function() - if IsDead then - ESX.UI.Menu.Open( - 'default', GetCurrentResourceName(), 'respawn_hospital', - { - title = _U('respawn_at_hospital'), - align = 'bottom-right', - elements = { - {label = _U('no'), value = 'no'}, - {label = _U('yes'), value = 'yes'} - } - }, function(data, menu) - if data.current.value == 'yes' then - RemoveItemsAfterRPDeath() - end - menu.close() - end) - end - end) + Citizen.SetTimeout(Config.MenuRespawnToHospitalDelay, function() + if IsDead then + ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'respawn_hospital', + { + title = _U('respawn_at_hospital'), + align = 'bottom-right', + elements = { + {label = _U('no'), value = 'no'}, + {label = _U('yes'), value = 'yes'} + } + }, function(data, menu) + if data.current.value == 'yes' then + RemoveItemsAfterRPDeath() + end + menu.close() + end) + end + end) end function StartRespawnTimer() - ESX.SetTimeout(Config.RespawnDelayAfterRPDeath, function() - if IsDead then - RemoveItemsAfterRPDeath() - end - end) + Citizen.SetTimeout(Config.RespawnDelayAfterRPDeath, function() + if IsDead then + RemoveItemsAfterRPDeath() + end + end) end function StartDistressSignal() @@ -357,123 +355,128 @@ function OpenMobileAmbulanceActionsMenu() {label = _U('ems_menu_putincar'), value = 'put_in_vehicle'}, } }, function(data, menu) - if data.current.value == 'revive' then -- revive - - local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() - - if closestPlayer == -1 or closestDistance > 3.0 then - ESX.ShowNotification(_U('no_players')) - else - ESX.TriggerServerCallback('esx_ambulancejob:getItemAmount', function(qtty) - if qtty > 0 then - local closestPlayerPed = GetPlayerPed(closestPlayer) - local health = GetEntityHealth(closestPlayerPed) - - if health == 0 then - local playerPed = GetPlayerPed(-1) - - ESX.ShowNotification(_U('revive_inprogress')) - TaskStartScenarioInPlace(playerPed, 'CODE_HUMAN_MEDIC_TEND_TO_DEAD', 0, true) - Citizen.Wait(10000) - ClearPedTasks(playerPed) - - TriggerServerEvent('esx_ambulancejob:removeItem', 'medikit') - TriggerServerEvent('esx_ambulancejob:revive', GetPlayerServerId(closestPlayer)) - - -- Show revive award? - if Config.ReviveReward > 0 then - ESX.ShowNotification(_U('revive_complete_award', GetPlayerName(closestPlayer), Config.ReviveReward)) - else - ESX.ShowNotification(_U('revive_complete', GetPlayerName(closestPlayer))) - end - else - ESX.ShowNotification(_U('player_not_unconscious')) - end - else - ESX.ShowNotification(_U('not_enough_medikit')) - end - end, 'medikit') - end - elseif data.current.value == 'small' then + if IsBusy then return end + if data.current.value == 'revive' then -- revive - local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() - if closestPlayer == -1 or closestDistance > 3.0 then - ESX.ShowNotification(_U('no_players')) - else - ESX.TriggerServerCallback('esx_ambulancejob:getItemAmount', function(qtty) - if qtty > 0 then - local closestPlayerPed = GetPlayerPed(closestPlayer) - local health = GetEntityHealth(closestPlayerPed) - - if health > 0 then - local playerPed = GetPlayerPed(-1) - ESX.ShowNotification(_U('heal_inprogress')) - TaskStartScenarioInPlace(playerPed, 'CODE_HUMAN_MEDIC_TEND_TO_DEAD', 0, true) - Citizen.Wait(10000) - ClearPedTasks(playerPed) - - TriggerServerEvent('esx_ambulancejob:removeItem', 'bandage') - TriggerServerEvent('esx_ambulancejob:heal', GetPlayerServerId(closestPlayer), 'small') - ESX.ShowNotification(_U('heal_complete', GetPlayerName(closestPlayer))) - else - ESX.ShowNotification(_U('player_not_conscious')) - end - else - ESX.ShowNotification(_U('not_enough_bandage')) - end - end, 'bandage') - end - elseif data.current.value == 'big' then - - local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() - if closestPlayer == -1 or closestDistance > 3.0 then - ESX.ShowNotification(_U('no_players')) - else - ESX.TriggerServerCallback('esx_ambulancejob:getItemAmount', function(qtty) - if qtty > 0 then - local closestPlayerPed = GetPlayerPed(closestPlayer) - local health = GetEntityHealth(closestPlayerPed) - - if health > 0 then - local playerPed = GetPlayerPed(-1) - ESX.ShowNotification(_U('heal_inprogress')) - TaskStartScenarioInPlace(playerPed, 'CODE_HUMAN_MEDIC_TEND_TO_DEAD', 0, true) - Citizen.Wait(10000) - ClearPedTasks(playerPed) - - TriggerServerEvent('esx_ambulancejob:removeItem', 'medikit') - TriggerServerEvent('esx_ambulancejob:heal', GetPlayerServerId(closestPlayer), 'big') - ESX.ShowNotification(_U('heal_complete', GetPlayerName(closestPlayer))) - else - ESX.ShowNotification(_U('player_not_conscious')) - end - else - ESX.ShowNotification(_U('not_enough_medikit')) - end - end, 'medikit') - end - elseif data.current.value == 'put_in_vehicle' then + local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() - local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() - if closestPlayer == -1 or closestDistance > 3.0 then - ESX.ShowNotification(_U('no_vehicles')) - else - menu.close() - WarpPedInClosestVehicle(GetPlayerPed(closestPlayer)) - end - end - end, function(data, menu) - menu.close() - end - ) + if closestPlayer == -1 or closestDistance > 3.0 then + ESX.ShowNotification(_U('no_players')) + else + ESX.TriggerServerCallback('esx_ambulancejob:getItemAmount', function(qtty) + if qtty > 0 then + local closestPlayerPed = GetPlayerPed(closestPlayer) + local health = GetEntityHealth(closestPlayerPed) + + if health == 0 then + local playerPed = GetPlayerPed(-1) + IsBusy = true + ESX.ShowNotification(_U('revive_inprogress')) + TaskStartScenarioInPlace(playerPed, 'CODE_HUMAN_MEDIC_TEND_TO_DEAD', 0, true) + Citizen.Wait(10000) + ClearPedTasks(playerPed) + + TriggerServerEvent('esx_ambulancejob:removeItem', 'medikit') + TriggerServerEvent('esx_ambulancejob:revive', GetPlayerServerId(closestPlayer)) + IsBusy = false + + -- Show revive award? + if Config.ReviveReward > 0 then + ESX.ShowNotification(_U('revive_complete_award', GetPlayerName(closestPlayer), Config.ReviveReward)) + else + ESX.ShowNotification(_U('revive_complete', GetPlayerName(closestPlayer))) + end + else + ESX.ShowNotification(_U('player_not_unconscious')) + end + else + ESX.ShowNotification(_U('not_enough_medikit')) + end + end, 'medikit') + end + elseif data.current.value == 'small' then + + local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() + if closestPlayer == -1 or closestDistance > 3.0 then + ESX.ShowNotification(_U('no_players')) + else + ESX.TriggerServerCallback('esx_ambulancejob:getItemAmount', function(qtty) + if qtty > 0 then + local closestPlayerPed = GetPlayerPed(closestPlayer) + local health = GetEntityHealth(closestPlayerPed) + + if health > 0 then + local playerPed = GetPlayerPed(-1) + + IsBusy = true + ESX.ShowNotification(_U('heal_inprogress')) + TaskStartScenarioInPlace(playerPed, 'CODE_HUMAN_MEDIC_TEND_TO_DEAD', 0, true) + Citizen.Wait(10000) + ClearPedTasks(playerPed) + + TriggerServerEvent('esx_ambulancejob:removeItem', 'bandage') + TriggerServerEvent('esx_ambulancejob:heal', GetPlayerServerId(closestPlayer), 'small') + ESX.ShowNotification(_U('heal_complete', GetPlayerName(closestPlayer))) + IsBusy = false + else + ESX.ShowNotification(_U('player_not_conscious')) + end + else + ESX.ShowNotification(_U('not_enough_bandage')) + end + end, 'bandage') + end + elseif data.current.value == 'big' then + + local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() + if closestPlayer == -1 or closestDistance > 3.0 then + ESX.ShowNotification(_U('no_players')) + else + ESX.TriggerServerCallback('esx_ambulancejob:getItemAmount', function(qtty) + if qtty > 0 then + local closestPlayerPed = GetPlayerPed(closestPlayer) + local health = GetEntityHealth(closestPlayerPed) + + if health > 0 then + local playerPed = GetPlayerPed(-1) + + IsBusy = true + ESX.ShowNotification(_U('heal_inprogress')) + TaskStartScenarioInPlace(playerPed, 'CODE_HUMAN_MEDIC_TEND_TO_DEAD', 0, true) + Citizen.Wait(10000) + ClearPedTasks(playerPed) + + TriggerServerEvent('esx_ambulancejob:removeItem', 'medikit') + TriggerServerEvent('esx_ambulancejob:heal', GetPlayerServerId(closestPlayer), 'big') + ESX.ShowNotification(_U('heal_complete', GetPlayerName(closestPlayer))) + IsBusy = false + else + ESX.ShowNotification(_U('player_not_conscious')) + end + else + ESX.ShowNotification(_U('not_enough_medikit')) + end + end, 'medikit') + end + elseif data.current.value == 'put_in_vehicle' then + + local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() + if closestPlayer == -1 or closestDistance > 3.0 then + ESX.ShowNotification(_U('no_vehicles')) + else + menu.close() + WarpPedInClosestVehicle(GetPlayerPed(closestPlayer)) + end + end + end, function(data, menu) + menu.close() + end) end end, function(data, menu) menu.close() - end - ) - + end) end function OpenCloakroomMenu() @@ -912,7 +915,7 @@ Citizen.CreateThread(function() end - if IsControlJustReleased(0, Keys['F6']) and PlayerData.job ~= nil and PlayerData.job.name == 'ambulance' then + if IsControlJustReleased(0, Keys['F6']) and PlayerData.job ~= nil and PlayerData.job.name == 'ambulance' and not IsDead then OpenMobileAmbulanceActionsMenu() end @@ -922,7 +925,6 @@ end) RegisterNetEvent('esx_ambulancejob:requestDeath') AddEventHandler('esx_ambulancejob:requestDeath', function() if Config.AntiCombatLog then - Citizen.Wait(5000) SetEntityHealth(GetPlayerPed(-1), 0) end end) From 0a069ec161508d1f754b0f8cff0c6aa0b1328c87 Mon Sep 17 00:00:00 2001 From: MajorMarcin Date: Thu, 5 Jul 2018 15:21:00 +0200 Subject: [PATCH 087/177] lowercapse edit --- locales/pl.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/locales/pl.lua b/locales/pl.lua index 483a843d..1e8b1663 100644 --- a/locales/pl.lua +++ b/locales/pl.lua @@ -25,7 +25,7 @@ Locales['pl'] = { ['withdraw_society'] = 'wyjmij z depozytu EMS', ['boss_actions'] = 'akcje szefa', -- Misc - ['invalid_amount'] = '~r~nieprawidłowa kwota', + ['invalid_amount'] = '~r~Nieprawidłowa kwota', ['open_menu'] = 'naciśnij ~INPUT_CONTEXT~ aby otworzyc menu', ['deposit_amount'] = 'kwota depozytu', ['money_withdraw'] = 'wycofana kwota', From 2ba1d9fc2673bd501c5c786f92f06c490146ecf1 Mon Sep 17 00:00:00 2001 From: MajorMarcin Date: Sat, 7 Jul 2018 15:41:28 +0200 Subject: [PATCH 088/177] add pl to resource --- __resource.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/__resource.lua b/__resource.lua index a3c84199..fb66dda0 100644 --- a/__resource.lua +++ b/__resource.lua @@ -14,6 +14,7 @@ server_scripts { 'locales/fr.lua', 'locales/es.lua', 'locales/sv.lua', + 'locales/pl.lua', 'config.lua', 'server/main.lua' } @@ -27,6 +28,7 @@ client_scripts { 'locales/fr.lua', 'locales/es.lua', 'locales/sv.lua', + 'locales/pl.lua', 'config.lua', 'client/main.lua' } From 567378710e552545064809286e187decb490afd9 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Tue, 10 Jul 2018 12:57:42 +0200 Subject: [PATCH 089/177] Fixed walking when dead --- client/main.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/client/main.lua b/client/main.lua index a201a96a..1e2a7f16 100644 --- a/client/main.lua +++ b/client/main.lua @@ -925,6 +925,7 @@ end) RegisterNetEvent('esx_ambulancejob:requestDeath') AddEventHandler('esx_ambulancejob:requestDeath', function() if Config.AntiCombatLog then + Citizen.Wait(5000) SetEntityHealth(GetPlayerPed(-1), 0) end end) From bdb0c685695c1a50317fa6a311edb700309c1168 Mon Sep 17 00:00:00 2001 From: nearbyplayer Date: Fri, 10 Aug 2018 01:07:49 -0400 Subject: [PATCH 090/177] Respawn Timer Overhaul & Repo Update * Fixes #64 (Timer related) * Will need Locale translation --- .editorconfig | 6 +- LICENSE.txt => LICENSE | 0 client/main.lua | 1245 +++++++++++++------------- config.lua | 16 +- locales/br.lua | 13 +- locales/de.lua | 12 +- locales/en.lua | 15 +- locales/es.lua | 12 +- locales/fi.lua | 16 +- locales/fr.lua | 12 +- locales/pl.lua | 12 +- locales/sv.lua | 16 +- localization/en_esx_ambulancejob.sql | 16 +- server/main.lua | 107 ++- 14 files changed, 740 insertions(+), 758 deletions(-) rename LICENSE.txt => LICENSE (100%) diff --git a/.editorconfig b/.editorconfig index 41c2aaf2..9b425256 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,9 +1,9 @@ root = true [*] -indent_size = 2 -indent_style = space -end_of_line = lf +indent_size = 4 +indent_style = tab +end_of_line = crlf charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true \ No newline at end of file diff --git a/LICENSE.txt b/LICENSE similarity index 100% rename from LICENSE.txt rename to LICENSE diff --git a/client/main.lua b/client/main.lua index 1e2a7f16..08291653 100644 --- a/client/main.lua +++ b/client/main.lua @@ -1,31 +1,30 @@ 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 } -local PlayerData = {} -local FirstSpawn = true -local IsDead = false +local PlayerData = {} +local FirstSpawn = true +local IsDead = false local HasAlreadyEnteredMarker = false -local LastZone = nil -local CurrentAction = nil -local CurrentActionMsg = '' -local CurrentActionData = {} -local IsBusy = false - -ESX = nil +local LastZone = nil +local CurrentAction = nil +local CurrentActionMsg = '' +local CurrentActionData = {} +local IsBusy = false +ESX = nil Citizen.CreateThread(function() while ESX == nil do - TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) - Citizen.Wait(0) + TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) + Citizen.Wait(0) end Citizen.Wait(5000) @@ -47,149 +46,131 @@ AddEventHandler('esx_ambulancejob:heal', function(_type) local playerPed = GetPlayerPed(-1) local maxHealth = GetEntityMaxHealth(playerPed) if _type == 'small' then - local health = GetEntityHealth(playerPed) - local newHealth = math.min(maxHealth , math.floor(health + maxHealth/8)) - SetEntityHealth(playerPed, newHealth) + local health = GetEntityHealth(playerPed) + local newHealth = math.min(maxHealth , math.floor(health + maxHealth/8)) + SetEntityHealth(playerPed, newHealth) elseif _type == 'big' then - SetEntityHealth(playerPed, maxHealth) + SetEntityHealth(playerPed, maxHealth) end ESX.ShowNotification(_U('healed')) end) -function StartRespawnToHospitalMenuTimer() - Citizen.SetTimeout(Config.MenuRespawnToHospitalDelay, function() - if IsDead then - ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'respawn_hospital', - { - title = _U('respawn_at_hospital'), - align = 'bottom-right', - elements = { - {label = _U('no'), value = 'no'}, - {label = _U('yes'), value = 'yes'} - } - }, function(data, menu) - if data.current.value == 'yes' then - RemoveItemsAfterRPDeath() - end - menu.close() - end) - end - end) -end - function StartRespawnTimer() Citizen.SetTimeout(Config.RespawnDelayAfterRPDeath, function() - if IsDead then - RemoveItemsAfterRPDeath() - end + if IsDead then + RemoveItemsAfterRPDeath() + end end) end function StartDistressSignal() Citizen.CreateThread(function() - local timer = Config.RespawnDelayAfterRPDeath + local respawnTimer = Config.RespawnDelayAfterRPDeath - while timer > 0 and IsDead do - Citizen.Wait(2) - timer = timer - 30 + while respawnTimer > 0 and IsDead do + Citizen.Wait(2) + respawnTimer = respawnTimer - 30 - SetTextFont(4) - SetTextProportional(1) - SetTextScale(0.45, 0.45) - SetTextColour(185, 185, 185, 255) - SetTextDropShadow(0, 0, 0, 0, 255) - SetTextEdge(1, 0, 0, 0, 255) - SetTextDropShadow() - SetTextOutline() - BeginTextCommandDisplayText('STRING') - AddTextComponentSubstringPlayerName(_U('distress_send')) - EndTextCommandDisplayText(0.175, 0.805) + SetTextFont(4) + SetTextProportional(1) + SetTextScale(0.45, 0.45) + SetTextColour(185, 185, 185, 255) + SetTextDropShadow(0, 0, 0, 0, 255) + SetTextEdge(1, 0, 0, 0, 255) + SetTextDropShadow() + SetTextOutline() + BeginTextCommandDisplayText('STRING') + AddTextComponentSubstringPlayerName(_U('distress_send')) + EndTextCommandDisplayText(0.175, 0.805) - if IsControlPressed(0, Keys['G']) then - SendDistressSignal() - break - end + if IsControlPressed(0, Keys['G']) then + SendDistressSignal() + break end + end end) end function SendDistressSignal() local playerPed = GetPlayerPed(-1) - local coords = GetEntityCoords(playerPed) + local coords = GetEntityCoords(playerPed) ESX.ShowNotification(_U('distress_sent')) TriggerServerEvent('esx_phone:send', 'ambulance', _U('distress_message'), false, { - x = coords.x, - y = coords.y, - z = coords.z + x = coords.x, + y = coords.y, + z = coords.z }) end -function ShowTimer() - local timer = Config.RespawnDelayAfterRPDeath - - Citizen.CreateThread(function() - while timer > 0 and IsDead do - Citizen.Wait(0) +function ShowDeathTimer() + local respawnTimer = Config.RespawnDelayAfterRPDeath + local allowRespawn = Config.RespawnDelayAfterRPDeath/2 + local fineAmount = Config.EarlyRespawnFineAmount + local payFine = false - raw_seconds = timer/1000 - raw_minutes = raw_seconds/60 - minutes = stringsplit(raw_minutes, ".")[1] - seconds = stringsplit(raw_seconds-(minutes*60), ".")[1] - - SetTextFont(4) - SetTextProportional(0) - SetTextScale(0.0, 0.5) - SetTextColour(255, 255, 255, 255) - SetTextDropshadow(0, 0, 0, 0, 255) - SetTextEdge(1, 0, 0, 0, 255) - SetTextDropShadow() - SetTextOutline() - - local text = _U('please_wait', minutes, seconds) - - if Config.EarlyRespawn then - text = text .. '\n[~b~E~s~]' - end - - SetTextCentre(true) - BeginTextCommandDisplayText("STRING") - AddTextComponentSubstringPlayerName(text) - EndTextCommandDisplayText(0.5, 0.8) - - if Config.EarlyRespawn then - if IsControlPressed(0, Keys['E']) then - RemoveItemsAfterRPDeath() - break - end - end - timer = timer - 15 + if Config.EarlyRespawn and Config.EarlyRespawnFine then + ESX.TriggerServerCallback('esx_ambulancejob:checkBalance', function(finePayable) + if finePayable then + payFine = true + else + payFine = false end + end) + end + + Citizen.CreateThread(function() + while respawnTimer > 0 and IsDead do + Citizen.Wait(0) + + raw_seconds = respawnTimer/1000 + raw_minutes = raw_seconds/60 + minutes = stringsplit(raw_minutes, ".")[1] + seconds = stringsplit(raw_seconds-(minutes*60), ".")[1] + + SetTextFont(4) + SetTextProportional(0) + SetTextScale(0.0, 0.5) + SetTextColour(255, 255, 255, 255) + SetTextDropshadow(0, 0, 0, 0, 255) + SetTextEdge(1, 0, 0, 0, 255) + SetTextDropShadow() + SetTextOutline() + + local text = _U('please_wait', minutes, seconds) if Config.EarlyRespawn then - while timer <= 0 and IsDead do - Citizen.Wait(0) + if not Config.EarlyRespawnFine and respawnTimer <= allowRespawn then + text = text .. _U('press_respawn') + elseif Config.EarlyRespawnFine and respawnTimer <= allowRespawn and payFine then + text = text .. _U('respawn_now_fine', fineAmount) + else + text = text + end + end - SetTextFont(4) - SetTextProportional(0) - SetTextScale(0.0, 0.5) - SetTextColour(255, 255, 255, 255) - SetTextDropshadow(0, 0, 0, 0, 255) - SetTextEdge(1, 0, 0, 0, 255) - SetTextDropShadow() - SetTextOutline() - SetTextCentre(true) + SetTextCentre(true) + SetTextEntry("STRING") + AddTextComponentString(text) + DrawText(0.5, 0.8) - BeginTextCommandDisplayText("STRING") - AddTextComponentSubstringPlayerName(_U('press_respawn')) - EndTextCommandDisplayText(0.5, 0.8) - - if IsControlPressed(0, Keys['E']) then - RemoveItemsAfterRPDeath() - break - end + if Config.EarlyRespawn then + if not Config.EarlyRespawnFine then + if IsControlPressed(0, Keys['E']) then + RemoveItemsAfterRPDeath() + break + end + elseif Config.EarlyRespawnFine then + if respawnTimer <= allowRespawn and payFine then + if IsControlPressed(0, Keys['E']) then + PayFine() + break + end end end + end + respawnTimer = respawnTimer - 15 + end end) end @@ -197,21 +178,27 @@ function RemoveItemsAfterRPDeath() TriggerServerEvent('esx_ambulancejob:setDeathStatus', 0) Citizen.CreateThread(function() - DoScreenFadeOut(800) - while not IsScreenFadedOut() do - Citizen.Wait(10) - end + DoScreenFadeOut(800) + while not IsScreenFadedOut() do + Citizen.Wait(10) + end - ESX.TriggerServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function() - ESX.SetPlayerData('lastPosition', Config.Zones.HospitalInteriorInside1.Pos) - ESX.SetPlayerData('loadout', {}) + ESX.TriggerServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function() + ESX.SetPlayerData('lastPosition', Config.Zones.HospitalInteriorInside1.Pos) + ESX.SetPlayerData('loadout', {}) - TriggerServerEvent('esx:updateLastPosition', Config.Zones.HospitalInteriorInside1.Pos) - RespawnPed(GetPlayerPed(-1), Config.Zones.HospitalInteriorInside1.Pos) + TriggerServerEvent('esx:updateLastPosition', Config.Zones.HospitalInteriorInside1.Pos) + RespawnPed(GetPlayerPed(-1), Config.Zones.HospitalInteriorInside1.Pos) - StopScreenEffect('DeathFailOut') - DoScreenFadeIn(800) - end) + StopScreenEffect('DeathFailOut') + DoScreenFadeIn(800) + end) + end) +end + +function PayFine() + ESX.TriggerServerCallback('esx_ambulancejob:payFine', function() + RemoveItemsAfterRPDeath() end) end @@ -219,113 +206,109 @@ function OnPlayerDeath() IsDead = true TriggerServerEvent('esx_ambulancejob:setDeathStatus', 1) - if Config.ShowDeathTimer == true then - ShowTimer() + if Config.ShowDeathTimer then + ShowDeathTimer() end StartRespawnTimer() StartDistressSignal() - if Config.RespawnToHospitalMenuTimer then - StartRespawnToHospitalMenuTimer() - end - ClearPedTasksImmediately(GetPlayerPed(-1)) StartScreenEffect('DeathFailOut', 0, false) end function TeleportFadeEffect(entity, coords) - Citizen.CreateThread(function() + Citizen.CreateThread(function() - DoScreenFadeOut(800) + DoScreenFadeOut(800) - while not IsScreenFadedOut() do - Citizen.Wait(0) - end + while not IsScreenFadedOut() do + Citizen.Wait(0) + end - ESX.Game.Teleport(entity, coords, function() - DoScreenFadeIn(800) - end) + ESX.Game.Teleport(entity, coords, function() + DoScreenFadeIn(800) + end) - end) + end) end function WarpPedInClosestVehicle(ped) - local coords = GetEntityCoords(ped) + local coords = GetEntityCoords(ped) - local vehicle, distance = ESX.Game.GetClosestVehicle({ - x = coords.x, - y = coords.y, - z = coords.z - }) + local vehicle, distance = ESX.Game.GetClosestVehicle({ + x = coords.x, + y = coords.y, + z = coords.z + }) - if distance ~= -1 and distance <= 5.0 then + if distance ~= -1 and distance <= 5.0 then - local maxSeats = GetVehicleMaxNumberOfPassengers(vehicle) - local freeSeat = nil + local maxSeats = GetVehicleMaxNumberOfPassengers(vehicle) + local freeSeat = nil - for i=maxSeats - 1, 0, -1 do - if IsVehicleSeatFree(vehicle, i) then - freeSeat = i - break - end - end + for i=maxSeats - 1, 0, -1 do + if IsVehicleSeatFree(vehicle, i) then + freeSeat = i + break + end + end - if freeSeat ~= nil then - TaskWarpPedIntoVehicle(ped, vehicle, freeSeat) - end + if freeSeat ~= nil then + TaskWarpPedIntoVehicle(ped, vehicle, freeSeat) + end - else - ESX.ShowNotification(_U('no_vehicles')) - end + else + ESX.ShowNotification(_U('no_vehicles')) + end end function OpenAmbulanceActionsMenu() - local elements = { - {label = _U('cloakroom'), value = 'cloakroom'} - } + local elements = { + {label = _U('cloakroom'), value = 'cloakroom'} + } - if Config.EnablePlayerManagement and PlayerData.job.grade_name == 'boss' then - table.insert(elements, {label = _U('boss_actions'), value = 'boss_actions'}) - end + if Config.EnablePlayerManagement and PlayerData.job.grade_name == 'boss' then + table.insert(elements, {label = _U('boss_actions'), value = 'boss_actions'}) + end - ESX.UI.Menu.CloseAll() + ESX.UI.Menu.CloseAll() - ESX.UI.Menu.Open( - 'default', GetCurrentResourceName(), 'ambulance_actions', - { - title = _U('ambulance'), - align = 'top-left', - elements = elements - }, - function(data, menu) + ESX.UI.Menu.Open( + 'default', GetCurrentResourceName(), 'ambulance_actions', + { + title = _U('ambulance'), + align = 'top-left', + elements = elements + }, + function(data, menu) - if data.current.value == 'cloakroom' then - OpenCloakroomMenu() - end + if data.current.value == 'cloakroom' then + OpenCloakroomMenu() + end - if data.current.value == 'boss_actions' then - TriggerEvent('esx_society:openBossMenu', 'ambulance', function(data, menu) - menu.close() - end, {wash = false}) - end + if data.current.value == 'boss_actions' then + TriggerEvent('esx_society:openBossMenu', 'ambulance', function(data, menu) + menu.close() + end, {wash = false}) + end - end, - function(data, menu) + end, + function(data, menu) - menu.close() + menu.close() - CurrentAction = 'ambulance_actions_menu' - CurrentActionMsg = _U('open_menu') - CurrentActionData = {} + CurrentAction = 'ambulance_actions_menu' + CurrentActionMsg = _U('open_menu') + CurrentActionData = {} - end - ) + end + ) end @@ -336,196 +319,196 @@ function OpenMobileAmbulanceActionsMenu() ESX.UI.Menu.Open( 'default', GetCurrentResourceName(), 'mobile_ambulance_actions', { - title = _U('ambulance'), - align = 'top-left', - elements = { - {label = _U('ems_menu'), value = 'citizen_interaction'}, - } + title = _U('ambulance'), + align = 'top-left', + elements = { + {label = _U('ems_menu'), value = 'citizen_interaction'}, + } }, function(data, menu) - if data.current.value == 'citizen_interaction' then - ESX.UI.Menu.Open( - 'default', GetCurrentResourceName(), 'citizen_interaction', - { - title = _U('ems_menu_title'), - align = 'top-left', - elements = { - {label = _U('ems_menu_revive'), value = 'revive'}, - {label = _U('ems_menu_small'), value = 'small'}, - {label = _U('ems_menu_big'), value = 'big'}, - {label = _U('ems_menu_putincar'), value = 'put_in_vehicle'}, - } - }, function(data, menu) - if IsBusy then return end - if data.current.value == 'revive' then -- revive - - local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() - - if closestPlayer == -1 or closestDistance > 3.0 then - ESX.ShowNotification(_U('no_players')) - else - ESX.TriggerServerCallback('esx_ambulancejob:getItemAmount', function(qtty) - if qtty > 0 then - local closestPlayerPed = GetPlayerPed(closestPlayer) - local health = GetEntityHealth(closestPlayerPed) - - if health == 0 then - local playerPed = GetPlayerPed(-1) + if data.current.value == 'citizen_interaction' then + ESX.UI.Menu.Open( + 'default', GetCurrentResourceName(), 'citizen_interaction', + { + title = _U('ems_menu_title'), + align = 'top-left', + elements = { + {label = _U('ems_menu_revive'), value = 'revive'}, + {label = _U('ems_menu_small'), value = 'small'}, + {label = _U('ems_menu_big'), value = 'big'}, + {label = _U('ems_menu_putincar'), value = 'put_in_vehicle'}, + } + }, function(data, menu) + if IsBusy then return end + if data.current.value == 'revive' then -- revive - IsBusy = true - ESX.ShowNotification(_U('revive_inprogress')) - TaskStartScenarioInPlace(playerPed, 'CODE_HUMAN_MEDIC_TEND_TO_DEAD', 0, true) - Citizen.Wait(10000) - ClearPedTasks(playerPed) - - TriggerServerEvent('esx_ambulancejob:removeItem', 'medikit') - TriggerServerEvent('esx_ambulancejob:revive', GetPlayerServerId(closestPlayer)) - IsBusy = false + local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() - -- Show revive award? - if Config.ReviveReward > 0 then - ESX.ShowNotification(_U('revive_complete_award', GetPlayerName(closestPlayer), Config.ReviveReward)) - else - ESX.ShowNotification(_U('revive_complete', GetPlayerName(closestPlayer))) - end - else - ESX.ShowNotification(_U('player_not_unconscious')) - end - else - ESX.ShowNotification(_U('not_enough_medikit')) - end - end, 'medikit') - end - elseif data.current.value == 'small' then - - local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() - if closestPlayer == -1 or closestDistance > 3.0 then - ESX.ShowNotification(_U('no_players')) - else - ESX.TriggerServerCallback('esx_ambulancejob:getItemAmount', function(qtty) - if qtty > 0 then - local closestPlayerPed = GetPlayerPed(closestPlayer) - local health = GetEntityHealth(closestPlayerPed) - - if health > 0 then - local playerPed = GetPlayerPed(-1) + if closestPlayer == -1 or closestDistance > 3.0 then + ESX.ShowNotification(_U('no_players')) + else + ESX.TriggerServerCallback('esx_ambulancejob:getItemAmount', function(qtty) + if qtty > 0 then + local closestPlayerPed = GetPlayerPed(closestPlayer) + local health = GetEntityHealth(closestPlayerPed) - IsBusy = true - ESX.ShowNotification(_U('heal_inprogress')) - TaskStartScenarioInPlace(playerPed, 'CODE_HUMAN_MEDIC_TEND_TO_DEAD', 0, true) - Citizen.Wait(10000) - ClearPedTasks(playerPed) - - TriggerServerEvent('esx_ambulancejob:removeItem', 'bandage') - TriggerServerEvent('esx_ambulancejob:heal', GetPlayerServerId(closestPlayer), 'small') - ESX.ShowNotification(_U('heal_complete', GetPlayerName(closestPlayer))) - IsBusy = false - else - ESX.ShowNotification(_U('player_not_conscious')) - end - else - ESX.ShowNotification(_U('not_enough_bandage')) - end - end, 'bandage') - end - elseif data.current.value == 'big' then - - local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() - if closestPlayer == -1 or closestDistance > 3.0 then - ESX.ShowNotification(_U('no_players')) - else - ESX.TriggerServerCallback('esx_ambulancejob:getItemAmount', function(qtty) - if qtty > 0 then - local closestPlayerPed = GetPlayerPed(closestPlayer) - local health = GetEntityHealth(closestPlayerPed) - - if health > 0 then - local playerPed = GetPlayerPed(-1) + if health == 0 then + local playerPed = GetPlayerPed(-1) - IsBusy = true - ESX.ShowNotification(_U('heal_inprogress')) - TaskStartScenarioInPlace(playerPed, 'CODE_HUMAN_MEDIC_TEND_TO_DEAD', 0, true) - Citizen.Wait(10000) - ClearPedTasks(playerPed) - - TriggerServerEvent('esx_ambulancejob:removeItem', 'medikit') - TriggerServerEvent('esx_ambulancejob:heal', GetPlayerServerId(closestPlayer), 'big') - ESX.ShowNotification(_U('heal_complete', GetPlayerName(closestPlayer))) - IsBusy = false - else - ESX.ShowNotification(_U('player_not_conscious')) - end - else - ESX.ShowNotification(_U('not_enough_medikit')) - end - end, 'medikit') - end - elseif data.current.value == 'put_in_vehicle' then - - local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() - if closestPlayer == -1 or closestDistance > 3.0 then - ESX.ShowNotification(_U('no_vehicles')) + IsBusy = true + ESX.ShowNotification(_U('revive_inprogress')) + TaskStartScenarioInPlace(playerPed, 'CODE_HUMAN_MEDIC_TEND_TO_DEAD', 0, true) + Citizen.Wait(10000) + ClearPedTasks(playerPed) + + TriggerServerEvent('esx_ambulancejob:removeItem', 'medikit') + TriggerServerEvent('esx_ambulancejob:revive', GetPlayerServerId(closestPlayer)) + IsBusy = false + + -- Show revive award? + if Config.ReviveReward > 0 then + ESX.ShowNotification(_U('revive_complete_award', GetPlayerName(closestPlayer), Config.ReviveReward)) else - menu.close() - WarpPedInClosestVehicle(GetPlayerPed(closestPlayer)) + ESX.ShowNotification(_U('revive_complete', GetPlayerName(closestPlayer))) end + else + ESX.ShowNotification(_U('player_not_unconscious')) end - end, function(data, menu) - menu.close() - end) + else + ESX.ShowNotification(_U('not_enough_medikit')) + end + end, 'medikit') + end + elseif data.current.value == 'small' then + + local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() + if closestPlayer == -1 or closestDistance > 3.0 then + ESX.ShowNotification(_U('no_players')) + else + ESX.TriggerServerCallback('esx_ambulancejob:getItemAmount', function(qtty) + if qtty > 0 then + local closestPlayerPed = GetPlayerPed(closestPlayer) + local health = GetEntityHealth(closestPlayerPed) + + if health > 0 then + local playerPed = GetPlayerPed(-1) + + IsBusy = true + ESX.ShowNotification(_U('heal_inprogress')) + TaskStartScenarioInPlace(playerPed, 'CODE_HUMAN_MEDIC_TEND_TO_DEAD', 0, true) + Citizen.Wait(10000) + ClearPedTasks(playerPed) + + TriggerServerEvent('esx_ambulancejob:removeItem', 'bandage') + TriggerServerEvent('esx_ambulancejob:heal', GetPlayerServerId(closestPlayer), 'small') + ESX.ShowNotification(_U('heal_complete', GetPlayerName(closestPlayer))) + IsBusy = false + else + ESX.ShowNotification(_U('player_not_conscious')) + end + else + ESX.ShowNotification(_U('not_enough_bandage')) + end + end, 'bandage') + end + elseif data.current.value == 'big' then + + local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() + if closestPlayer == -1 or closestDistance > 3.0 then + ESX.ShowNotification(_U('no_players')) + else + ESX.TriggerServerCallback('esx_ambulancejob:getItemAmount', function(qtty) + if qtty > 0 then + local closestPlayerPed = GetPlayerPed(closestPlayer) + local health = GetEntityHealth(closestPlayerPed) + + if health > 0 then + local playerPed = GetPlayerPed(-1) + + IsBusy = true + ESX.ShowNotification(_U('heal_inprogress')) + TaskStartScenarioInPlace(playerPed, 'CODE_HUMAN_MEDIC_TEND_TO_DEAD', 0, true) + Citizen.Wait(10000) + ClearPedTasks(playerPed) + + TriggerServerEvent('esx_ambulancejob:removeItem', 'medikit') + TriggerServerEvent('esx_ambulancejob:heal', GetPlayerServerId(closestPlayer), 'big') + ESX.ShowNotification(_U('heal_complete', GetPlayerName(closestPlayer))) + IsBusy = false + else + ESX.ShowNotification(_U('player_not_conscious')) + end + else + ESX.ShowNotification(_U('not_enough_medikit')) + end + end, 'medikit') + end + elseif data.current.value == 'put_in_vehicle' then + + local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() + if closestPlayer == -1 or closestDistance > 3.0 then + ESX.ShowNotification(_U('no_vehicles')) + else + menu.close() + WarpPedInClosestVehicle(GetPlayerPed(closestPlayer)) + end end + end, function(data, menu) + menu.close() + end) + end end, function(data, menu) - menu.close() + menu.close() end) end function OpenCloakroomMenu() - ESX.UI.Menu.Open( - 'default', GetCurrentResourceName(), 'cloakroom', - { - title = _U('cloakroom'), - align = 'top-left', - elements = { - {label = _U('ems_clothes_civil'), value = 'citizen_wear'}, - {label = _U('ems_clothes_ems'), value = 'ambulance_wear'}, - }, - }, - function(data, menu) + ESX.UI.Menu.Open( + 'default', GetCurrentResourceName(), 'cloakroom', + { + title = _U('cloakroom'), + align = 'top-left', + elements = { + {label = _U('ems_clothes_civil'), value = 'citizen_wear'}, + {label = _U('ems_clothes_ems'), value = 'ambulance_wear'}, + }, + }, + function(data, menu) - menu.close() + menu.close() - if data.current.value == 'citizen_wear' then + if data.current.value == 'citizen_wear' then - ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin) - TriggerEvent('skinchanger:loadSkin', skin) - end) + ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin) + TriggerEvent('skinchanger:loadSkin', skin) + end) - end + end - if data.current.value == 'ambulance_wear' then + if data.current.value == 'ambulance_wear' then - ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin) + ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin) - if skin.sex == 0 then - TriggerEvent('skinchanger:loadClothes', skin, jobSkin.skin_male) - else - TriggerEvent('skinchanger:loadClothes', skin, jobSkin.skin_female) - end + if skin.sex == 0 then + TriggerEvent('skinchanger:loadClothes', skin, jobSkin.skin_male) + else + TriggerEvent('skinchanger:loadClothes', skin, jobSkin.skin_female) + end - end) + end) - end + end - CurrentAction = 'ambulance_actions_menu' - CurrentActionMsg = _U('open_menu') - CurrentActionData = {} + CurrentAction = 'ambulance_actions_menu' + CurrentActionMsg = _U('open_menu') + CurrentActionData = {} - end, - function(data, menu) - menu.close() - end - ) + end, + function(data, menu) + menu.close() + end + ) end @@ -535,61 +518,61 @@ function OpenVehicleSpawnerMenu() if Config.EnableSocietyOwnedVehicles then - local elements = {} + local elements = {} - ESX.TriggerServerCallback('esx_society:getVehiclesInGarage', function(vehicles) + ESX.TriggerServerCallback('esx_society:getVehiclesInGarage', function(vehicles) - for i=1, #vehicles, 1 do - table.insert(elements, {label = GetDisplayNameFromVehicleModel(vehicles[i].model) .. ' [' .. vehicles[i].plate .. ']', value = vehicles[i]}) - end - - ESX.UI.Menu.Open( - 'default', GetCurrentResourceName(), 'vehicle_spawner', - { - title = _U('veh_menu'), - align = 'top-left', - elements = elements, - }, function(data, menu) - menu.close() - - local vehicleProps = data.current.value - ESX.Game.SpawnVehicle(vehicleProps.model, Config.Zones.VehicleSpawnPoint.Pos, 270.0, function(vehicle) - ESX.Game.SetVehicleProperties(vehicle, vehicleProps) - local playerPed = GetPlayerPed(-1) - TaskWarpPedIntoVehicle(playerPed, vehicle, -1) - end) - TriggerServerEvent('esx_society:removeVehicleFromGarage', 'ambulance', vehicleProps) - - end, function(data, menu) - menu.close() - CurrentAction = 'vehicle_spawner_menu' - CurrentActionMsg = _U('veh_spawn') - CurrentActionData = {} - end - ) - end, 'ambulance') - - else -- not society vehicles + for i=1, #vehicles, 1 do + table.insert(elements, {label = GetDisplayNameFromVehicleModel(vehicles[i].model) .. ' [' .. vehicles[i].plate .. ']', value = vehicles[i]}) + end ESX.UI.Menu.Open( 'default', GetCurrentResourceName(), 'vehicle_spawner', { - title = _U('veh_menu'), - align = 'top-left', - elements = Config.AuthorizedVehicles + title = _U('veh_menu'), + align = 'top-left', + elements = elements, }, function(data, menu) - menu.close() - ESX.Game.SpawnVehicle(data.current.model, Config.Zones.VehicleSpawnPoint.Pos, 230.0, function(vehicle) - local playerPed = GetPlayerPed(-1) - TaskWarpPedIntoVehicle(playerPed, vehicle, -1) - end) + menu.close() + + local vehicleProps = data.current.value + ESX.Game.SpawnVehicle(vehicleProps.model, Config.Zones.VehicleSpawnPoint.Pos, 270.0, function(vehicle) + ESX.Game.SetVehicleProperties(vehicle, vehicleProps) + local playerPed = GetPlayerPed(-1) + TaskWarpPedIntoVehicle(playerPed, vehicle, -1) + end) + TriggerServerEvent('esx_society:removeVehicleFromGarage', 'ambulance', vehicleProps) + end, function(data, menu) - menu.close() - CurrentAction = 'vehicle_spawner_menu' - CurrentActionMsg = _U('veh_spawn') - CurrentActionData = {} + menu.close() + CurrentAction = 'vehicle_spawner_menu' + CurrentActionMsg = _U('veh_spawn') + CurrentActionData = {} end ) + end, 'ambulance') + + else -- not society vehicles + + ESX.UI.Menu.Open( + 'default', GetCurrentResourceName(), 'vehicle_spawner', + { + title = _U('veh_menu'), + align = 'top-left', + elements = Config.AuthorizedVehicles + }, function(data, menu) + menu.close() + ESX.Game.SpawnVehicle(data.current.model, Config.Zones.VehicleSpawnPoint.Pos, 230.0, function(vehicle) + local playerPed = GetPlayerPed(-1) + TaskWarpPedIntoVehicle(playerPed, vehicle, -1) + end) + end, function(data, menu) + menu.close() + CurrentAction = 'vehicle_spawner_menu' + CurrentActionMsg = _U('veh_spawn') + CurrentActionData = {} + end + ) end end @@ -599,20 +582,20 @@ function OpenPharmacyMenu() ESX.UI.Menu.Open( 'default', GetCurrentResourceName(), 'pharmacy', { - title = _U('pharmacy_menu_title'), - align = 'top-left', - elements = { - {label = _U('pharmacy_take') .. ' ' .. _('medikit'), value = 'medikit'}, - {label = _U('pharmacy_take') .. ' ' .. _('bandage'), value = 'bandage'} - }, + title = _U('pharmacy_menu_title'), + align = 'top-left', + elements = { + {label = _U('pharmacy_take') .. ' ' .. _('medikit'), value = 'medikit'}, + {label = _U('pharmacy_take') .. ' ' .. _('bandage'), value = 'bandage'} + }, }, function(data, menu) - TriggerServerEvent('esx_ambulancejob:giveItem', data.current.value) - + TriggerServerEvent('esx_ambulancejob:giveItem', data.current.value) + end, function(data, menu) - menu.close() - CurrentAction = 'pharmacy' - CurrentActionMsg = _U('open_pharmacy') - CurrentActionData = {} + menu.close() + CurrentAction = 'pharmacy' + CurrentActionMsg = _U('open_pharmacy') + CurrentActionData = {} end ) end @@ -621,32 +604,32 @@ AddEventHandler('playerSpawned', function() IsDead = false if FirstSpawn then - TriggerServerEvent('esx_ambulancejob:firstSpawn') - exports.spawnmanager:setAutoSpawn(false) -- disable respawn - FirstSpawn = false + TriggerServerEvent('esx_ambulancejob:firstSpawn') + exports.spawnmanager:setAutoSpawn(false) -- disable respawn + FirstSpawn = false end end) RegisterNetEvent('esx:playerLoaded') AddEventHandler('esx:playerLoaded', function(xPlayer) - PlayerData = xPlayer + PlayerData = xPlayer end) RegisterNetEvent('esx:setJob') AddEventHandler('esx:setJob', function(job) - PlayerData.job = job + PlayerData.job = job end) RegisterNetEvent('esx_phone:loaded') AddEventHandler('esx_phone:loaded', function(phoneNumber, contacts) - local specialContact = { - name = 'Ambulance', - number = 'ambulance', - base64Icon = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEwAACxMBAJqcGAAABp5JREFUWIW1l21sFNcVhp/58npn195de23Ha4Mh2EASSvk0CPVHmmCEI0RCTQMBKVVooxYoalBVCVokICWFVFVEFeKoUdNECkZQIlAoFGMhIkrBQGxHwhAcChjbeLcsYHvNfsx+zNz+MBDWNrYhzSvdP+e+c973XM2cc0dihFi9Yo6vSzN/63dqcwPZcnEwS9PDmYoE4IxZIj+ciBb2mteLwlZdfji+dXtNU2AkeaXhCGteLZ/X/IS64/RoR5mh9tFVAaMiAldKQUGiRzFp1wXJPj/YkxblbfFLT/tjq9/f1XD0sQyse2li7pdP5tYeLXXMMGUojAiWKeOodE1gqpmNfN2PFeoF00T2uLGKfZzTwhzqbaEmeYWAQ0K1oKIlfPb7t+7M37aruXvEBlYvnV7xz2ec/2jNs9kKooKNjlksiXhJfLqf1PXOIU9M8fmw/XgRu523eTNyhhu6xLjbSeOFC6EX3t3V9PmwBla9Vv7K7u85d3bpqlwVcvHn7B8iVX+IFQoNKdwfstuFtWoFvwp9zj5XL7nRlPXyudjS9z+u35tmuH/lu6dl7+vSVXmDUcpbX+skP65BxOOPJA4gjDicOM2PciejeTwcsYek1hyl6me5nhNnmwPXBhjYuGC699OpzoaAO0PbYJSy5vgt4idOPrJwf6QuX2FO0oOtqIgj9pDU5dCWrMlyvXf86xsGgHyPeLos83Brns1WFXLxxgVBorHpW4vfQ6KhkbUtCot6srns1TLPjNVr7+1J0PepVc92H/Eagkb7IsTWd4ZMaN+yCXv5zLRY9GQ9xuYtQz4nfreWGdH9dNlkfnGq5/kdO88ekwGan1B3mDJsdMxCqv5w2Iq0khLs48vSllrsG/Y5pfojNugzScnQXKBVA8hrX51ddHq0o6wwIlgS8Y7obZdUZVjOYLC6e3glWkBBVHC2RJ+w/qezCuT/2sV6Q5VYpowjvnf/iBJJqvpYBgBS+w6wVB5DLEOiTZHWy36nNheg0jUBs3PoJnMfyuOdAECqrZ3K7KcACGQp89RAtlysCphqZhPtRzYlcPx+ExklJUiq0le5omCfOGFAYn3qFKS/fZAWS7a3Y2wa+GJOEy4US+B3aaPUYJamj4oI5LA/jWQBt5HIK5+JfXzZsJVpXi/ac8+mxWIXWzAG4Wb4g/jscNMp63I4U5FcKaVvsNyFALokSA47Kx8PVk83OabCHZsiqwAKEpjmfUJIkoh/R+L9oTpjluhRkGSPG4A7EkS+Y3HZk0OXYpIVNy01P5yItnptDsvtIwr0SunqoVP1GG1taTHn1CloXm9aLBEIEDl/IS2W6rg+qIFEYR7+OJTesqJqYa95/VKBNOHLjDBZ8sDS2998a0Bs/F//gvu5Z9NivadOc/U3676pEsizBIN1jCYlhClL+ELJDrkobNUBfBZqQfMN305HAgnIeYi4OnYMh7q/AsAXSdXK+eH41sykxd+TV/AsXvR/MeARAttD9pSqF9nDNfSEoDQsb5O31zQFprcaV244JPY7bqG6Xd9K3C3ALgbfk3NzqNE6CdplZrVFL27eWR+UASb6479ULfhD5AzOlSuGFTE6OohebElbcb8fhxA4xEPUgdTK19hiNKCZgknB+Ep44E44d82cxqPPOKctCGXzTmsBXbV1j1S5XQhyHq6NvnABPylu46A7QmVLpP7w9pNz4IEb0YyOrnmjb8bjB129fDBRkDVj2ojFbYBnCHHb7HL+OC7KQXeEsmAiNrnTqLy3d3+s/bvlVmxpgffM1fyM5cfsPZLuK+YHnvHELl8eUlwV4BXim0r6QV+4gD9Nlnjbfg1vJGktbI5UbN/TcGmAAYDG84Gry/MLLl/zKouO2Xukq/YkCyuWYV5owTIGjhVFCPL6J7kLOTcH89ereF1r4qOsm3gjSevl85El1Z98cfhB3qBN9+dLp1fUTco+0OrVMnNjFuv0chYbBYT2HcBoa+8TALyWQOt/ImPHoFS9SI3WyRajgdt2mbJgIlbREplfveuLf/XXemjXX7v46ZxzPlfd8YlZ01My5MUEVdIY5rueYopw4fQHkbv7/rZkTw6JwjyalBCHur9iD9cI2mU0UzD3P9H6yZ1G5dt7Gwe96w07dl5fXj7vYqH2XsNovdTI6KMrlsAXhRyz7/C7FBO/DubdVq4nBLPaohcnBeMr3/2k4fhQ+Uc8995YPq2wMzNjww2X+vwNt1p00ynrd2yKDJAVN628sBX1hZIdxXdStU9G5W2bd9YHR5L3f/CNmJeY9G8WAAAAAElFTkSuQmCC' - } + local specialContact = { + name = 'Ambulance', + number = 'ambulance', + base64Icon = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEwAACxMBAJqcGAAABp5JREFUWIW1l21sFNcVhp/58npn195de23Ha4Mh2EASSvk0CPVHmmCEI0RCTQMBKVVooxYoalBVCVokICWFVFVEFeKoUdNECkZQIlAoFGMhIkrBQGxHwhAcChjbeLcsYHvNfsx+zNz+MBDWNrYhzSvdP+e+c973XM2cc0dihFi9Yo6vSzN/63dqcwPZcnEwS9PDmYoE4IxZIj+ciBb2mteLwlZdfji+dXtNU2AkeaXhCGteLZ/X/IS64/RoR5mh9tFVAaMiAldKQUGiRzFp1wXJPj/YkxblbfFLT/tjq9/f1XD0sQyse2li7pdP5tYeLXXMMGUojAiWKeOodE1gqpmNfN2PFeoF00T2uLGKfZzTwhzqbaEmeYWAQ0K1oKIlfPb7t+7M37aruXvEBlYvnV7xz2ec/2jNs9kKooKNjlksiXhJfLqf1PXOIU9M8fmw/XgRu523eTNyhhu6xLjbSeOFC6EX3t3V9PmwBla9Vv7K7u85d3bpqlwVcvHn7B8iVX+IFQoNKdwfstuFtWoFvwp9zj5XL7nRlPXyudjS9z+u35tmuH/lu6dl7+vSVXmDUcpbX+skP65BxOOPJA4gjDicOM2PciejeTwcsYek1hyl6me5nhNnmwPXBhjYuGC699OpzoaAO0PbYJSy5vgt4idOPrJwf6QuX2FO0oOtqIgj9pDU5dCWrMlyvXf86xsGgHyPeLos83Brns1WFXLxxgVBorHpW4vfQ6KhkbUtCot6srns1TLPjNVr7+1J0PepVc92H/Eagkb7IsTWd4ZMaN+yCXv5zLRY9GQ9xuYtQz4nfreWGdH9dNlkfnGq5/kdO88ekwGan1B3mDJsdMxCqv5w2Iq0khLs48vSllrsG/Y5pfojNugzScnQXKBVA8hrX51ddHq0o6wwIlgS8Y7obZdUZVjOYLC6e3glWkBBVHC2RJ+w/qezCuT/2sV6Q5VYpowjvnf/iBJJqvpYBgBS+w6wVB5DLEOiTZHWy36nNheg0jUBs3PoJnMfyuOdAECqrZ3K7KcACGQp89RAtlysCphqZhPtRzYlcPx+ExklJUiq0le5omCfOGFAYn3qFKS/fZAWS7a3Y2wa+GJOEy4US+B3aaPUYJamj4oI5LA/jWQBt5HIK5+JfXzZsJVpXi/ac8+mxWIXWzAG4Wb4g/jscNMp63I4U5FcKaVvsNyFALokSA47Kx8PVk83OabCHZsiqwAKEpjmfUJIkoh/R+L9oTpjluhRkGSPG4A7EkS+Y3HZk0OXYpIVNy01P5yItnptDsvtIwr0SunqoVP1GG1taTHn1CloXm9aLBEIEDl/IS2W6rg+qIFEYR7+OJTesqJqYa95/VKBNOHLjDBZ8sDS2998a0Bs/F//gvu5Z9NivadOc/U3676pEsizBIN1jCYlhClL+ELJDrkobNUBfBZqQfMN305HAgnIeYi4OnYMh7q/AsAXSdXK+eH41sykxd+TV/AsXvR/MeARAttD9pSqF9nDNfSEoDQsb5O31zQFprcaV244JPY7bqG6Xd9K3C3ALgbfk3NzqNE6CdplZrVFL27eWR+UASb6479ULfhD5AzOlSuGFTE6OohebElbcb8fhxA4xEPUgdTK19hiNKCZgknB+Ep44E44d82cxqPPOKctCGXzTmsBXbV1j1S5XQhyHq6NvnABPylu46A7QmVLpP7w9pNz4IEb0YyOrnmjb8bjB129fDBRkDVj2ojFbYBnCHHb7HL+OC7KQXeEsmAiNrnTqLy3d3+s/bvlVmxpgffM1fyM5cfsPZLuK+YHnvHELl8eUlwV4BXim0r6QV+4gD9Nlnjbfg1vJGktbI5UbN/TcGmAAYDG84Gry/MLLl/zKouO2Xukq/YkCyuWYV5owTIGjhVFCPL6J7kLOTcH89ereF1r4qOsm3gjSevl85El1Z98cfhB3qBN9+dLp1fUTco+0OrVMnNjFuv0chYbBYT2HcBoa+8TALyWQOt/ImPHoFS9SI3WyRajgdt2mbJgIlbREplfveuLf/XXemjXX7v46ZxzPlfd8YlZ01My5MUEVdIY5rueYopw4fQHkbv7/rZkTw6JwjyalBCHur9iD9cI2mU0UzD3P9H6yZ1G5dt7Gwe96w07dl5fXj7vYqH2XsNovdTI6KMrlsAXhRyz7/C7FBO/DubdVq4nBLPaohcnBeMr3/2k4fhQ+Uc8995YPq2wMzNjww2X+vwNt1p00ynrd2yKDJAVN628sBX1hZIdxXdStU9G5W2bd9YHR5L3f/CNmJeY9G8WAAAAAElFTkSuQmCC' + } - TriggerEvent('esx_phone:addSpecialContact', specialContact.name, specialContact.number, specialContact.base64Icon) + TriggerEvent('esx_phone:addSpecialContact', specialContact.name, specialContact.number, specialContact.base64Icon) end) @@ -657,269 +640,269 @@ end) RegisterNetEvent('esx_ambulancejob:revive') AddEventHandler('esx_ambulancejob:revive', function() - local playerPed = GetPlayerPed(-1) - local coords = GetEntityCoords(playerPed) - TriggerServerEvent('esx_ambulancejob:setDeathStatus', 0) - - Citizen.CreateThread(function() + local playerPed = GetPlayerPed(-1) + local coords = GetEntityCoords(playerPed) + TriggerServerEvent('esx_ambulancejob:setDeathStatus', 0) - DoScreenFadeOut(800) + Citizen.CreateThread(function() - while not IsScreenFadedOut() do - Citizen.Wait(0) - end + DoScreenFadeOut(800) - ESX.SetPlayerData('lastPosition', { - x = coords.x, - y = coords.y, - z = coords.z - }) + while not IsScreenFadedOut() do + Citizen.Wait(0) + end - TriggerServerEvent('esx:updateLastPosition', { - x = coords.x, - y = coords.y, - z = coords.z - }) + ESX.SetPlayerData('lastPosition', { + x = coords.x, + y = coords.y, + z = coords.z + }) - RespawnPed(playerPed, { - x = coords.x, - y = coords.y, - z = coords.z - }) + TriggerServerEvent('esx:updateLastPosition', { + x = coords.x, + y = coords.y, + z = coords.z + }) - StopScreenEffect('DeathFailOut') + RespawnPed(playerPed, { + x = coords.x, + y = coords.y, + z = coords.z + }) - DoScreenFadeIn(800) + StopScreenEffect('DeathFailOut') - end) + DoScreenFadeIn(800) + + end) end) AddEventHandler('esx_ambulancejob:hasEnteredMarker', function(zone) - if zone == 'HospitalInteriorEntering1' then - TeleportFadeEffect(GetPlayerPed(-1), Config.Zones.HospitalInteriorInside1.Pos) - end + if zone == 'HospitalInteriorEntering1' then + TeleportFadeEffect(GetPlayerPed(-1), Config.Zones.HospitalInteriorInside1.Pos) + end - if zone == 'HospitalInteriorExit1' then - TeleportFadeEffect(GetPlayerPed(-1), Config.Zones.HospitalInteriorOutside1.Pos) - end + if zone == 'HospitalInteriorExit1' then + TeleportFadeEffect(GetPlayerPed(-1), Config.Zones.HospitalInteriorOutside1.Pos) + end - if zone == 'HospitalInteriorEntering2' then - local heli = Config.HelicopterSpawner + if zone == 'HospitalInteriorEntering2' then + local heli = Config.HelicopterSpawner - if not IsAnyVehicleNearPoint(heli.SpawnPoint.x, heli.SpawnPoint.y, heli.SpawnPoint.z, 3.0) - and PlayerData.job ~= nil and PlayerData.job.name == 'ambulance' then - ESX.Game.SpawnVehicle('polmav', { - x = heli.SpawnPoint.x, - y = heli.SpawnPoint.y, - z = heli.SpawnPoint.z - }, heli.Heading, function(vehicle) - SetVehicleModKit(vehicle, 0) - SetVehicleLivery(vehicle, 1) - end) + if not IsAnyVehicleNearPoint(heli.SpawnPoint.x, heli.SpawnPoint.y, heli.SpawnPoint.z, 3.0) + and PlayerData.job ~= nil and PlayerData.job.name == 'ambulance' then + ESX.Game.SpawnVehicle('polmav', { + x = heli.SpawnPoint.x, + y = heli.SpawnPoint.y, + z = heli.SpawnPoint.z + }, heli.Heading, function(vehicle) + SetVehicleModKit(vehicle, 0) + SetVehicleLivery(vehicle, 1) + end) - end - TeleportFadeEffect(GetPlayerPed(-1), Config.Zones.HospitalInteriorInside2.Pos) - end + end + TeleportFadeEffect(GetPlayerPed(-1), Config.Zones.HospitalInteriorInside2.Pos) + end - if zone == 'HospitalInteriorExit2' then - TeleportFadeEffect(GetPlayerPed(-1), Config.Zones.HospitalInteriorOutside2.Pos) - end + if zone == 'HospitalInteriorExit2' then + TeleportFadeEffect(GetPlayerPed(-1), Config.Zones.HospitalInteriorOutside2.Pos) + end - if zone == 'ParkingDoorGoOutInside' then - TeleportFadeEffect(GetPlayerPed(-1), Config.Zones.ParkingDoorGoOutOutside.Pos) - end + if zone == 'ParkingDoorGoOutInside' then + TeleportFadeEffect(GetPlayerPed(-1), Config.Zones.ParkingDoorGoOutOutside.Pos) + end - if zone == 'ParkingDoorGoInOutside' then - TeleportFadeEffect(GetPlayerPed(-1), Config.Zones.ParkingDoorGoInInside.Pos) - end + if zone == 'ParkingDoorGoInOutside' then + TeleportFadeEffect(GetPlayerPed(-1), Config.Zones.ParkingDoorGoInInside.Pos) + end - if zone == 'StairsGoTopBottom' then - CurrentAction = 'fast_travel_goto_top' - CurrentActionMsg = _U('fast_travel') - CurrentActionData = {pos = Config.Zones.StairsGoTopTop.Pos} - end + if zone == 'StairsGoTopBottom' then + CurrentAction = 'fast_travel_goto_top' + CurrentActionMsg = _U('fast_travel') + CurrentActionData = {pos = Config.Zones.StairsGoTopTop.Pos} + end - if zone == 'StairsGoBottomTop' then - CurrentAction = 'fast_travel_goto_bottom' - CurrentActionMsg = _U('fast_travel') - CurrentActionData = {pos = Config.Zones.StairsGoBottomBottom.Pos} - end + if zone == 'StairsGoBottomTop' then + CurrentAction = 'fast_travel_goto_bottom' + CurrentActionMsg = _U('fast_travel') + CurrentActionData = {pos = Config.Zones.StairsGoBottomBottom.Pos} + end - if zone == 'AmbulanceActions' then - CurrentAction = 'ambulance_actions_menu' - CurrentActionMsg = _U('open_menu') - CurrentActionData = {} - end + if zone == 'AmbulanceActions' then + CurrentAction = 'ambulance_actions_menu' + CurrentActionMsg = _U('open_menu') + CurrentActionData = {} + end - if zone == 'VehicleSpawner' then - CurrentAction = 'vehicle_spawner_menu' - CurrentActionMsg = _U('veh_spawn') - CurrentActionData = {} - end + if zone == 'VehicleSpawner' then + CurrentAction = 'vehicle_spawner_menu' + CurrentActionMsg = _U('veh_spawn') + CurrentActionData = {} + end - if zone == 'Pharmacy' then - CurrentAction = 'pharmacy' - CurrentActionMsg = _U('open_pharmacy') - CurrentActionData = {} - end + if zone == 'Pharmacy' then + CurrentAction = 'pharmacy' + CurrentActionMsg = _U('open_pharmacy') + CurrentActionData = {} + end - if zone == 'VehicleDeleter' then + if zone == 'VehicleDeleter' then - local playerPed = GetPlayerPed(-1) - local coords = GetEntityCoords(playerPed) + local playerPed = GetPlayerPed(-1) + local coords = GetEntityCoords(playerPed) - if IsPedInAnyVehicle(playerPed, false) then + if IsPedInAnyVehicle(playerPed, false) then - local vehicle, distance = ESX.Game.GetClosestVehicle({ - x = coords.x, - y = coords.y, - z = coords.z - }) + local vehicle, distance = ESX.Game.GetClosestVehicle({ + x = coords.x, + y = coords.y, + z = coords.z + }) - if distance ~= -1 and distance <= 1.0 then + if distance ~= -1 and distance <= 1.0 then - CurrentAction = 'delete_vehicle' - CurrentActionMsg = _U('store_veh') - CurrentActionData = {vehicle = vehicle} + CurrentAction = 'delete_vehicle' + CurrentActionMsg = _U('store_veh') + CurrentActionData = {vehicle = vehicle} - end + end - end + end - end + end end) function FastTravel(pos) - TeleportFadeEffect(GetPlayerPed(-1), pos) + TeleportFadeEffect(GetPlayerPed(-1), pos) end AddEventHandler('esx_ambulancejob:hasExitedMarker', function(zone) - ESX.UI.Menu.CloseAll() - CurrentAction = nil + ESX.UI.Menu.CloseAll() + CurrentAction = nil end) -- Create blips Citizen.CreateThread(function() - local blip = AddBlipForCoord(Config.Blip.Pos.x, Config.Blip.Pos.y, Config.Blip.Pos.z) + local blip = AddBlipForCoord(Config.Blip.Pos.x, Config.Blip.Pos.y, Config.Blip.Pos.z) - SetBlipSprite (blip, Config.Blip.Sprite) - SetBlipDisplay(blip, Config.Blip.Display) - SetBlipScale (blip, Config.Blip.Scale) - SetBlipColour (blip, Config.Blip.Colour) - SetBlipAsShortRange(blip, true) + SetBlipSprite (blip, Config.Blip.Sprite) + SetBlipDisplay(blip, Config.Blip.Display) + SetBlipScale (blip, Config.Blip.Scale) + SetBlipColour (blip, Config.Blip.Colour) + SetBlipAsShortRange(blip, true) - BeginTextCommandSetBlipName("STRING") - AddTextComponentString(_U('hospital')) - EndTextCommandSetBlipName(blip) + BeginTextCommandSetBlipName("STRING") + AddTextComponentString(_U('hospital')) + EndTextCommandSetBlipName(blip) end) -- Display markers Citizen.CreateThread(function() - while true do - Citizen.Wait(0) + while true do + Citizen.Wait(0) - local coords = GetEntityCoords(GetPlayerPed(-1)) - for k,v in pairs(Config.Zones) do - if(v.Type ~= -1 and GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < Config.DrawDistance) then - if PlayerData.job ~= nil and PlayerData.job.name == 'ambulance' then - DrawMarker(v.Type, v.Pos.x, v.Pos.y, v.Pos.z, 0.0, 0.0, 0.0, 0, 0.0, 0.0, Config.MarkerSize.x, Config.MarkerSize.y, Config.MarkerSize.z, Config.MarkerColor.r, Config.MarkerColor.g, Config.MarkerColor.b, 100, false, true, 2, false, false, false, false) - elseif k ~= 'AmbulanceActions' and k ~= 'VehicleSpawner' and k ~= 'VehicleDeleter' - and k ~= 'Pharmacy' and k ~= 'StairsGoTopBottom' and k ~= 'StairsGoBottomTop' then - DrawMarker(v.Type, v.Pos.x, v.Pos.y, v.Pos.z, 0.0, 0.0, 0.0, 0, 0.0, 0.0, Config.MarkerSize.x, Config.MarkerSize.y, Config.MarkerSize.z, Config.MarkerColor.r, Config.MarkerColor.g, Config.MarkerColor.b, 100, false, true, 2, false, false, false, false) - end - end - end - end + local coords = GetEntityCoords(GetPlayerPed(-1)) + for k,v in pairs(Config.Zones) do + if(v.Type ~= -1 and GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < Config.DrawDistance) then + if PlayerData.job ~= nil and PlayerData.job.name == 'ambulance' then + DrawMarker(v.Type, v.Pos.x, v.Pos.y, v.Pos.z, 0.0, 0.0, 0.0, 0, 0.0, 0.0, Config.MarkerSize.x, Config.MarkerSize.y, Config.MarkerSize.z, Config.MarkerColor.r, Config.MarkerColor.g, Config.MarkerColor.b, 100, false, true, 2, false, false, false, false) + elseif k ~= 'AmbulanceActions' and k ~= 'VehicleSpawner' and k ~= 'VehicleDeleter' + and k ~= 'Pharmacy' and k ~= 'StairsGoTopBottom' and k ~= 'StairsGoBottomTop' then + DrawMarker(v.Type, v.Pos.x, v.Pos.y, v.Pos.z, 0.0, 0.0, 0.0, 0, 0.0, 0.0, Config.MarkerSize.x, Config.MarkerSize.y, Config.MarkerSize.z, Config.MarkerColor.r, Config.MarkerColor.g, Config.MarkerColor.b, 100, false, true, 2, false, false, false, false) + end + end + end + end end) -- Activate menu when player is inside marker Citizen.CreateThread(function() while true do - Citizen.Wait(10) - - local coords = GetEntityCoords(GetPlayerPed(-1)) - local isInMarker = false - local currentZone = nil - for k,v in pairs(Config.Zones) do - if PlayerData.job ~= nil and PlayerData.job.name == 'ambulance' then - if(GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < Config.MarkerSize.x) then - isInMarker = true - currentZone = k - end - elseif k ~= 'AmbulanceActions' and k ~= 'VehicleSpawner' and k ~= 'VehicleDeleter' and k ~= 'Pharmacy' and k ~= 'StairsGoTopBottom' and k ~= 'StairsGoBottomTop' then - if(GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < Config.MarkerSize.x) then - isInMarker = true - currentZone = k - end - end + Citizen.Wait(10) + + local coords = GetEntityCoords(GetPlayerPed(-1)) + local isInMarker = false + local currentZone = nil + for k,v in pairs(Config.Zones) do + if PlayerData.job ~= nil and PlayerData.job.name == 'ambulance' then + if(GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < Config.MarkerSize.x) then + isInMarker = true + currentZone = k end - if isInMarker and not hasAlreadyEnteredMarker then - hasAlreadyEnteredMarker = true - lastZone = currentZone - TriggerEvent('esx_ambulancejob:hasEnteredMarker', currentZone) + elseif k ~= 'AmbulanceActions' and k ~= 'VehicleSpawner' and k ~= 'VehicleDeleter' and k ~= 'Pharmacy' and k ~= 'StairsGoTopBottom' and k ~= 'StairsGoBottomTop' then + if(GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < Config.MarkerSize.x) then + isInMarker = true + currentZone = k end - - if not isInMarker and hasAlreadyEnteredMarker then - hasAlreadyEnteredMarker = false - TriggerEvent('esx_ambulancejob:hasExitedMarker', lastZone) end end + if isInMarker and not hasAlreadyEnteredMarker then + hasAlreadyEnteredMarker = true + lastZone = currentZone + TriggerEvent('esx_ambulancejob:hasEnteredMarker', currentZone) + end + + if not isInMarker and hasAlreadyEnteredMarker then + hasAlreadyEnteredMarker = false + TriggerEvent('esx_ambulancejob:hasExitedMarker', lastZone) + end + end end) -- Key Controls Citizen.CreateThread(function() - while true do + while true do - Citizen.Wait(10) + Citizen.Wait(10) - if CurrentAction ~= nil then + if CurrentAction ~= nil then - SetTextComponentFormat('STRING') - AddTextComponentString(CurrentActionMsg) - DisplayHelpTextFromStringLabel(0, 0, 1, -1) + SetTextComponentFormat('STRING') + AddTextComponentString(CurrentActionMsg) + DisplayHelpTextFromStringLabel(0, 0, 1, -1) - if IsControlJustReleased(0, Keys['E']) and PlayerData.job ~= nil and PlayerData.job.name == 'ambulance' then + if IsControlJustReleased(0, Keys['E']) and PlayerData.job ~= nil and PlayerData.job.name == 'ambulance' then - if CurrentAction == 'ambulance_actions_menu' then - OpenAmbulanceActionsMenu() - end + if CurrentAction == 'ambulance_actions_menu' then + OpenAmbulanceActionsMenu() + end - if CurrentAction == 'vehicle_spawner_menu' then - OpenVehicleSpawnerMenu() - end + if CurrentAction == 'vehicle_spawner_menu' then + OpenVehicleSpawnerMenu() + end - if CurrentAction == 'pharmacy' then - OpenPharmacyMenu() - end + if CurrentAction == 'pharmacy' then + OpenPharmacyMenu() + end - if CurrentAction == 'fast_travel_goto_top' or CurrentAction == 'fast_travel_goto_bottom' then - FastTravel(CurrentActionData.pos) - end + if CurrentAction == 'fast_travel_goto_top' or CurrentAction == 'fast_travel_goto_bottom' then + FastTravel(CurrentActionData.pos) + end - if CurrentAction == 'delete_vehicle' then - if Config.EnableSocietyOwnedVehicles then - local vehicleProps = ESX.Game.GetVehicleProperties(CurrentActionData.vehicle) - TriggerServerEvent('esx_society:putVehicleInGarage', 'ambulance', vehicleProps) - end - ESX.Game.DeleteVehicle(CurrentActionData.vehicle) - end + if CurrentAction == 'delete_vehicle' then + if Config.EnableSocietyOwnedVehicles then + local vehicleProps = ESX.Game.GetVehicleProperties(CurrentActionData.vehicle) + TriggerServerEvent('esx_society:putVehicleInGarage', 'ambulance', vehicleProps) + end + ESX.Game.DeleteVehicle(CurrentActionData.vehicle) + end - CurrentAction = nil + CurrentAction = nil - end + end - end + end - if IsControlJustReleased(0, Keys['F6']) and PlayerData.job ~= nil and PlayerData.job.name == 'ambulance' and not IsDead then - OpenMobileAmbulanceActionsMenu() - end + if IsControlJustReleased(0, Keys['F6']) and PlayerData.job ~= nil and PlayerData.job.name == 'ambulance' and not IsDead then + OpenMobileAmbulanceActionsMenu() + end - end + end end) RegisterNetEvent('esx_ambulancejob:requestDeath') @@ -936,18 +919,18 @@ if Config.LoadIpl then LoadMpDlcMaps() EnableMpDlcMaps(true) RequestIpl('Coroner_Int_on') -- Morgue - end) + end) end -- String string function stringsplit(inputstr, sep) - if sep == nil then - sep = "%s" - end - local t={} ; i=1 - for str in string.gmatch(inputstr, "([^"..sep.."]+)") do - t[i] = str - i = i + 1 - end - return t + if sep == nil then + sep = "%s" + end + local t={} ; i=1 + for str in string.gmatch(inputstr, "([^"..sep.."]+)") do + t[i] = str + i = i + 1 + end + return t end diff --git a/config.lua b/config.lua index 622bcd6a..313ac88a 100644 --- a/config.lua +++ b/config.lua @@ -14,12 +14,6 @@ local minute = 60 * second -- How much time before auto respawn at hospital Config.RespawnDelayAfterRPDeath = 10 * minute --- How much time before a menu opens to ask the player if he wants to respawn at hospital now --- The player is not obliged to select YES, but he will be auto respawn --- at the end of RespawnDelayAfterRPDeath just above. -Config.RespawnToHospitalMenuTimer = true -Config.MenuRespawnToHospitalDelay = 5 * minute - Config.EnablePlayerManagement = false Config.EnableSocietyOwnedVehicles = false @@ -27,14 +21,14 @@ Config.RemoveWeaponsAfterRPDeath = true Config.RemoveCashAfterRPDeath = true Config.RemoveItemsAfterRPDeath = true --- Will display a timer that shows RespawnDelayAfterRPDeath time remaining +-- Will display a timer that shows RespawnDelayAfterRPDeath as a countdown Config.ShowDeathTimer = true --- Will allow to respawn at any time, don't use with RespawnToHospitalMenuTimer enabled! +-- Will allow respawn after half of RespawnDelayAfterRPDeath has elapsed. Config.EarlyRespawn = false --- The player can have a fine (on bank account) -Config.RespawnFine = false -Config.RespawnFineAmount = 500 +-- The player will be fined for respawning early (on bank account) +Config.EarlyRespawnFine = false +Config.EarlyRespawnFineAmount = 500 Config.Blip = { Pos = { x = 307.76, y = -1433.47, z = 28.97 }, diff --git a/locales/br.lua b/locales/br.lua index 672bbc45..4ffcc83c 100644 --- a/locales/br.lua +++ b/locales/br.lua @@ -46,13 +46,11 @@ Locales['br'] = { -- Phone ['alert_ambulance'] = 'Alerta Socorro', -- Death - ['respawn_at_hospital'] = 'Você quer ser transportado para o hospital ?', - ['yes'] = 'Sim', - ['no'] = 'no', - ['please_wait'] = 'Você será automaticamente transportado para o hospital em ~b~%s minutos %s segundos~s~', - ['press_respawn'] = 'Aperte [~b~E~w~] para renascer.', - ['respawn_fine'] = 'you paid ~r~$%s~s~ for respawning.', - ['distress_send'] = 'press ~b~[G]~s~ to send distress signal', + ['please_wait'] = 'you will bleed out in ~b~%s minutes %s seconds~s~\n', + ['press_respawn'] = 'press [~b~E~w~] to respawn.', + ['respawn_now_fine'] = 'respawn now for ~g~$%s ~w~[Press ~b~E~w~]', + ['respawn_fine'] = 'you paid ~r~$%s~s~ to respawn.', + ['distress_send'] = 'press [~b~G~s~] to send distress signal', ['distress_sent'] = 'distress signal has been sent to available units!', ['distress_message'] = 'medical attention required: unconscious citizen!', -- Revive @@ -63,5 +61,4 @@ Locales['br'] = { ['not_enough_medikit'] = 'Você não tem ~b~Seringa~w~.', ['not_enough_bandage'] = 'Você não tem ~b~Vendagem~w~.', ['healed'] = 'Você foi tratado.', - -- Misc } diff --git a/locales/de.lua b/locales/de.lua index 7180521d..38b46ab1 100644 --- a/locales/de.lua +++ b/locales/de.lua @@ -37,13 +37,11 @@ Locales['de'] = { -- Phone ['alert_ambulance'] = 'Notdienst anrufen', -- Death - ['respawn_at_hospital'] = 'Willst du ins Krankenhaus gebracht werden?', - ['yes'] = 'ja', - ['no'] = 'no', - ['please_wait'] = 'bitte warte ~b~%s minuten %s sekunden~s~ bis zum respawn', - ['press_respawn'] = 'Drücke [~b~E~w~] zum respawnen.', - ['respawn_fine'] = 'you paid ~r~$%s~s~ for respawning.', - ['distress_send'] = 'press ~b~[G]~s~ to send distress signal', + ['please_wait'] = 'you will bleed out in ~b~%s minutes %s seconds~s~\n', + ['press_respawn'] = 'press [~b~E~w~] to respawn.', + ['respawn_now_fine'] = 'respawn now for ~g~$%s ~w~[Press ~b~E~w~]', + ['respawn_fine'] = 'you paid ~r~$%s~s~ to respawn.', + ['distress_send'] = 'press [~b~G~s~] to send distress signal', ['distress_sent'] = 'distress signal has been sent to available units!', ['distress_message'] = 'medical attention required: unconscious citizen!', -- Revive diff --git a/locales/en.lua b/locales/en.lua index 603b80e1..287033f0 100644 --- a/locales/en.lua +++ b/locales/en.lua @@ -46,22 +46,19 @@ Locales['en'] = { -- Phone ['alert_ambulance'] = 'alert Ambulance', -- Death - ['respawn_at_hospital'] = 'do you want to force respawn and spawn in the hospital?', - ['yes'] = 'yes', - ['no'] = 'no', - ['please_wait'] = 'you are unconscious and will bleed out in ~b~%s minutes and %s seconds~s~', + ['please_wait'] = 'you will bleed out in ~b~%s minutes %s seconds~s~\n', ['press_respawn'] = 'press [~b~E~w~] to respawn.', - ['respawn_fine'] = 'you paid ~r~$%s~s~ for respawning.', - ['distress_send'] = 'press ~b~[G]~s~ to send distress signal', + ['respawn_now_fine'] = 'respawn now for ~g~$%s ~w~[Press ~b~E~w~]', + ['respawn_fine'] = 'you paid ~r~$%s~s~ to respawn.', + ['distress_send'] = 'press [~b~G~s~] to send distress signal', ['distress_sent'] = 'distress signal has been sent to available units!', ['distress_message'] = 'medical attention required: unconscious citizen!', -- Revive ['revive_help'] = 'revive a player', -- Item - ['used_medikit'] = 'You have used 1x medikit', - ['used_bandage'] = 'You have used 1x bandage', + ['used_medikit'] = 'You have used ~y~1x~s~ medikit', + ['used_bandage'] = 'You have used ~y~1x~s~ bandage', ['not_enough_medikit'] = 'You do not have ~b~medikit~w~.', ['not_enough_bandage'] = 'You do not have ~b~bandage~w~.', ['healed'] = 'you have been treated.', - -- Misc } diff --git a/locales/es.lua b/locales/es.lua index 92c02650..ba4f7011 100644 --- a/locales/es.lua +++ b/locales/es.lua @@ -36,13 +36,11 @@ Locales['es'] = { -- Phone ['alert_ambulance'] = 'Alerta de ambulancia', -- Death - ['respawn_at_hospital'] = '¿Quieres ser transportado al hospital?', - ['yes'] = 'oui', - ['no'] = 'no', - ['please_wait'] = 's\'por favor, espere ~b~%s minutos %s segundos para reparecer~s~', - ['press_respawn'] = 'presione [~b~E~w~] para reparecer.', - ['respawn_fine'] = 'you paid ~r~$%s~s~ for respawning.', - ['distress_send'] = 'press ~b~[G]~s~ to send distress signal', + ['please_wait'] = 'you will bleed out in ~b~%s minutes %s seconds~s~\n', + ['press_respawn'] = 'press [~b~E~w~] to respawn.', + ['respawn_now_fine'] = 'respawn now for ~g~$%s ~w~[Press ~b~E~w~]', + ['respawn_fine'] = 'you paid ~r~$%s~s~ to respawn.', + ['distress_send'] = 'press [~b~G~s~] to send distress signal', ['distress_sent'] = 'distress signal has been sent to available units!', ['distress_message'] = 'medical attention required: unconscious citizen!', -- Revive diff --git a/locales/fi.lua b/locales/fi.lua index 4f49482c..cfa5b6b6 100644 --- a/locales/fi.lua +++ b/locales/fi.lua @@ -46,15 +46,13 @@ Locales['fi'] = { -- Phone ['alert_ambulance'] = 'hälyytys Ensihoidolle', -- Death - ['respawn_at_hospital'] = 'haluatko respawnata sairaalalle heti ?', - ['yes'] = 'kyllä', - ['no'] = 'ei', - ['please_wait'] = 'olet tajuton, vuodat kuiviin ~b~%s minuutin ja %s sekunnin~s~ kuluttua', - ['press_respawn'] = 'paina [~b~E~w~] respawnataksesi.', - ['respawn_fine'] = 'sinä maksoit ~r~$%s~s~ respawnaamisesta.', - ['distress_send'] = 'paina ~b~[G]~s~ lähettääksesi hätäsignaalin', - ['distress_sent'] = 'hätäsignaali lähetetty vapailla yksiköille.', - ['distress_message'] = 'tarvittava ensihoitoa: tajuton kansalainen!', + ['please_wait'] = 'you will bleed out in ~b~%s minutes %s seconds~s~\n', + ['press_respawn'] = 'press [~b~E~w~] to respawn.', + ['respawn_now_fine'] = 'respawn now for ~g~$%s ~w~[Press ~b~E~w~]', + ['respawn_fine'] = 'you paid ~r~$%s~s~ to respawn.', + ['distress_send'] = 'press [~b~G~s~] to send distress signal', + ['distress_sent'] = 'distress signal has been sent to available units!', + ['distress_message'] = 'medical attention required: unconscious citizen!', -- Revive ['revive_help'] = 'elvytä pelaaja', -- Item diff --git a/locales/fr.lua b/locales/fr.lua index 355a37a3..073193d4 100644 --- a/locales/fr.lua +++ b/locales/fr.lua @@ -46,13 +46,11 @@ Locales['fr'] = { -- Phone ['alert_ambulance'] = 'alerte Ambulance', -- Death - ['respawn_at_hospital'] = 'voulez-vous être transporté à l\'hôpital ?', - ['yes'] = 'oui', - ['no'] = 'no', - ['please_wait'] = 'Vous serez automatiquement transporté à l\'hôpital dans ~b~%s minutes %s secondes~s~', - ['press_respawn'] = 'appuyez sur [~b~E~w~] pour réapparaître.', - ['respawn_fine'] = 'vous avez payer ~r~$%s~s~ pour réapparaître.', - ['distress_send'] = 'press ~b~[G]~s~ to send distress signal', + ['please_wait'] = 'you will bleed out in ~b~%s minutes %s seconds~s~\n', + ['press_respawn'] = 'press [~b~E~w~] to respawn.', + ['respawn_now_fine'] = 'respawn now for ~g~$%s ~w~[Press ~b~E~w~]', + ['respawn_fine'] = 'you paid ~r~$%s~s~ to respawn.', + ['distress_send'] = 'press [~b~G~s~] to send distress signal', ['distress_sent'] = 'distress signal has been sent to available units!', ['distress_message'] = 'medical attention required: unconscious citizen!', -- Revive diff --git a/locales/pl.lua b/locales/pl.lua index 1e8b1663..aca5f6f5 100644 --- a/locales/pl.lua +++ b/locales/pl.lua @@ -46,11 +46,13 @@ Locales['pl'] = { -- Phone ['alert_ambulance'] = 'wezwij ambulans', -- Death - ['respawn_at_hospital'] = 'czy chcesz odrodzić się w szpitalu?', - ['yes'] = 'tak', - ['please_wait'] = 'jesteś nieprzytomny i będziesz się wykrwawiał ~b~%s minut i %s sekund~s~', - ['press_respawn'] = 'naciśnij [~b~E~w~] aby się odrodzić.', - ['respawn_fine'] = 'zapłaciłeś ~r~$%s~s~ za odrodzenie.', + ['please_wait'] = 'you will bleed out in ~b~%s minutes %s seconds~s~\n', + ['press_respawn'] = 'press [~b~E~w~] to respawn.', + ['respawn_now_fine'] = 'respawn now for ~g~$%s ~w~[Press ~b~E~w~]', + ['respawn_fine'] = 'you paid ~r~$%s~s~ to respawn.', + ['distress_send'] = 'press [~b~G~s~] to send distress signal', + ['distress_sent'] = 'distress signal has been sent to available units!', + ['distress_message'] = 'medical attention required: unconscious citizen!', -- Revive ['revive_help'] = 'ożyw gracza', -- Item diff --git a/locales/sv.lua b/locales/sv.lua index 9f607914..b60946d2 100644 --- a/locales/sv.lua +++ b/locales/sv.lua @@ -46,15 +46,13 @@ Locales['sv'] = { -- Phone ['alert_ambulance'] = 'Ring ambulansen', -- Death - ['respawn_at_hospital'] = 'Vill du snabbresa till sjukhuset?', - ['yes'] = 'ja', - ['no'] = 'nej', - ['please_wait'] = 'du är medvetslös och kommer att dö om ~b~%s minuter och %s sekunder~s~', - ['press_respawn'] = 'tryck [~b~E~w~] för att respawna.', - ['respawn_fine'] = 'du betalade ~r~$%s~s~ för att respawna.', - ['distress_send'] = 'tryck ~b~[G]~s~ för att skicka nödsignal', - ['distress_sent'] = 'nödsignal har skickats till samtliga enheter!', - ['distress_message'] = 'läkarvård krävs: medvetslös medborgare!', + ['please_wait'] = 'you will bleed out in ~b~%s minutes %s seconds~s~\n', + ['press_respawn'] = 'press [~b~E~w~] to respawn.', + ['respawn_now_fine'] = 'respawn now for ~g~$%s ~w~[Press ~b~E~w~]', + ['respawn_fine'] = 'you paid ~r~$%s~s~ to respawn.', + ['distress_send'] = 'press [~b~G~s~] to send distress signal', + ['distress_sent'] = 'distress signal has been sent to available units!', + ['distress_message'] = 'medical attention required: unconscious citizen!', -- Revive ['revive_help'] = 'Återuppliva en spelare', -- Item diff --git a/localization/en_esx_ambulancejob.sql b/localization/en_esx_ambulancejob.sql index 87c43e10..8ba7a87a 100644 --- a/localization/en_esx_ambulancejob.sql +++ b/localization/en_esx_ambulancejob.sql @@ -1,27 +1,27 @@ USE `essentialmode`; INSERT INTO `addon_account` (name, label, shared) VALUES - ('society_ambulance', 'Ambulance', 1) + ('society_ambulance', 'EMS', 1) ; INSERT INTO `addon_inventory` (name, label, shared) VALUES - ('society_ambulance', 'Ambulance', 1) + ('society_ambulance', 'EMS', 1) ; INSERT INTO `datastore` (name, label, shared) VALUES - ('society_ambulance', 'Ambulance', 1) + ('society_ambulance', 'EMS', 1) ; INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_female) VALUES - ('ambulance',0,'ambulance','Ambulance',20,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), - ('ambulance',1,'doctor','Doctor',40,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), - ('ambulance',2,'chief_doctor','Chief doctor',60,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), - ('ambulance',3,'boss','Surgeon',80,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}') + ('ambulance',0,'ambulance','Jr. EMT',20,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), + ('ambulance',1,'doctor','EMT',40,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), + ('ambulance',2,'chief_doctor','Sr. EMT',60,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), + ('ambulance',3,'boss','EMT Supervisor',80,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}') ; INSERT INTO `jobs` (name, label) VALUES - ('ambulance','Ambulance') + ('ambulance','EMS') ; INSERT INTO `items` (name, label, `limit`) VALUES diff --git a/server/main.lua b/server/main.lua index 4f72535e..5a2f52f2 100644 --- a/server/main.lua +++ b/server/main.lua @@ -6,14 +6,14 @@ RegisterServerEvent('esx_ambulancejob:revive') AddEventHandler('esx_ambulancejob:revive', function(target) local _source = source local xPlayer = ESX.GetPlayerFromId(_source) - + xPlayer.addMoney(Config.ReviveReward) TriggerClientEvent('esx_ambulancejob:revive', target) end) RegisterServerEvent('esx_ambulancejob:heal') AddEventHandler('esx_ambulancejob:heal', function(target, type) - TriggerClientEvent('esx_ambulancejob:heal', target, type) + TriggerClientEvent('esx_ambulancejob:heal', target, type) end) TriggerEvent('esx_phone:registerNumber', 'ambulance', _U('alert_ambulance'), true, true) @@ -62,47 +62,66 @@ ESX.RegisterServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function( end) end - if Config.RespawnFine then - TriggerClientEvent('esx:showNotification', xPlayer.source, _U('respawn_fine', Config.RespawnFineAmount)) - xPlayer.removeAccountMoney('bank', Config.RespawnFineAmount) - end - cb() end) +if Config.EarlyRespawn and Config.EarlyRespawnFine then + ESX.RegisterServerCallback('esx_ambulancejob:checkBalance', function(source, cb) + + local xPlayer = ESX.GetPlayerFromId(source) + local bankBalance = xPlayer.getAccount('bank').money + local finePayable = false + + if bankBalance >= Config.EarlyRespawnFineAmount then + finePayable = true + else + finePayable = false + end + + cb(finePayable) + end) + + ESX.RegisterServerCallback('esx_ambulancejob:payFine', function(source, cb) + local xPlayer = ESX.GetPlayerFromId(source) + TriggerClientEvent('esx:showNotification', xPlayer.source, _U('respawn_fine', Config.EarlyRespawnFineAmount)) + xPlayer.removeAccountMoney('bank', Config.EarlyRespawnFineAmount) + cb() + end) +end + ESX.RegisterServerCallback('esx_ambulancejob:getItemAmount', function(source, cb, item) - local xPlayer = ESX.GetPlayerFromId(source) - local qtty = xPlayer.getInventoryItem(item).count - cb(qtty) + local xPlayer = ESX.GetPlayerFromId(source) + local qtty = xPlayer.getInventoryItem(item).count + cb(qtty) end) RegisterServerEvent('esx_ambulancejob:removeItem') AddEventHandler('esx_ambulancejob:removeItem', function(item) - local _source = source - local xPlayer = ESX.GetPlayerFromId(_source) - xPlayer.removeInventoryItem(item, 1) - if item == 'bandage' then - TriggerClientEvent('esx:showNotification', _source, _U('used_bandage')) - elseif item == 'medikit' then - TriggerClientEvent('esx:showNotification', _source, _U('used_medikit')) - end + local _source = source + local xPlayer = ESX.GetPlayerFromId(_source) + xPlayer.removeInventoryItem(item, 1) + if item == 'bandage' then + TriggerClientEvent('esx:showNotification', _source, _U('used_bandage')) + elseif item == 'medikit' then + TriggerClientEvent('esx:showNotification', _source, _U('used_medikit')) + end end) RegisterServerEvent('esx_ambulancejob:giveItem') AddEventHandler('esx_ambulancejob:giveItem', function(item) - local _source = source - local xPlayer = ESX.GetPlayerFromId(_source) - local limit = xPlayer.getInventoryItem(item).limit - local delta = 1 - local qtty = xPlayer.getInventoryItem(item).count - if limit ~= -1 then - delta = limit - qtty - end - if qtty < limit then - xPlayer.addInventoryItem(item, delta) - else - TriggerClientEvent('esx:showNotification', _source, _U('max_item')) - end + local _source = source + local xPlayer = ESX.GetPlayerFromId(_source) + local limit = xPlayer.getInventoryItem(item).limit + local delta = 1 + local qtty = xPlayer.getInventoryItem(item).count + if limit ~= -1 then + delta = limit - qtty + end + if qtty < limit then + xPlayer.addInventoryItem(item, delta) + else + TriggerClientEvent('esx:showNotification', _source, _U('max_item')) + end end) TriggerEvent('es:addGroupCommand', 'revive', 'admin', function(source, args, user) @@ -115,23 +134,23 @@ TriggerEvent('es:addGroupCommand', 'revive', 'admin', function(source, args, use TriggerClientEvent('esx_ambulancejob:revive', source) end end, function(source, args, user) - TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "Insufficient Permissions.") -end, {help = _U('revive_help'), params = {{name = 'id'}}}) + TriggerClientEvent('chat:addMessage', source, { args = { '^1SYSTEM', 'Insufficient Permissions.' } }) +end, { help = _U('revive_help'), params = { { name = 'id' } } }) ESX.RegisterUsableItem('medikit', function(source) - local _source = source - local xPlayer = ESX.GetPlayerFromId(_source) - xPlayer.removeInventoryItem('medikit', 1) - TriggerClientEvent('esx_ambulancejob:heal', _source, 'big') - TriggerClientEvent('esx:showNotification', _source, _U('used_medikit')) + local _source = source + local xPlayer = ESX.GetPlayerFromId(_source) + xPlayer.removeInventoryItem('medikit', 1) + TriggerClientEvent('esx_ambulancejob:heal', _source, 'big') + TriggerClientEvent('esx:showNotification', _source, _U('used_medikit')) end) ESX.RegisterUsableItem('bandage', function(source) - local _source = source - local xPlayer = ESX.GetPlayerFromId(_source) - xPlayer.removeInventoryItem('bandage', 1) - TriggerClientEvent('esx_ambulancejob:heal', _source, 'small') - TriggerClientEvent('esx:showNotification', _source, _U('used_bandage')) + local _source = source + local xPlayer = ESX.GetPlayerFromId(_source) + xPlayer.removeInventoryItem('bandage', 1) + TriggerClientEvent('esx_ambulancejob:heal', _source, 'small') + TriggerClientEvent('esx:showNotification', _source, _U('used_bandage')) end) RegisterServerEvent('esx_ambulancejob:firstSpawn') @@ -157,4 +176,4 @@ AddEventHandler('esx_ambulancejob:setDeathStatus', function(isDead) ['@identifier'] = GetPlayerIdentifiers(_source)[1], ['@isDead'] = isDead }) -end) \ No newline at end of file +end) From ad4c159a0b8a88b89fce1e110098277216c15185 Mon Sep 17 00:00:00 2001 From: nearbyplayer Date: Fri, 10 Aug 2018 12:50:30 -0400 Subject: [PATCH 091/177] Fixes Indentation & Formatting This fixes indentation and follows .editorconfig --- __resource.lua | 2 +- client/main.lua | 972 ++++++++++++++++++++++++------------------------ 2 files changed, 487 insertions(+), 487 deletions(-) diff --git a/__resource.lua b/__resource.lua index fb66dda0..8014bec8 100644 --- a/__resource.lua +++ b/__resource.lua @@ -33,4 +33,4 @@ client_scripts { 'client/main.lua' } -dependency 'es_extended' \ No newline at end of file +dependency 'es_extended' diff --git a/client/main.lua b/client/main.lua index 08291653..b8f3b0cb 100644 --- a/client/main.lua +++ b/client/main.lua @@ -10,21 +10,22 @@ local Keys = { ["NENTER"] = 201, ["N4"] = 108, ["N5"] = 60, ["N6"] = 107, ["N+"] = 96, ["N-"] = 97, ["N7"] = 117, ["N8"] = 61, ["N9"] = 118 } -local PlayerData = {} -local FirstSpawn = true -local IsDead = false -local HasAlreadyEnteredMarker = false -local LastZone = nil -local CurrentAction = nil -local CurrentActionMsg = '' -local CurrentActionData = {} -local IsBusy = false -ESX = nil +local PlayerData = {} +local FirstSpawn = true +local IsDead = false +local HasAlreadyEnteredMarker = false +local LastZone = nil +local CurrentAction = nil +local CurrentActionMsg = '' +local CurrentActionData = {} +local IsBusy = false + +ESX = nil Citizen.CreateThread(function() while ESX == nil do - TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) - Citizen.Wait(0) + TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) + Citizen.Wait(0) end Citizen.Wait(5000) @@ -46,60 +47,61 @@ AddEventHandler('esx_ambulancejob:heal', function(_type) local playerPed = GetPlayerPed(-1) local maxHealth = GetEntityMaxHealth(playerPed) if _type == 'small' then - local health = GetEntityHealth(playerPed) - local newHealth = math.min(maxHealth , math.floor(health + maxHealth/8)) - SetEntityHealth(playerPed, newHealth) + local health = GetEntityHealth(playerPed) + local newHealth = math.min(maxHealth , math.floor(health + maxHealth/8)) + SetEntityHealth(playerPed, newHealth) elseif _type == 'big' then - SetEntityHealth(playerPed, maxHealth) + SetEntityHealth(playerPed, maxHealth) end ESX.ShowNotification(_U('healed')) end) + function StartRespawnTimer() Citizen.SetTimeout(Config.RespawnDelayAfterRPDeath, function() - if IsDead then - RemoveItemsAfterRPDeath() - end + if IsDead then + RemoveItemsAfterRPDeath() + end end) end function StartDistressSignal() Citizen.CreateThread(function() - local respawnTimer = Config.RespawnDelayAfterRPDeath + local timer = Config.RespawnDelayAfterRPDeath - while respawnTimer > 0 and IsDead do - Citizen.Wait(2) - respawnTimer = respawnTimer - 30 + while timer > 0 and IsDead do + Citizen.Wait(2) + timer = timer - 30 - SetTextFont(4) - SetTextProportional(1) - SetTextScale(0.45, 0.45) - SetTextColour(185, 185, 185, 255) - SetTextDropShadow(0, 0, 0, 0, 255) - SetTextEdge(1, 0, 0, 0, 255) - SetTextDropShadow() - SetTextOutline() - BeginTextCommandDisplayText('STRING') - AddTextComponentSubstringPlayerName(_U('distress_send')) - EndTextCommandDisplayText(0.175, 0.805) + SetTextFont(4) + SetTextProportional(1) + SetTextScale(0.45, 0.45) + SetTextColour(185, 185, 185, 255) + SetTextDropShadow(0, 0, 0, 0, 255) + SetTextEdge(1, 0, 0, 0, 255) + SetTextDropShadow() + SetTextOutline() + BeginTextCommandDisplayText('STRING') + AddTextComponentSubstringPlayerName(_U('distress_send')) + EndTextCommandDisplayText(0.175, 0.805) - if IsControlPressed(0, Keys['G']) then - SendDistressSignal() - break + if IsControlPressed(0, Keys['G']) then + SendDistressSignal() + break + end end - end end) end function SendDistressSignal() local playerPed = GetPlayerPed(-1) - local coords = GetEntityCoords(playerPed) + local coords = GetEntityCoords(playerPed) ESX.ShowNotification(_U('distress_sent')) TriggerServerEvent('esx_phone:send', 'ambulance', _U('distress_message'), false, { - x = coords.x, - y = coords.y, - z = coords.z + x = coords.x, + y = coords.y, + z = coords.z }) end @@ -110,67 +112,67 @@ function ShowDeathTimer() local payFine = false if Config.EarlyRespawn and Config.EarlyRespawnFine then - ESX.TriggerServerCallback('esx_ambulancejob:checkBalance', function(finePayable) - if finePayable then - payFine = true - else - payFine = false - end - end) + ESX.TriggerServerCallback('esx_ambulancejob:checkBalance', function(finePayable) + if finePayable then + payFine = true + else + payFine = false + end + end) end Citizen.CreateThread(function() - while respawnTimer > 0 and IsDead do - Citizen.Wait(0) + while respawnTimer > 0 and IsDead do + Citizen.Wait(0) - raw_seconds = respawnTimer/1000 - raw_minutes = raw_seconds/60 - minutes = stringsplit(raw_minutes, ".")[1] - seconds = stringsplit(raw_seconds-(minutes*60), ".")[1] + raw_seconds = respawnTimer/1000 + raw_minutes = raw_seconds/60 + minutes = stringsplit(raw_minutes, ".")[1] + seconds = stringsplit(raw_seconds-(minutes*60), ".")[1] - SetTextFont(4) - SetTextProportional(0) - SetTextScale(0.0, 0.5) - SetTextColour(255, 255, 255, 255) - SetTextDropshadow(0, 0, 0, 0, 255) - SetTextEdge(1, 0, 0, 0, 255) - SetTextDropShadow() - SetTextOutline() + SetTextFont(4) + SetTextProportional(0) + SetTextScale(0.0, 0.5) + SetTextColour(255, 255, 255, 255) + SetTextDropshadow(0, 0, 0, 0, 255) + SetTextEdge(1, 0, 0, 0, 255) + SetTextDropShadow() + SetTextOutline() - local text = _U('please_wait', minutes, seconds) + local text = _U('please_wait', minutes, seconds) - if Config.EarlyRespawn then - if not Config.EarlyRespawnFine and respawnTimer <= allowRespawn then - text = text .. _U('press_respawn') - elseif Config.EarlyRespawnFine and respawnTimer <= allowRespawn and payFine then - text = text .. _U('respawn_now_fine', fineAmount) - else - text = text - end - end - - SetTextCentre(true) - SetTextEntry("STRING") - AddTextComponentString(text) - DrawText(0.5, 0.8) - - if Config.EarlyRespawn then - if not Config.EarlyRespawnFine then - if IsControlPressed(0, Keys['E']) then - RemoveItemsAfterRPDeath() - break - end - elseif Config.EarlyRespawnFine then - if respawnTimer <= allowRespawn and payFine then - if IsControlPressed(0, Keys['E']) then - PayFine() - break + if Config.EarlyRespawn then + if not Config.EarlyRespawnFine and respawnTimer <= allowRespawn then + text = text .. _U('press_respawn') + elseif Config.EarlyRespawnFine and respawnTimer <= allowRespawn and payFine then + text = text .. _U('respawn_now_fine', fineAmount) + else + text = text + end end + + SetTextCentre(true) + SetTextEntry("STRING") + AddTextComponentString(text) + DrawText(0.5, 0.8) + + if Config.EarlyRespawn then + if not Config.EarlyRespawnFine then + if IsControlPressed(0, Keys['E']) then + RemoveItemsAfterRPDeath() + break + end + elseif Config.EarlyRespawnFine then + if respawnTimer <= allowRespawn and payFine then + if IsControlPressed(0, Keys['E']) then + PayFine() + break + end + end + end end + respawnTimer = respawnTimer - 15 end - end - respawnTimer = respawnTimer - 15 - end end) end @@ -178,21 +180,21 @@ function RemoveItemsAfterRPDeath() TriggerServerEvent('esx_ambulancejob:setDeathStatus', 0) Citizen.CreateThread(function() - DoScreenFadeOut(800) - while not IsScreenFadedOut() do - Citizen.Wait(10) - end + DoScreenFadeOut(800) + while not IsScreenFadedOut() do + Citizen.Wait(10) + end - ESX.TriggerServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function() - ESX.SetPlayerData('lastPosition', Config.Zones.HospitalInteriorInside1.Pos) - ESX.SetPlayerData('loadout', {}) + ESX.TriggerServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function() + ESX.SetPlayerData('lastPosition', Config.Zones.HospitalInteriorInside1.Pos) + ESX.SetPlayerData('loadout', {}) - TriggerServerEvent('esx:updateLastPosition', Config.Zones.HospitalInteriorInside1.Pos) - RespawnPed(GetPlayerPed(-1), Config.Zones.HospitalInteriorInside1.Pos) + TriggerServerEvent('esx:updateLastPosition', Config.Zones.HospitalInteriorInside1.Pos) + RespawnPed(GetPlayerPed(-1), Config.Zones.HospitalInteriorInside1.Pos) - StopScreenEffect('DeathFailOut') - DoScreenFadeIn(800) - end) + StopScreenEffect('DeathFailOut') + DoScreenFadeIn(800) + end) end) end @@ -206,8 +208,8 @@ function OnPlayerDeath() IsDead = true TriggerServerEvent('esx_ambulancejob:setDeathStatus', 1) - if Config.ShowDeathTimer then - ShowDeathTimer() + if Config.ShowDeathTimer == true then + ShowDeathTimer() end StartRespawnTimer() @@ -221,15 +223,15 @@ function TeleportFadeEffect(entity, coords) Citizen.CreateThread(function() - DoScreenFadeOut(800) + DoScreenFadeOut(800) - while not IsScreenFadedOut() do - Citizen.Wait(0) - end + while not IsScreenFadedOut() do + Citizen.Wait(0) + end - ESX.Game.Teleport(entity, coords, function() - DoScreenFadeIn(800) - end) + ESX.Game.Teleport(entity, coords, function() + DoScreenFadeIn(800) + end) end) @@ -240,29 +242,29 @@ function WarpPedInClosestVehicle(ped) local coords = GetEntityCoords(ped) local vehicle, distance = ESX.Game.GetClosestVehicle({ - x = coords.x, - y = coords.y, - z = coords.z + x = coords.x, + y = coords.y, + z = coords.z }) if distance ~= -1 and distance <= 5.0 then - local maxSeats = GetVehicleMaxNumberOfPassengers(vehicle) - local freeSeat = nil + local maxSeats = GetVehicleMaxNumberOfPassengers(vehicle) + local freeSeat = nil - for i=maxSeats - 1, 0, -1 do - if IsVehicleSeatFree(vehicle, i) then - freeSeat = i - break + for i=maxSeats - 1, 0, -1 do + if IsVehicleSeatFree(vehicle, i) then + freeSeat = i + break + end end - end - if freeSeat ~= nil then - TaskWarpPedIntoVehicle(ped, vehicle, freeSeat) - end + if freeSeat ~= nil then + TaskWarpPedIntoVehicle(ped, vehicle, freeSeat) + end else - ESX.ShowNotification(_U('no_vehicles')) + ESX.ShowNotification(_U('no_vehicles')) end end @@ -270,44 +272,44 @@ end function OpenAmbulanceActionsMenu() local elements = { - {label = _U('cloakroom'), value = 'cloakroom'} + {label = _U('cloakroom'), value = 'cloakroom'} } if Config.EnablePlayerManagement and PlayerData.job.grade_name == 'boss' then - table.insert(elements, {label = _U('boss_actions'), value = 'boss_actions'}) + table.insert(elements, {label = _U('boss_actions'), value = 'boss_actions'}) end ESX.UI.Menu.CloseAll() ESX.UI.Menu.Open( - 'default', GetCurrentResourceName(), 'ambulance_actions', - { - title = _U('ambulance'), - align = 'top-left', - elements = elements - }, - function(data, menu) + 'default', GetCurrentResourceName(), 'ambulance_actions', + { + title = _U('ambulance'), + align = 'top-left', + elements = elements + }, + function(data, menu) - if data.current.value == 'cloakroom' then - OpenCloakroomMenu() - end + if data.current.value == 'cloakroom' then + OpenCloakroomMenu() + end + + if data.current.value == 'boss_actions' then + TriggerEvent('esx_society:openBossMenu', 'ambulance', function(data, menu) + menu.close() + end, {wash = false}) + end + + end, + function(data, menu) - if data.current.value == 'boss_actions' then - TriggerEvent('esx_society:openBossMenu', 'ambulance', function(data, menu) menu.close() - end, {wash = false}) + + CurrentAction = 'ambulance_actions_menu' + CurrentActionMsg = _U('open_menu') + CurrentActionData = {} + end - - end, - function(data, menu) - - menu.close() - - CurrentAction = 'ambulance_actions_menu' - CurrentActionMsg = _U('open_menu') - CurrentActionData = {} - - end ) end @@ -319,195 +321,195 @@ function OpenMobileAmbulanceActionsMenu() ESX.UI.Menu.Open( 'default', GetCurrentResourceName(), 'mobile_ambulance_actions', { - title = _U('ambulance'), - align = 'top-left', - elements = { - {label = _U('ems_menu'), value = 'citizen_interaction'}, - } - }, function(data, menu) - if data.current.value == 'citizen_interaction' then - ESX.UI.Menu.Open( - 'default', GetCurrentResourceName(), 'citizen_interaction', - { - title = _U('ems_menu_title'), - align = 'top-left', - elements = { - {label = _U('ems_menu_revive'), value = 'revive'}, - {label = _U('ems_menu_small'), value = 'small'}, - {label = _U('ems_menu_big'), value = 'big'}, - {label = _U('ems_menu_putincar'), value = 'put_in_vehicle'}, + title = _U('ambulance'), + align = 'top-left', + elements = { + {label = _U('ems_menu'), value = 'citizen_interaction'}, } - }, function(data, menu) - if IsBusy then return end - if data.current.value == 'revive' then -- revive + }, function(data, menu) + if data.current.value == 'citizen_interaction' then + ESX.UI.Menu.Open( + 'default', GetCurrentResourceName(), 'citizen_interaction', + { + title = _U('ems_menu_title'), + align = 'top-left', + elements = { + {label = _U('ems_menu_revive'), value = 'revive'}, + {label = _U('ems_menu_small'), value = 'small'}, + {label = _U('ems_menu_big'), value = 'big'}, + {label = _U('ems_menu_putincar'), value = 'put_in_vehicle'}, + } + }, function(data, menu) + if IsBusy then return end + if data.current.value == 'revive' then -- revive - local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() + local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() - if closestPlayer == -1 or closestDistance > 3.0 then - ESX.ShowNotification(_U('no_players')) - else - ESX.TriggerServerCallback('esx_ambulancejob:getItemAmount', function(qtty) - if qtty > 0 then - local closestPlayerPed = GetPlayerPed(closestPlayer) - local health = GetEntityHealth(closestPlayerPed) - - if health == 0 then - local playerPed = GetPlayerPed(-1) - - IsBusy = true - ESX.ShowNotification(_U('revive_inprogress')) - TaskStartScenarioInPlace(playerPed, 'CODE_HUMAN_MEDIC_TEND_TO_DEAD', 0, true) - Citizen.Wait(10000) - ClearPedTasks(playerPed) - - TriggerServerEvent('esx_ambulancejob:removeItem', 'medikit') - TriggerServerEvent('esx_ambulancejob:revive', GetPlayerServerId(closestPlayer)) - IsBusy = false - - -- Show revive award? - if Config.ReviveReward > 0 then - ESX.ShowNotification(_U('revive_complete_award', GetPlayerName(closestPlayer), Config.ReviveReward)) + if closestPlayer == -1 or closestDistance > 3.0 then + ESX.ShowNotification(_U('no_players')) else - ESX.ShowNotification(_U('revive_complete', GetPlayerName(closestPlayer))) + ESX.TriggerServerCallback('esx_ambulancejob:getItemAmount', function(qtty) + if qtty > 0 then + local closestPlayerPed = GetPlayerPed(closestPlayer) + local health = GetEntityHealth(closestPlayerPed) + + if health == 0 then + local playerPed = GetPlayerPed(-1) + + IsBusy = true + ESX.ShowNotification(_U('revive_inprogress')) + TaskStartScenarioInPlace(playerPed, 'CODE_HUMAN_MEDIC_TEND_TO_DEAD', 0, true) + Citizen.Wait(10000) + ClearPedTasks(playerPed) + + TriggerServerEvent('esx_ambulancejob:removeItem', 'medikit') + TriggerServerEvent('esx_ambulancejob:revive', GetPlayerServerId(closestPlayer)) + IsBusy = false + + -- Show revive award? + if Config.ReviveReward > 0 then + ESX.ShowNotification(_U('revive_complete_award', GetPlayerName(closestPlayer), Config.ReviveReward)) + else + ESX.ShowNotification(_U('revive_complete', GetPlayerName(closestPlayer))) + end + else + ESX.ShowNotification(_U('player_not_unconscious')) + end + else + ESX.ShowNotification(_U('not_enough_medikit')) + end + end, 'medikit') + end + elseif data.current.value == 'small' then + + local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() + if closestPlayer == -1 or closestDistance > 3.0 then + ESX.ShowNotification(_U('no_players')) + else + ESX.TriggerServerCallback('esx_ambulancejob:getItemAmount', function(qtty) + if qtty > 0 then + local closestPlayerPed = GetPlayerPed(closestPlayer) + local health = GetEntityHealth(closestPlayerPed) + + if health > 0 then + local playerPed = GetPlayerPed(-1) + + IsBusy = true + ESX.ShowNotification(_U('heal_inprogress')) + TaskStartScenarioInPlace(playerPed, 'CODE_HUMAN_MEDIC_TEND_TO_DEAD', 0, true) + Citizen.Wait(10000) + ClearPedTasks(playerPed) + + TriggerServerEvent('esx_ambulancejob:removeItem', 'bandage') + TriggerServerEvent('esx_ambulancejob:heal', GetPlayerServerId(closestPlayer), 'small') + ESX.ShowNotification(_U('heal_complete', GetPlayerName(closestPlayer))) + IsBusy = false + else + ESX.ShowNotification(_U('player_not_conscious')) + end + else + ESX.ShowNotification(_U('not_enough_bandage')) + end + end, 'bandage') + end + elseif data.current.value == 'big' then + + local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() + if closestPlayer == -1 or closestDistance > 3.0 then + ESX.ShowNotification(_U('no_players')) + else + ESX.TriggerServerCallback('esx_ambulancejob:getItemAmount', function(qtty) + if qtty > 0 then + local closestPlayerPed = GetPlayerPed(closestPlayer) + local health = GetEntityHealth(closestPlayerPed) + + if health > 0 then + local playerPed = GetPlayerPed(-1) + + IsBusy = true + ESX.ShowNotification(_U('heal_inprogress')) + TaskStartScenarioInPlace(playerPed, 'CODE_HUMAN_MEDIC_TEND_TO_DEAD', 0, true) + Citizen.Wait(10000) + ClearPedTasks(playerPed) + + TriggerServerEvent('esx_ambulancejob:removeItem', 'medikit') + TriggerServerEvent('esx_ambulancejob:heal', GetPlayerServerId(closestPlayer), 'big') + ESX.ShowNotification(_U('heal_complete', GetPlayerName(closestPlayer))) + IsBusy = false + else + ESX.ShowNotification(_U('player_not_conscious')) + end + else + ESX.ShowNotification(_U('not_enough_medikit')) + end + end, 'medikit') + end + elseif data.current.value == 'put_in_vehicle' then + + local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() + if closestPlayer == -1 or closestDistance > 3.0 then + ESX.ShowNotification(_U('no_vehicles')) + else + menu.close() + WarpPedInClosestVehicle(GetPlayerPed(closestPlayer)) end - else - ESX.ShowNotification(_U('player_not_unconscious')) end - else - ESX.ShowNotification(_U('not_enough_medikit')) - end - end, 'medikit') - end - elseif data.current.value == 'small' then - - local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() - if closestPlayer == -1 or closestDistance > 3.0 then - ESX.ShowNotification(_U('no_players')) - else - ESX.TriggerServerCallback('esx_ambulancejob:getItemAmount', function(qtty) - if qtty > 0 then - local closestPlayerPed = GetPlayerPed(closestPlayer) - local health = GetEntityHealth(closestPlayerPed) - - if health > 0 then - local playerPed = GetPlayerPed(-1) - - IsBusy = true - ESX.ShowNotification(_U('heal_inprogress')) - TaskStartScenarioInPlace(playerPed, 'CODE_HUMAN_MEDIC_TEND_TO_DEAD', 0, true) - Citizen.Wait(10000) - ClearPedTasks(playerPed) - - TriggerServerEvent('esx_ambulancejob:removeItem', 'bandage') - TriggerServerEvent('esx_ambulancejob:heal', GetPlayerServerId(closestPlayer), 'small') - ESX.ShowNotification(_U('heal_complete', GetPlayerName(closestPlayer))) - IsBusy = false - else - ESX.ShowNotification(_U('player_not_conscious')) - end - else - ESX.ShowNotification(_U('not_enough_bandage')) - end - end, 'bandage') - end - elseif data.current.value == 'big' then - - local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() - if closestPlayer == -1 or closestDistance > 3.0 then - ESX.ShowNotification(_U('no_players')) - else - ESX.TriggerServerCallback('esx_ambulancejob:getItemAmount', function(qtty) - if qtty > 0 then - local closestPlayerPed = GetPlayerPed(closestPlayer) - local health = GetEntityHealth(closestPlayerPed) - - if health > 0 then - local playerPed = GetPlayerPed(-1) - - IsBusy = true - ESX.ShowNotification(_U('heal_inprogress')) - TaskStartScenarioInPlace(playerPed, 'CODE_HUMAN_MEDIC_TEND_TO_DEAD', 0, true) - Citizen.Wait(10000) - ClearPedTasks(playerPed) - - TriggerServerEvent('esx_ambulancejob:removeItem', 'medikit') - TriggerServerEvent('esx_ambulancejob:heal', GetPlayerServerId(closestPlayer), 'big') - ESX.ShowNotification(_U('heal_complete', GetPlayerName(closestPlayer))) - IsBusy = false - else - ESX.ShowNotification(_U('player_not_conscious')) - end - else - ESX.ShowNotification(_U('not_enough_medikit')) - end - end, 'medikit') - end - elseif data.current.value == 'put_in_vehicle' then - - local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() - if closestPlayer == -1 or closestDistance > 3.0 then - ESX.ShowNotification(_U('no_vehicles')) - else - menu.close() - WarpPedInClosestVehicle(GetPlayerPed(closestPlayer)) - end + end, function(data, menu) + menu.close() + end) end - end, function(data, menu) - menu.close() - end) - end end, function(data, menu) - menu.close() + menu.close() end) end function OpenCloakroomMenu() ESX.UI.Menu.Open( - 'default', GetCurrentResourceName(), 'cloakroom', - { - title = _U('cloakroom'), - align = 'top-left', - elements = { - {label = _U('ems_clothes_civil'), value = 'citizen_wear'}, - {label = _U('ems_clothes_ems'), value = 'ambulance_wear'}, + 'default', GetCurrentResourceName(), 'cloakroom', + { + title = _U('cloakroom'), + align = 'top-left', + elements = { + {label = _U('ems_clothes_civil'), value = 'citizen_wear'}, + {label = _U('ems_clothes_ems'), value = 'ambulance_wear'}, + }, }, - }, - function(data, menu) + function(data, menu) - menu.close() + menu.close() - if data.current.value == 'citizen_wear' then + if data.current.value == 'citizen_wear' then - ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin) - TriggerEvent('skinchanger:loadSkin', skin) - end) + ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin) + TriggerEvent('skinchanger:loadSkin', skin) + end) - end - - if data.current.value == 'ambulance_wear' then - - ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin) - - if skin.sex == 0 then - TriggerEvent('skinchanger:loadClothes', skin, jobSkin.skin_male) - else - TriggerEvent('skinchanger:loadClothes', skin, jobSkin.skin_female) end - end) + if data.current.value == 'ambulance_wear' then + ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin) + + if skin.sex == 0 then + TriggerEvent('skinchanger:loadClothes', skin, jobSkin.skin_male) + else + TriggerEvent('skinchanger:loadClothes', skin, jobSkin.skin_female) + end + + end) + + end + + CurrentAction = 'ambulance_actions_menu' + CurrentActionMsg = _U('open_menu') + CurrentActionData = {} + + end, + function(data, menu) + menu.close() end - - CurrentAction = 'ambulance_actions_menu' - CurrentActionMsg = _U('open_menu') - CurrentActionData = {} - - end, - function(data, menu) - menu.close() - end ) end @@ -518,61 +520,61 @@ function OpenVehicleSpawnerMenu() if Config.EnableSocietyOwnedVehicles then - local elements = {} + local elements = {} - ESX.TriggerServerCallback('esx_society:getVehiclesInGarage', function(vehicles) + ESX.TriggerServerCallback('esx_society:getVehiclesInGarage', function(vehicles) - for i=1, #vehicles, 1 do - table.insert(elements, {label = GetDisplayNameFromVehicleModel(vehicles[i].model) .. ' [' .. vehicles[i].plate .. ']', value = vehicles[i]}) - end + for i=1, #vehicles, 1 do + table.insert(elements, {label = GetDisplayNameFromVehicleModel(vehicles[i].model) .. ' [' .. vehicles[i].plate .. ']', value = vehicles[i]}) + end + + ESX.UI.Menu.Open( + 'default', GetCurrentResourceName(), 'vehicle_spawner', + { + title = _U('veh_menu'), + align = 'top-left', + elements = elements, + }, function(data, menu) + menu.close() + + local vehicleProps = data.current.value + ESX.Game.SpawnVehicle(vehicleProps.model, Config.Zones.VehicleSpawnPoint.Pos, 270.0, function(vehicle) + ESX.Game.SetVehicleProperties(vehicle, vehicleProps) + local playerPed = GetPlayerPed(-1) + TaskWarpPedIntoVehicle(playerPed, vehicle, -1) + end) + TriggerServerEvent('esx_society:removeVehicleFromGarage', 'ambulance', vehicleProps) + + end, function(data, menu) + menu.close() + CurrentAction = 'vehicle_spawner_menu' + CurrentActionMsg = _U('veh_spawn') + CurrentActionData = {} + end + ) + end, 'ambulance') + + else -- not society vehicles ESX.UI.Menu.Open( 'default', GetCurrentResourceName(), 'vehicle_spawner', { - title = _U('veh_menu'), - align = 'top-left', - elements = elements, + title = _U('veh_menu'), + align = 'top-left', + elements = Config.AuthorizedVehicles }, function(data, menu) - menu.close() - - local vehicleProps = data.current.value - ESX.Game.SpawnVehicle(vehicleProps.model, Config.Zones.VehicleSpawnPoint.Pos, 270.0, function(vehicle) - ESX.Game.SetVehicleProperties(vehicle, vehicleProps) - local playerPed = GetPlayerPed(-1) - TaskWarpPedIntoVehicle(playerPed, vehicle, -1) - end) - TriggerServerEvent('esx_society:removeVehicleFromGarage', 'ambulance', vehicleProps) - + menu.close() + ESX.Game.SpawnVehicle(data.current.model, Config.Zones.VehicleSpawnPoint.Pos, 230.0, function(vehicle) + local playerPed = GetPlayerPed(-1) + TaskWarpPedIntoVehicle(playerPed, vehicle, -1) + end) end, function(data, menu) - menu.close() - CurrentAction = 'vehicle_spawner_menu' - CurrentActionMsg = _U('veh_spawn') - CurrentActionData = {} + menu.close() + CurrentAction = 'vehicle_spawner_menu' + CurrentActionMsg = _U('veh_spawn') + CurrentActionData = {} end ) - end, 'ambulance') - - else -- not society vehicles - - ESX.UI.Menu.Open( - 'default', GetCurrentResourceName(), 'vehicle_spawner', - { - title = _U('veh_menu'), - align = 'top-left', - elements = Config.AuthorizedVehicles - }, function(data, menu) - menu.close() - ESX.Game.SpawnVehicle(data.current.model, Config.Zones.VehicleSpawnPoint.Pos, 230.0, function(vehicle) - local playerPed = GetPlayerPed(-1) - TaskWarpPedIntoVehicle(playerPed, vehicle, -1) - end) - end, function(data, menu) - menu.close() - CurrentAction = 'vehicle_spawner_menu' - CurrentActionMsg = _U('veh_spawn') - CurrentActionData = {} - end - ) end end @@ -582,20 +584,20 @@ function OpenPharmacyMenu() ESX.UI.Menu.Open( 'default', GetCurrentResourceName(), 'pharmacy', { - title = _U('pharmacy_menu_title'), - align = 'top-left', - elements = { - {label = _U('pharmacy_take') .. ' ' .. _('medikit'), value = 'medikit'}, - {label = _U('pharmacy_take') .. ' ' .. _('bandage'), value = 'bandage'} - }, + title = _U('pharmacy_menu_title'), + align = 'top-left', + elements = { + {label = _U('pharmacy_take') .. ' ' .. _('medikit'), value = 'medikit'}, + {label = _U('pharmacy_take') .. ' ' .. _('bandage'), value = 'bandage'} + }, }, function(data, menu) - TriggerServerEvent('esx_ambulancejob:giveItem', data.current.value) + TriggerServerEvent('esx_ambulancejob:giveItem', data.current.value) end, function(data, menu) - menu.close() - CurrentAction = 'pharmacy' - CurrentActionMsg = _U('open_pharmacy') - CurrentActionData = {} + menu.close() + CurrentAction = 'pharmacy' + CurrentActionMsg = _U('open_pharmacy') + CurrentActionData = {} end ) end @@ -604,9 +606,9 @@ AddEventHandler('playerSpawned', function() IsDead = false if FirstSpawn then - TriggerServerEvent('esx_ambulancejob:firstSpawn') - exports.spawnmanager:setAutoSpawn(false) -- disable respawn - FirstSpawn = false + TriggerServerEvent('esx_ambulancejob:firstSpawn') + exports.spawnmanager:setAutoSpawn(false) -- disable respawn + FirstSpawn = false end end) @@ -624,9 +626,9 @@ RegisterNetEvent('esx_phone:loaded') AddEventHandler('esx_phone:loaded', function(phoneNumber, contacts) local specialContact = { - name = 'Ambulance', - number = 'ambulance', - base64Icon = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEwAACxMBAJqcGAAABp5JREFUWIW1l21sFNcVhp/58npn195de23Ha4Mh2EASSvk0CPVHmmCEI0RCTQMBKVVooxYoalBVCVokICWFVFVEFeKoUdNECkZQIlAoFGMhIkrBQGxHwhAcChjbeLcsYHvNfsx+zNz+MBDWNrYhzSvdP+e+c973XM2cc0dihFi9Yo6vSzN/63dqcwPZcnEwS9PDmYoE4IxZIj+ciBb2mteLwlZdfji+dXtNU2AkeaXhCGteLZ/X/IS64/RoR5mh9tFVAaMiAldKQUGiRzFp1wXJPj/YkxblbfFLT/tjq9/f1XD0sQyse2li7pdP5tYeLXXMMGUojAiWKeOodE1gqpmNfN2PFeoF00T2uLGKfZzTwhzqbaEmeYWAQ0K1oKIlfPb7t+7M37aruXvEBlYvnV7xz2ec/2jNs9kKooKNjlksiXhJfLqf1PXOIU9M8fmw/XgRu523eTNyhhu6xLjbSeOFC6EX3t3V9PmwBla9Vv7K7u85d3bpqlwVcvHn7B8iVX+IFQoNKdwfstuFtWoFvwp9zj5XL7nRlPXyudjS9z+u35tmuH/lu6dl7+vSVXmDUcpbX+skP65BxOOPJA4gjDicOM2PciejeTwcsYek1hyl6me5nhNnmwPXBhjYuGC699OpzoaAO0PbYJSy5vgt4idOPrJwf6QuX2FO0oOtqIgj9pDU5dCWrMlyvXf86xsGgHyPeLos83Brns1WFXLxxgVBorHpW4vfQ6KhkbUtCot6srns1TLPjNVr7+1J0PepVc92H/Eagkb7IsTWd4ZMaN+yCXv5zLRY9GQ9xuYtQz4nfreWGdH9dNlkfnGq5/kdO88ekwGan1B3mDJsdMxCqv5w2Iq0khLs48vSllrsG/Y5pfojNugzScnQXKBVA8hrX51ddHq0o6wwIlgS8Y7obZdUZVjOYLC6e3glWkBBVHC2RJ+w/qezCuT/2sV6Q5VYpowjvnf/iBJJqvpYBgBS+w6wVB5DLEOiTZHWy36nNheg0jUBs3PoJnMfyuOdAECqrZ3K7KcACGQp89RAtlysCphqZhPtRzYlcPx+ExklJUiq0le5omCfOGFAYn3qFKS/fZAWS7a3Y2wa+GJOEy4US+B3aaPUYJamj4oI5LA/jWQBt5HIK5+JfXzZsJVpXi/ac8+mxWIXWzAG4Wb4g/jscNMp63I4U5FcKaVvsNyFALokSA47Kx8PVk83OabCHZsiqwAKEpjmfUJIkoh/R+L9oTpjluhRkGSPG4A7EkS+Y3HZk0OXYpIVNy01P5yItnptDsvtIwr0SunqoVP1GG1taTHn1CloXm9aLBEIEDl/IS2W6rg+qIFEYR7+OJTesqJqYa95/VKBNOHLjDBZ8sDS2998a0Bs/F//gvu5Z9NivadOc/U3676pEsizBIN1jCYlhClL+ELJDrkobNUBfBZqQfMN305HAgnIeYi4OnYMh7q/AsAXSdXK+eH41sykxd+TV/AsXvR/MeARAttD9pSqF9nDNfSEoDQsb5O31zQFprcaV244JPY7bqG6Xd9K3C3ALgbfk3NzqNE6CdplZrVFL27eWR+UASb6479ULfhD5AzOlSuGFTE6OohebElbcb8fhxA4xEPUgdTK19hiNKCZgknB+Ep44E44d82cxqPPOKctCGXzTmsBXbV1j1S5XQhyHq6NvnABPylu46A7QmVLpP7w9pNz4IEb0YyOrnmjb8bjB129fDBRkDVj2ojFbYBnCHHb7HL+OC7KQXeEsmAiNrnTqLy3d3+s/bvlVmxpgffM1fyM5cfsPZLuK+YHnvHELl8eUlwV4BXim0r6QV+4gD9Nlnjbfg1vJGktbI5UbN/TcGmAAYDG84Gry/MLLl/zKouO2Xukq/YkCyuWYV5owTIGjhVFCPL6J7kLOTcH89ereF1r4qOsm3gjSevl85El1Z98cfhB3qBN9+dLp1fUTco+0OrVMnNjFuv0chYbBYT2HcBoa+8TALyWQOt/ImPHoFS9SI3WyRajgdt2mbJgIlbREplfveuLf/XXemjXX7v46ZxzPlfd8YlZ01My5MUEVdIY5rueYopw4fQHkbv7/rZkTw6JwjyalBCHur9iD9cI2mU0UzD3P9H6yZ1G5dt7Gwe96w07dl5fXj7vYqH2XsNovdTI6KMrlsAXhRyz7/C7FBO/DubdVq4nBLPaohcnBeMr3/2k4fhQ+Uc8995YPq2wMzNjww2X+vwNt1p00ynrd2yKDJAVN628sBX1hZIdxXdStU9G5W2bd9YHR5L3f/CNmJeY9G8WAAAAAElFTkSuQmCC' + name = 'Ambulance', + number = 'ambulance', + base64Icon = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEwAACxMBAJqcGAAABp5JREFUWIW1l21sFNcVhp/58npn195de23Ha4Mh2EASSvk0CPVHmmCEI0RCTQMBKVVooxYoalBVCVokICWFVFVEFeKoUdNECkZQIlAoFGMhIkrBQGxHwhAcChjbeLcsYHvNfsx+zNz+MBDWNrYhzSvdP+e+c973XM2cc0dihFi9Yo6vSzN/63dqcwPZcnEwS9PDmYoE4IxZIj+ciBb2mteLwlZdfji+dXtNU2AkeaXhCGteLZ/X/IS64/RoR5mh9tFVAaMiAldKQUGiRzFp1wXJPj/YkxblbfFLT/tjq9/f1XD0sQyse2li7pdP5tYeLXXMMGUojAiWKeOodE1gqpmNfN2PFeoF00T2uLGKfZzTwhzqbaEmeYWAQ0K1oKIlfPb7t+7M37aruXvEBlYvnV7xz2ec/2jNs9kKooKNjlksiXhJfLqf1PXOIU9M8fmw/XgRu523eTNyhhu6xLjbSeOFC6EX3t3V9PmwBla9Vv7K7u85d3bpqlwVcvHn7B8iVX+IFQoNKdwfstuFtWoFvwp9zj5XL7nRlPXyudjS9z+u35tmuH/lu6dl7+vSVXmDUcpbX+skP65BxOOPJA4gjDicOM2PciejeTwcsYek1hyl6me5nhNnmwPXBhjYuGC699OpzoaAO0PbYJSy5vgt4idOPrJwf6QuX2FO0oOtqIgj9pDU5dCWrMlyvXf86xsGgHyPeLos83Brns1WFXLxxgVBorHpW4vfQ6KhkbUtCot6srns1TLPjNVr7+1J0PepVc92H/Eagkb7IsTWd4ZMaN+yCXv5zLRY9GQ9xuYtQz4nfreWGdH9dNlkfnGq5/kdO88ekwGan1B3mDJsdMxCqv5w2Iq0khLs48vSllrsG/Y5pfojNugzScnQXKBVA8hrX51ddHq0o6wwIlgS8Y7obZdUZVjOYLC6e3glWkBBVHC2RJ+w/qezCuT/2sV6Q5VYpowjvnf/iBJJqvpYBgBS+w6wVB5DLEOiTZHWy36nNheg0jUBs3PoJnMfyuOdAECqrZ3K7KcACGQp89RAtlysCphqZhPtRzYlcPx+ExklJUiq0le5omCfOGFAYn3qFKS/fZAWS7a3Y2wa+GJOEy4US+B3aaPUYJamj4oI5LA/jWQBt5HIK5+JfXzZsJVpXi/ac8+mxWIXWzAG4Wb4g/jscNMp63I4U5FcKaVvsNyFALokSA47Kx8PVk83OabCHZsiqwAKEpjmfUJIkoh/R+L9oTpjluhRkGSPG4A7EkS+Y3HZk0OXYpIVNy01P5yItnptDsvtIwr0SunqoVP1GG1taTHn1CloXm9aLBEIEDl/IS2W6rg+qIFEYR7+OJTesqJqYa95/VKBNOHLjDBZ8sDS2998a0Bs/F//gvu5Z9NivadOc/U3676pEsizBIN1jCYlhClL+ELJDrkobNUBfBZqQfMN305HAgnIeYi4OnYMh7q/AsAXSdXK+eH41sykxd+TV/AsXvR/MeARAttD9pSqF9nDNfSEoDQsb5O31zQFprcaV244JPY7bqG6Xd9K3C3ALgbfk3NzqNE6CdplZrVFL27eWR+UASb6479ULfhD5AzOlSuGFTE6OohebElbcb8fhxA4xEPUgdTK19hiNKCZgknB+Ep44E44d82cxqPPOKctCGXzTmsBXbV1j1S5XQhyHq6NvnABPylu46A7QmVLpP7w9pNz4IEb0YyOrnmjb8bjB129fDBRkDVj2ojFbYBnCHHb7HL+OC7KQXeEsmAiNrnTqLy3d3+s/bvlVmxpgffM1fyM5cfsPZLuK+YHnvHELl8eUlwV4BXim0r6QV+4gD9Nlnjbfg1vJGktbI5UbN/TcGmAAYDG84Gry/MLLl/zKouO2Xukq/YkCyuWYV5owTIGjhVFCPL6J7kLOTcH89ereF1r4qOsm3gjSevl85El1Z98cfhB3qBN9+dLp1fUTco+0OrVMnNjFuv0chYbBYT2HcBoa+8TALyWQOt/ImPHoFS9SI3WyRajgdt2mbJgIlbREplfveuLf/XXemjXX7v46ZxzPlfd8YlZ01My5MUEVdIY5rueYopw4fQHkbv7/rZkTw6JwjyalBCHur9iD9cI2mU0UzD3P9H6yZ1G5dt7Gwe96w07dl5fXj7vYqH2XsNovdTI6KMrlsAXhRyz7/C7FBO/DubdVq4nBLPaohcnBeMr3/2k4fhQ+Uc8995YPq2wMzNjww2X+vwNt1p00ynrd2yKDJAVN628sBX1hZIdxXdStU9G5W2bd9YHR5L3f/CNmJeY9G8WAAAAAElFTkSuQmCC' } TriggerEvent('esx_phone:addSpecialContact', specialContact.name, specialContact.number, specialContact.base64Icon) @@ -641,7 +643,7 @@ RegisterNetEvent('esx_ambulancejob:revive') AddEventHandler('esx_ambulancejob:revive', function() local playerPed = GetPlayerPed(-1) - local coords = GetEntityCoords(playerPed) + local coords = GetEntityCoords(playerPed) TriggerServerEvent('esx_ambulancejob:setDeathStatus', 0) Citizen.CreateThread(function() @@ -681,18 +683,17 @@ end) AddEventHandler('esx_ambulancejob:hasEnteredMarker', function(zone) if zone == 'HospitalInteriorEntering1' then - TeleportFadeEffect(GetPlayerPed(-1), Config.Zones.HospitalInteriorInside1.Pos) + TeleportFadeEffect(GetPlayerPed(-1), Config.Zones.HospitalInteriorInside1.Pos) end if zone == 'HospitalInteriorExit1' then - TeleportFadeEffect(GetPlayerPed(-1), Config.Zones.HospitalInteriorOutside1.Pos) + TeleportFadeEffect(GetPlayerPed(-1), Config.Zones.HospitalInteriorOutside1.Pos) end if zone == 'HospitalInteriorEntering2' then local heli = Config.HelicopterSpawner - if not IsAnyVehicleNearPoint(heli.SpawnPoint.x, heli.SpawnPoint.y, heli.SpawnPoint.z, 3.0) - and PlayerData.job ~= nil and PlayerData.job.name == 'ambulance' then + if not IsAnyVehicleNearPoint(heli.SpawnPoint.x, heli.SpawnPoint.y, heli.SpawnPoint.z, 3.0) and PlayerData.job ~= nil and PlayerData.job.name == 'ambulance' then ESX.Game.SpawnVehicle('polmav', { x = heli.SpawnPoint.x, y = heli.SpawnPoint.y, @@ -703,80 +704,80 @@ AddEventHandler('esx_ambulancejob:hasEnteredMarker', function(zone) end) end - TeleportFadeEffect(GetPlayerPed(-1), Config.Zones.HospitalInteriorInside2.Pos) + TeleportFadeEffect(GetPlayerPed(-1), Config.Zones.HospitalInteriorInside2.Pos) end if zone == 'HospitalInteriorExit2' then - TeleportFadeEffect(GetPlayerPed(-1), Config.Zones.HospitalInteriorOutside2.Pos) + TeleportFadeEffect(GetPlayerPed(-1), Config.Zones.HospitalInteriorOutside2.Pos) end if zone == 'ParkingDoorGoOutInside' then - TeleportFadeEffect(GetPlayerPed(-1), Config.Zones.ParkingDoorGoOutOutside.Pos) + TeleportFadeEffect(GetPlayerPed(-1), Config.Zones.ParkingDoorGoOutOutside.Pos) end if zone == 'ParkingDoorGoInOutside' then - TeleportFadeEffect(GetPlayerPed(-1), Config.Zones.ParkingDoorGoInInside.Pos) + TeleportFadeEffect(GetPlayerPed(-1), Config.Zones.ParkingDoorGoInInside.Pos) end if zone == 'StairsGoTopBottom' then - CurrentAction = 'fast_travel_goto_top' - CurrentActionMsg = _U('fast_travel') - CurrentActionData = {pos = Config.Zones.StairsGoTopTop.Pos} + CurrentAction = 'fast_travel_goto_top' + CurrentActionMsg = _U('fast_travel') + CurrentActionData = {pos = Config.Zones.StairsGoTopTop.Pos} end if zone == 'StairsGoBottomTop' then - CurrentAction = 'fast_travel_goto_bottom' - CurrentActionMsg = _U('fast_travel') - CurrentActionData = {pos = Config.Zones.StairsGoBottomBottom.Pos} + CurrentAction = 'fast_travel_goto_bottom' + CurrentActionMsg = _U('fast_travel') + CurrentActionData = {pos = Config.Zones.StairsGoBottomBottom.Pos} end if zone == 'AmbulanceActions' then - CurrentAction = 'ambulance_actions_menu' - CurrentActionMsg = _U('open_menu') - CurrentActionData = {} + CurrentAction = 'ambulance_actions_menu' + CurrentActionMsg = _U('open_menu') + CurrentActionData = {} end if zone == 'VehicleSpawner' then - CurrentAction = 'vehicle_spawner_menu' - CurrentActionMsg = _U('veh_spawn') - CurrentActionData = {} + CurrentAction = 'vehicle_spawner_menu' + CurrentActionMsg = _U('veh_spawn') + CurrentActionData = {} end if zone == 'Pharmacy' then - CurrentAction = 'pharmacy' - CurrentActionMsg = _U('open_pharmacy') - CurrentActionData = {} + CurrentAction = 'pharmacy' + CurrentActionMsg = _U('open_pharmacy') + CurrentActionData = {} end if zone == 'VehicleDeleter' then - local playerPed = GetPlayerPed(-1) - local coords = GetEntityCoords(playerPed) + local playerPed = GetPlayerPed(-1) + local coords = GetEntityCoords(playerPed) - if IsPedInAnyVehicle(playerPed, false) then + if IsPedInAnyVehicle(playerPed, false) then - local vehicle, distance = ESX.Game.GetClosestVehicle({ - x = coords.x, - y = coords.y, - z = coords.z - }) + local vehicle, distance = ESX.Game.GetClosestVehicle({ + x = coords.x, + y = coords.y, + z = coords.z + }) - if distance ~= -1 and distance <= 1.0 then + if distance ~= -1 and distance <= 1.0 then - CurrentAction = 'delete_vehicle' - CurrentActionMsg = _U('store_veh') - CurrentActionData = {vehicle = vehicle} + CurrentAction = 'delete_vehicle' + CurrentActionMsg = _U('store_veh') + CurrentActionData = {vehicle = vehicle} + + end end end - end - end) function FastTravel(pos) - TeleportFadeEffect(GetPlayerPed(-1), pos) + TeleportFadeEffect(GetPlayerPed(-1), pos) end AddEventHandler('esx_ambulancejob:hasExitedMarker', function(zone) @@ -789,10 +790,10 @@ Citizen.CreateThread(function() local blip = AddBlipForCoord(Config.Blip.Pos.x, Config.Blip.Pos.y, Config.Blip.Pos.z) - SetBlipSprite (blip, Config.Blip.Sprite) + SetBlipSprite(blip, Config.Blip.Sprite) SetBlipDisplay(blip, Config.Blip.Display) - SetBlipScale (blip, Config.Blip.Scale) - SetBlipColour (blip, Config.Blip.Colour) + SetBlipScale(blip, Config.Blip.Scale) + SetBlipColour(blip, Config.Blip.Colour) SetBlipAsShortRange(blip, true) BeginTextCommandSetBlipName("STRING") @@ -804,53 +805,52 @@ end) -- Display markers Citizen.CreateThread(function() while true do - Citizen.Wait(0) + Citizen.Wait(0) - local coords = GetEntityCoords(GetPlayerPed(-1)) - for k,v in pairs(Config.Zones) do - if(v.Type ~= -1 and GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < Config.DrawDistance) then + local coords = GetEntityCoords(GetPlayerPed(-1)) + for k,v in pairs(Config.Zones) do + if(v.Type ~= -1 and GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < Config.DrawDistance) then if PlayerData.job ~= nil and PlayerData.job.name == 'ambulance' then DrawMarker(v.Type, v.Pos.x, v.Pos.y, v.Pos.z, 0.0, 0.0, 0.0, 0, 0.0, 0.0, Config.MarkerSize.x, Config.MarkerSize.y, Config.MarkerSize.z, Config.MarkerColor.r, Config.MarkerColor.g, Config.MarkerColor.b, 100, false, true, 2, false, false, false, false) - elseif k ~= 'AmbulanceActions' and k ~= 'VehicleSpawner' and k ~= 'VehicleDeleter' - and k ~= 'Pharmacy' and k ~= 'StairsGoTopBottom' and k ~= 'StairsGoBottomTop' then + elseif k ~= 'AmbulanceActions' and k ~= 'VehicleSpawner' and k ~= 'VehicleDeleter' and k ~= 'Pharmacy' and k ~= 'StairsGoTopBottom' and k ~= 'StairsGoBottomTop' then DrawMarker(v.Type, v.Pos.x, v.Pos.y, v.Pos.z, 0.0, 0.0, 0.0, 0, 0.0, 0.0, Config.MarkerSize.x, Config.MarkerSize.y, Config.MarkerSize.z, Config.MarkerColor.r, Config.MarkerColor.g, Config.MarkerColor.b, 100, false, true, 2, false, false, false, false) end + end end end - end end) -- Activate menu when player is inside marker Citizen.CreateThread(function() while true do - Citizen.Wait(10) + Citizen.Wait(10) - local coords = GetEntityCoords(GetPlayerPed(-1)) - local isInMarker = false - local currentZone = nil - for k,v in pairs(Config.Zones) do - if PlayerData.job ~= nil and PlayerData.job.name == 'ambulance' then - if(GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < Config.MarkerSize.x) then - isInMarker = true - currentZone = k + local coords = GetEntityCoords(GetPlayerPed(-1)) + local isInMarker = false + local currentZone = nil + for k,v in pairs(Config.Zones) do + if PlayerData.job ~= nil and PlayerData.job.name == 'ambulance' then + if(GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < Config.MarkerSize.x) then + isInMarker = true + currentZone = k + end + elseif k ~= 'AmbulanceActions' and k ~= 'VehicleSpawner' and k ~= 'VehicleDeleter' and k ~= 'Pharmacy' and k ~= 'StairsGoTopBottom' and k ~= 'StairsGoBottomTop' then + if(GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < Config.MarkerSize.x) then + isInMarker = true + currentZone = k + end + end end - elseif k ~= 'AmbulanceActions' and k ~= 'VehicleSpawner' and k ~= 'VehicleDeleter' and k ~= 'Pharmacy' and k ~= 'StairsGoTopBottom' and k ~= 'StairsGoBottomTop' then - if(GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < Config.MarkerSize.x) then - isInMarker = true - currentZone = k + if isInMarker and not hasAlreadyEnteredMarker then + hasAlreadyEnteredMarker = true + lastZone = currentZone + TriggerEvent('esx_ambulancejob:hasEnteredMarker', currentZone) end - end - end - if isInMarker and not hasAlreadyEnteredMarker then - hasAlreadyEnteredMarker = true - lastZone = currentZone - TriggerEvent('esx_ambulancejob:hasEnteredMarker', currentZone) - end - if not isInMarker and hasAlreadyEnteredMarker then - hasAlreadyEnteredMarker = false - TriggerEvent('esx_ambulancejob:hasExitedMarker', lastZone) - end + if not isInMarker and hasAlreadyEnteredMarker then + hasAlreadyEnteredMarker = false + TriggerEvent('esx_ambulancejob:hasExitedMarker', lastZone) + end end end) @@ -858,49 +858,49 @@ end) Citizen.CreateThread(function() while true do - Citizen.Wait(10) + Citizen.Wait(10) - if CurrentAction ~= nil then + if CurrentAction ~= nil then - SetTextComponentFormat('STRING') - AddTextComponentString(CurrentActionMsg) - DisplayHelpTextFromStringLabel(0, 0, 1, -1) + SetTextComponentFormat('STRING') + AddTextComponentString(CurrentActionMsg) + DisplayHelpTextFromStringLabel(0, 0, 1, -1) - if IsControlJustReleased(0, Keys['E']) and PlayerData.job ~= nil and PlayerData.job.name == 'ambulance' then + if IsControlJustReleased(0, Keys['E']) and PlayerData.job ~= nil and PlayerData.job.name == 'ambulance' then - if CurrentAction == 'ambulance_actions_menu' then - OpenAmbulanceActionsMenu() - end + if CurrentAction == 'ambulance_actions_menu' then + OpenAmbulanceActionsMenu() + end - if CurrentAction == 'vehicle_spawner_menu' then - OpenVehicleSpawnerMenu() - end + if CurrentAction == 'vehicle_spawner_menu' then + OpenVehicleSpawnerMenu() + end - if CurrentAction == 'pharmacy' then - OpenPharmacyMenu() - end + if CurrentAction == 'pharmacy' then + OpenPharmacyMenu() + end - if CurrentAction == 'fast_travel_goto_top' or CurrentAction == 'fast_travel_goto_bottom' then - FastTravel(CurrentActionData.pos) - end + if CurrentAction == 'fast_travel_goto_top' or CurrentAction == 'fast_travel_goto_bottom' then + FastTravel(CurrentActionData.pos) + end + + if CurrentAction == 'delete_vehicle' then + if Config.EnableSocietyOwnedVehicles then + local vehicleProps = ESX.Game.GetVehicleProperties(CurrentActionData.vehicle) + TriggerServerEvent('esx_society:putVehicleInGarage', 'ambulance', vehicleProps) + end + ESX.Game.DeleteVehicle(CurrentActionData.vehicle) + end + + CurrentAction = nil - if CurrentAction == 'delete_vehicle' then - if Config.EnableSocietyOwnedVehicles then - local vehicleProps = ESX.Game.GetVehicleProperties(CurrentActionData.vehicle) - TriggerServerEvent('esx_society:putVehicleInGarage', 'ambulance', vehicleProps) end - ESX.Game.DeleteVehicle(CurrentActionData.vehicle) - end - - CurrentAction = nil end - end - - if IsControlJustReleased(0, Keys['F6']) and PlayerData.job ~= nil and PlayerData.job.name == 'ambulance' and not IsDead then - OpenMobileAmbulanceActionsMenu() - end + if IsControlJustReleased(0, Keys['F6']) and PlayerData.job ~= nil and PlayerData.job.name == 'ambulance' and not IsDead then + OpenMobileAmbulanceActionsMenu() + end end end) @@ -919,7 +919,7 @@ if Config.LoadIpl then LoadMpDlcMaps() EnableMpDlcMaps(true) RequestIpl('Coroner_Int_on') -- Morgue - end) + end) end -- String string From 729bb0eb43c39a639d902f71dcd2c4ebbf0db08a Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Tue, 4 Sep 2018 22:36:58 +0200 Subject: [PATCH 092/177] Minor locale changes --- client/main.lua | 50 ++++++++++++++------------- locales/br.lua | 2 -- locales/de.lua | 2 -- locales/en.lua | 2 -- locales/es.lua | 5 ++- locales/fi.lua | 2 -- locales/fr.lua | 2 -- locales/pl.lua | 2 -- locales/sv.lua | 90 ++++++++++++++++++++++++------------------------- 9 files changed, 72 insertions(+), 85 deletions(-) diff --git a/client/main.lua b/client/main.lua index b8f3b0cb..93364e4f 100644 --- a/client/main.lua +++ b/client/main.lua @@ -43,16 +43,18 @@ function RespawnPed(ped, coords) end RegisterNetEvent('esx_ambulancejob:heal') -AddEventHandler('esx_ambulancejob:heal', function(_type) - local playerPed = GetPlayerPed(-1) +AddEventHandler('esx_ambulancejob:heal', function(healType) + local playerPed = PlayerPedId() local maxHealth = GetEntityMaxHealth(playerPed) - if _type == 'small' then + + if healType == 'small' then local health = GetEntityHealth(playerPed) local newHealth = math.min(maxHealth , math.floor(health + maxHealth/8)) SetEntityHealth(playerPed, newHealth) - elseif _type == 'big' then + elseif healType == 'big' then SetEntityHealth(playerPed, maxHealth) end + ESX.ShowNotification(_U('healed')) end) @@ -94,7 +96,7 @@ function StartDistressSignal() end function SendDistressSignal() - local playerPed = GetPlayerPed(-1) + local playerPed = PlayerPedId() local coords = GetEntityCoords(playerPed) ESX.ShowNotification(_U('distress_sent')) @@ -190,7 +192,7 @@ function RemoveItemsAfterRPDeath() ESX.SetPlayerData('loadout', {}) TriggerServerEvent('esx:updateLastPosition', Config.Zones.HospitalInteriorInside1.Pos) - RespawnPed(GetPlayerPed(-1), Config.Zones.HospitalInteriorInside1.Pos) + RespawnPed(PlayerPedId(), Config.Zones.HospitalInteriorInside1.Pos) StopScreenEffect('DeathFailOut') DoScreenFadeIn(800) @@ -215,7 +217,7 @@ function OnPlayerDeath() StartRespawnTimer() StartDistressSignal() - ClearPedTasksImmediately(GetPlayerPed(-1)) + ClearPedTasksImmediately(PlayerPedId()) StartScreenEffect('DeathFailOut', 0, false) end @@ -354,7 +356,7 @@ function OpenMobileAmbulanceActionsMenu() local health = GetEntityHealth(closestPlayerPed) if health == 0 then - local playerPed = GetPlayerPed(-1) + local playerPed = PlayerPedId() IsBusy = true ESX.ShowNotification(_U('revive_inprogress')) @@ -392,7 +394,7 @@ function OpenMobileAmbulanceActionsMenu() local health = GetEntityHealth(closestPlayerPed) if health > 0 then - local playerPed = GetPlayerPed(-1) + local playerPed = PlayerPedId() IsBusy = true ESX.ShowNotification(_U('heal_inprogress')) @@ -424,7 +426,7 @@ function OpenMobileAmbulanceActionsMenu() local health = GetEntityHealth(closestPlayerPed) if health > 0 then - local playerPed = GetPlayerPed(-1) + local playerPed = PlayerPedId() IsBusy = true ESX.ShowNotification(_U('heal_inprogress')) @@ -540,7 +542,7 @@ function OpenVehicleSpawnerMenu() local vehicleProps = data.current.value ESX.Game.SpawnVehicle(vehicleProps.model, Config.Zones.VehicleSpawnPoint.Pos, 270.0, function(vehicle) ESX.Game.SetVehicleProperties(vehicle, vehicleProps) - local playerPed = GetPlayerPed(-1) + local playerPed = PlayerPedId() TaskWarpPedIntoVehicle(playerPed, vehicle, -1) end) TriggerServerEvent('esx_society:removeVehicleFromGarage', 'ambulance', vehicleProps) @@ -565,7 +567,7 @@ function OpenVehicleSpawnerMenu() }, function(data, menu) menu.close() ESX.Game.SpawnVehicle(data.current.model, Config.Zones.VehicleSpawnPoint.Pos, 230.0, function(vehicle) - local playerPed = GetPlayerPed(-1) + local playerPed = PlayerPedId() TaskWarpPedIntoVehicle(playerPed, vehicle, -1) end) end, function(data, menu) @@ -642,7 +644,7 @@ end) RegisterNetEvent('esx_ambulancejob:revive') AddEventHandler('esx_ambulancejob:revive', function() - local playerPed = GetPlayerPed(-1) + local playerPed = PlayerPedId() local coords = GetEntityCoords(playerPed) TriggerServerEvent('esx_ambulancejob:setDeathStatus', 0) @@ -683,11 +685,11 @@ end) AddEventHandler('esx_ambulancejob:hasEnteredMarker', function(zone) if zone == 'HospitalInteriorEntering1' then - TeleportFadeEffect(GetPlayerPed(-1), Config.Zones.HospitalInteriorInside1.Pos) + TeleportFadeEffect(PlayerPedId(), Config.Zones.HospitalInteriorInside1.Pos) end if zone == 'HospitalInteriorExit1' then - TeleportFadeEffect(GetPlayerPed(-1), Config.Zones.HospitalInteriorOutside1.Pos) + TeleportFadeEffect(PlayerPedId(), Config.Zones.HospitalInteriorOutside1.Pos) end if zone == 'HospitalInteriorEntering2' then @@ -704,19 +706,19 @@ AddEventHandler('esx_ambulancejob:hasEnteredMarker', function(zone) end) end - TeleportFadeEffect(GetPlayerPed(-1), Config.Zones.HospitalInteriorInside2.Pos) + TeleportFadeEffect(PlayerPedId(), Config.Zones.HospitalInteriorInside2.Pos) end if zone == 'HospitalInteriorExit2' then - TeleportFadeEffect(GetPlayerPed(-1), Config.Zones.HospitalInteriorOutside2.Pos) + TeleportFadeEffect(PlayerPedId(), Config.Zones.HospitalInteriorOutside2.Pos) end if zone == 'ParkingDoorGoOutInside' then - TeleportFadeEffect(GetPlayerPed(-1), Config.Zones.ParkingDoorGoOutOutside.Pos) + TeleportFadeEffect(PlayerPedId(), Config.Zones.ParkingDoorGoOutOutside.Pos) end if zone == 'ParkingDoorGoInOutside' then - TeleportFadeEffect(GetPlayerPed(-1), Config.Zones.ParkingDoorGoInInside.Pos) + TeleportFadeEffect(PlayerPedId(), Config.Zones.ParkingDoorGoInInside.Pos) end if zone == 'StairsGoTopBottom' then @@ -751,7 +753,7 @@ AddEventHandler('esx_ambulancejob:hasEnteredMarker', function(zone) if zone == 'VehicleDeleter' then - local playerPed = GetPlayerPed(-1) + local playerPed = PlayerPedId() local coords = GetEntityCoords(playerPed) if IsPedInAnyVehicle(playerPed, false) then @@ -777,7 +779,7 @@ AddEventHandler('esx_ambulancejob:hasEnteredMarker', function(zone) end) function FastTravel(pos) - TeleportFadeEffect(GetPlayerPed(-1), pos) + TeleportFadeEffect(PlayerPedId(), pos) end AddEventHandler('esx_ambulancejob:hasExitedMarker', function(zone) @@ -807,7 +809,7 @@ Citizen.CreateThread(function() while true do Citizen.Wait(0) - local coords = GetEntityCoords(GetPlayerPed(-1)) + local coords = GetEntityCoords(PlayerPedId()) for k,v in pairs(Config.Zones) do if(v.Type ~= -1 and GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < Config.DrawDistance) then if PlayerData.job ~= nil and PlayerData.job.name == 'ambulance' then @@ -825,7 +827,7 @@ Citizen.CreateThread(function() while true do Citizen.Wait(10) - local coords = GetEntityCoords(GetPlayerPed(-1)) + local coords = GetEntityCoords(PlayerPedId()) local isInMarker = false local currentZone = nil for k,v in pairs(Config.Zones) do @@ -909,7 +911,7 @@ RegisterNetEvent('esx_ambulancejob:requestDeath') AddEventHandler('esx_ambulancejob:requestDeath', function() if Config.AntiCombatLog then Citizen.Wait(5000) - SetEntityHealth(GetPlayerPed(-1), 0) + SetEntityHealth(PlayerPedId(), 0) end end) diff --git a/locales/br.lua b/locales/br.lua index 4ffcc83c..9f7e1114 100644 --- a/locales/br.lua +++ b/locales/br.lua @@ -21,8 +21,6 @@ Locales['br'] = { ['player_not_unconscious'] = 'Não está inconsciente', ['player_not_conscious'] = 'that player is not conscious!', -- Boss Menu - ['deposit_society'] = 'Depositar dinheiro', - ['withdraw_society'] = 'Retirar dinheiro da empresa', ['boss_actions'] = 'Menu Administração', -- Misc ['invalid_amount'] = '~r~Quantidade inválida', diff --git a/locales/de.lua b/locales/de.lua index 38b46ab1..b1671811 100644 --- a/locales/de.lua +++ b/locales/de.lua @@ -21,8 +21,6 @@ Locales['de'] = { ['player_not_unconscious'] = 'ist nicht im Koma', ['player_not_conscious'] = 'that player is not conscious!', -- Boss Menu - ['deposit_society'] = 'Notdienst einzahlen', - ['withdraw_society'] = 'Notdienst abheben', ['boss_actions'] = 'boss actions', -- Misc ['invalid_amount'] = '~r~ungültiger Betrag', diff --git a/locales/en.lua b/locales/en.lua index 287033f0..9b7a1f92 100644 --- a/locales/en.lua +++ b/locales/en.lua @@ -21,8 +21,6 @@ Locales['en'] = { ['player_not_unconscious'] = 'that player is not unconscious!', ['player_not_conscious'] = 'that player is not conscious!', -- Boss Menu - ['deposit_society'] = 'eMS Deposit', - ['withdraw_society'] = 'eMS Withdraw', ['boss_actions'] = 'boss Actions', -- Misc ['invalid_amount'] = '~r~invalid amount', diff --git a/locales/es.lua b/locales/es.lua index ba4f7011..47f009c9 100644 --- a/locales/es.lua +++ b/locales/es.lua @@ -20,9 +20,8 @@ Locales['es'] = { ['no_vehicles'] = 'ningún vehículo cerca', ['player_not_unconscious'] = 'n\'estás inconsciente', ['player_not_conscious'] = 'that player is not conscious!', - -- oss Menu - ['deposit_society'] = 'depositar dinero', - ['withdraw_society'] = 'retirar dinero', + -- Boss Menu + ['boss_actions'] = 'boss Actions', -- Misc ['invalid_amount'] = '~r~cantidad no válida', ['open_menu'] = 'Presione ~INPUT_CONTEXT~ para abrir el menú', diff --git a/locales/fi.lua b/locales/fi.lua index cfa5b6b6..4c34e898 100644 --- a/locales/fi.lua +++ b/locales/fi.lua @@ -21,8 +21,6 @@ Locales['fi'] = { ['player_not_unconscious'] = 'tämä pelaaja ei ole tajuton!', ['player_not_conscious'] = 'tämä pelaaja ei ole tajuissaan!', -- Boss Menu - ['deposit_society'] = 'ensihoito talletus', - ['withdraw_society'] = 'ensihoito nosto', ['boss_actions'] = 'pomovalikko', -- Misc ['invalid_amount'] = '~r~Virheellinen summa', diff --git a/locales/fr.lua b/locales/fr.lua index 073193d4..2e94632c 100644 --- a/locales/fr.lua +++ b/locales/fr.lua @@ -21,8 +21,6 @@ Locales['fr'] = { ['player_not_unconscious'] = 'n\'est pas inconscient', ['player_not_conscious'] = 'Cette personne est inconsciente!', -- Boss Menu - ['deposit_society'] = 'déposer argent', - ['withdraw_society'] = 'retirer argent société', ['boss_actions'] = 'action Patron', -- Misc ['invalid_amount'] = '~r~montant invalide', diff --git a/locales/pl.lua b/locales/pl.lua index aca5f6f5..c6e299b7 100644 --- a/locales/pl.lua +++ b/locales/pl.lua @@ -21,8 +21,6 @@ Locales['pl'] = { ['player_not_unconscious'] = 'ten gracz nie jest nieprzytomny!', ['player_not_conscious'] = 'ten gracz nie jest świadomy!', -- Boss Menu - ['deposit_society'] = 'zdeponuj do EMS', - ['withdraw_society'] = 'wyjmij z depozytu EMS', ['boss_actions'] = 'akcje szefa', -- Misc ['invalid_amount'] = '~r~Nieprawidłowa kwota', diff --git a/locales/sv.lua b/locales/sv.lua index b60946d2..6e08adbd 100644 --- a/locales/sv.lua +++ b/locales/sv.lua @@ -1,65 +1,63 @@ Locales['sv'] = { -- Cloakroom - ['cloakroom'] = 'Omklädnignsrum', - ['ems_clothes_civil'] = 'Civilkläder', - ['ems_clothes_ems'] = 'Ambulanskläder', + ['cloakroom'] = 'omklädnignsrum', + ['ems_clothes_civil'] = 'civilkläder', + ['ems_clothes_ems'] = 'ambulanskläder', -- Vehicles - ['veh_menu'] = 'Fordon', - ['veh_spawn'] = 'Tryck ~INPUT_CONTEXT~ för att ta fram ett fordon', - ['store_veh'] = 'Tryck ~INPUT_CONTEXT~ för att lagra fordonet', - ['ambulance'] = 'Ambulans', - ['helicopter'] = 'Helikopter', + ['veh_menu'] = 'fordon', + ['veh_spawn'] = 'tryck ~INPUT_CONTEXT~ för att öppna garaget.', + ['store_veh'] = 'tryck ~INPUT_CONTEXT~ för att lagra fordonet.', + ['ambulance'] = 'ambulans', + ['helicopter'] = 'helikopter', -- Action Menu - ['hospital'] = 'Sjukhus', - ['revive_inprogress'] = 'Återupplivning pågår...', + ['hospital'] = 'sjukhus', + ['revive_inprogress'] = 'återupplivning pågår . . .', ['revive_complete'] = 'du har återupplivat ~y~%s~s~, bra jobbat!', - ['revive_complete_award'] = 'du har återupplivat ~y~%s~s~ och tjärnat ~g~$%s~s~ i processen, bra jobbat!', + ['revive_complete_award'] = 'du har återupplivat ~y~%s~s~ och tjärnat ~g~%s SEK~s~ i processen, bra jobbat!', ['heal_inprogress'] = 'du behandlar patienten!', ['heal_complete'] = 'du har behandlat ~y~%s~s~', - ['no_players'] = 'Inga spelare i närheten!', - ['no_vehicles'] = 'Inga fordon i närheten!', + ['no_players'] = 'det finns inga spelare i närheten!', + ['no_vehicles'] = 'det finns inget fordon i närheten!', ['player_not_unconscious'] = 'spelaren är inte medvetslös!', ['player_not_conscious'] = 'spelaren är inte vid medvetande!', -- Boss Menu - ['deposit_society'] = 'Sjukvårdens insättning', - ['withdraw_society'] = 'Sjukvårdens uttagning', - ['boss_actions'] = 'Chef meny', + ['boss_actions'] = 'chef meny', -- Misc - ['invalid_amount'] = '~r~Ogiltig mängd', - ['open_menu'] = 'Teyck ~INPUT_CONTEXT~ för att öppna menyn', - ['deposit_amount'] = 'Mängd att sätta in', - ['money_withdraw'] = 'Mängd att ta ut', - ['fast_travel'] = 'Tryck på ~INPUT_CONTEXT~ för att snabbresa.', - ['open_pharmacy'] = 'Tryck på ~INPUT_CONTEXT~ för att öppna apoteket.', - ['pharmacy_menu_title'] = 'Apotek', - ['pharmacy_take'] = 'Ta', - ['medikit'] = 'Medicinkit', - ['bandage'] = 'Bandage', - ['max_item'] = 'Du har redan tillräckligt mycket på dig.', + ['invalid_amount'] = '~r~ogiltig mängd', + ['open_menu'] = 'tryck ~INPUT_CONTEXT~ för att öppna menyn.', + ['deposit_amount'] = 'mängd att sätta in', + ['money_withdraw'] = 'mängd att ta ut', + ['fast_travel'] = 'tryck på ~INPUT_CONTEXT~ för att snabbresa.', + ['open_pharmacy'] = 'tryck på ~INPUT_CONTEXT~ för att öppna apoteket.', + ['pharmacy_menu_title'] = 'apotek', + ['pharmacy_take'] = 'ta', + ['medikit'] = 'medicinkit', + ['bandage'] = 'bandage', + ['max_item'] = 'du har redan tillräckligt mycket på dig.', -- F6 Menu - ['ems_menu'] = 'Ambulansmeny', - ['ems_menu_title'] = 'Ambulansmeny', - ['ems_menu_revive'] = 'Återuppliva spelare', - ['ems_menu_putincar'] = 'Sätt i fordon', - ['ems_menu_small'] = 'Behandla mindre skador', - ['ems_menu_big'] = 'Behandla svåra skador', + ['ems_menu'] = 'ambulansmeny', + ['ems_menu_title'] = 'ambulansmeny', + ['ems_menu_revive'] = 'återuppliva spelare', + ['ems_menu_putincar'] = 'sätt i fordon', + ['ems_menu_small'] = 'behandla mindre skador', + ['ems_menu_big'] = 'behandla svåra skador', -- Phone - ['alert_ambulance'] = 'Ring ambulansen', + ['alert_ambulance'] = 'ambulanssamtal', -- Death - ['please_wait'] = 'you will bleed out in ~b~%s minutes %s seconds~s~\n', - ['press_respawn'] = 'press [~b~E~w~] to respawn.', - ['respawn_now_fine'] = 'respawn now for ~g~$%s ~w~[Press ~b~E~w~]', - ['respawn_fine'] = 'you paid ~r~$%s~s~ to respawn.', - ['distress_send'] = 'press [~b~G~s~] to send distress signal', - ['distress_sent'] = 'distress signal has been sent to available units!', - ['distress_message'] = 'medical attention required: unconscious citizen!', + ['please_wait'] = 'du är medvetslös och kommer att dö om ~b~%s minuter och %s sekunder~s~\n', + ['press_respawn'] = 'tryck [~b~E~s~] för att respawna.', + ['respawn_now_fine'] = 'respawna nu för ~g~%s SEK~s~ [Tryck ~b~E~s~]', + ['respawn_fine'] = 'du betalade ~r~%s SEK~s~ för att respawna.', + ['distress_send'] = 'tryck ~b~[G]~s~ för att skicka nödsignal', + ['distress_sent'] = 'nödsignal har skickats till samtliga enheter!', + ['distress_message'] = 'läkarvård krävs: medvetslös medborgare!', -- Revive - ['revive_help'] = 'Återuppliva en spelare', + ['revive_help'] = 'återuppliva en spelare', -- Item - ['used_medikit'] = 'Du har använt ~y~1x~s~ ~b~Medecinkit~s~', - ['used_bandage'] = 'Du har använt ~y~1x~s~ ~b~Bandage~s~', - ['not_enough_medikit'] = 'Du har inget ~b~Medecinkit~w~.', - ['not_enough_bandage'] = 'Du har inget ~b~Bandage~w~.', + ['used_medikit'] = 'du har använt ~y~1x~s~ ~b~Medecinkit~s~', + ['used_bandage'] = 'du har använt ~y~1x~s~ ~b~Bandage~s~', + ['not_enough_medikit'] = 'du har inget ~b~Medecinkit~s~.', + ['not_enough_bandage'] = 'du har inget ~b~Bandage~s~.', ['healed'] = 'dina skador har blivit behandlade.', -- Misc } From 60eaf7faa8c80a7155dbdc95664408294118ecef Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Fri, 21 Sep 2018 20:46:59 +0200 Subject: [PATCH 093/177] Moved job-related functions to seperate file --- __resource.lua | 3 +- client/job.lua | 536 +++++++++++++++++++++++++++++++++ client/main.lua | 777 +++++------------------------------------------- locales/sv.lua | 4 +- server/main.lua | 43 +-- 5 files changed, 641 insertions(+), 722 deletions(-) create mode 100644 client/job.lua diff --git a/__resource.lua b/__resource.lua index 8014bec8..2e95ff1e 100644 --- a/__resource.lua +++ b/__resource.lua @@ -30,7 +30,8 @@ client_scripts { 'locales/sv.lua', 'locales/pl.lua', 'config.lua', - 'client/main.lua' + 'client/main.lua', + 'client/job.lua' } dependency 'es_extended' diff --git a/client/job.lua b/client/job.lua new file mode 100644 index 00000000..80943ecc --- /dev/null +++ b/client/job.lua @@ -0,0 +1,536 @@ +local HasAlreadyEnteredMarker, LastZone, CurrentAction, CurrentActionMsg, CurrentActionData = nil, nil, nil, '', {} + +function OpenAmbulanceActionsMenu() + local elements = { + {label = _U('cloakroom'), value = 'cloakroom'} + } + + if Config.EnablePlayerManagement and ESX.PlayerData.job.grade_name == 'boss' then + table.insert(elements, {label = _U('boss_actions'), value = 'boss_actions'}) + end + + ESX.UI.Menu.CloseAll() + + ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'ambulance_actions', + { + title = _U('ambulance'), + align = 'top-left', + elements = elements + }, function(data, menu) + if data.current.value == 'cloakroom' then + OpenCloakroomMenu() + elseif data.current.value == 'boss_actions' then + TriggerEvent('esx_society:openBossMenu', 'ambulance', function(data, menu) + menu.close() + end, {wash = false}) + end + end, function(data, menu) + menu.close() + + CurrentAction = 'ambulance_actions_menu' + CurrentActionMsg = _U('open_menu') + CurrentActionData = {} + end) +end + +function OpenMobileAmbulanceActionsMenu() + + ESX.UI.Menu.CloseAll() + + ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'mobile_ambulance_actions', + { + title = _U('ambulance'), + align = 'top-left', + elements = { + {label = _U('ems_menu'), value = 'citizen_interaction'} + } + }, function(data, menu) + if data.current.value == 'citizen_interaction' then + ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'citizen_interaction', + { + title = _U('ems_menu_title'), + align = 'top-left', + elements = { + {label = _U('ems_menu_revive'), value = 'revive'}, + {label = _U('ems_menu_small'), value = 'small'}, + {label = _U('ems_menu_big'), value = 'big'}, + {label = _U('ems_menu_putincar'), value = 'put_in_vehicle'} + } + }, function(data, menu) + if IsBusy then return end + + local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() + + if closestPlayer == -1 or closestDistance > 3.0 then + ESX.ShowNotification(_U('no_players')) + else + + if data.current.value == 'revive' then + + ESX.TriggerServerCallback('esx_ambulancejob:getItemAmount', function(quantity) + if quantity > 0 then + local closestPlayerPed = GetPlayerPed(closestPlayer) + + if IsPedDeadOrDying(closestPlayerPed, 1) then + local playerPed = PlayerPedId() + + IsBusy = true + ESX.ShowNotification(_U('revive_inprogress')) + TaskStartScenarioInPlace(playerPed, 'CODE_HUMAN_MEDIC_TEND_TO_DEAD', 0, true) + Citizen.Wait(10000) + ClearPedTasks(playerPed) + + TriggerServerEvent('esx_ambulancejob:removeItem', 'medikit') + TriggerServerEvent('esx_ambulancejob:revive', GetPlayerServerId(closestPlayer)) + IsBusy = false + + -- Show revive award? + if Config.ReviveReward > 0 then + ESX.ShowNotification(_U('revive_complete_award', GetPlayerName(closestPlayer), Config.ReviveReward)) + else + ESX.ShowNotification(_U('revive_complete', GetPlayerName(closestPlayer))) + end + else + ESX.ShowNotification(_U('player_not_unconscious')) + end + else + ESX.ShowNotification(_U('not_enough_medikit')) + end + end, 'medikit') + + elseif data.current.value == 'small' then + + ESX.TriggerServerCallback('esx_ambulancejob:getItemAmount', function(quantity) + if quantity > 0 then + local closestPlayerPed = GetPlayerPed(closestPlayer) + local health = GetEntityHealth(closestPlayerPed) + + if health > 0 then + local playerPed = PlayerPedId() + + IsBusy = true + ESX.ShowNotification(_U('heal_inprogress')) + TaskStartScenarioInPlace(playerPed, 'CODE_HUMAN_MEDIC_TEND_TO_DEAD', 0, true) + Citizen.Wait(10000) + ClearPedTasks(playerPed) + + TriggerServerEvent('esx_ambulancejob:removeItem', 'bandage') + TriggerServerEvent('esx_ambulancejob:heal', GetPlayerServerId(closestPlayer), 'small') + ESX.ShowNotification(_U('heal_complete', GetPlayerName(closestPlayer))) + IsBusy = false + else + ESX.ShowNotification(_U('player_not_conscious')) + end + else + ESX.ShowNotification(_U('not_enough_bandage')) + end + end, 'bandage') + + elseif data.current.value == 'big' then + + ESX.TriggerServerCallback('esx_ambulancejob:getItemAmount', function(quantity) + if quantity > 0 then + local closestPlayerPed = GetPlayerPed(closestPlayer) + local health = GetEntityHealth(closestPlayerPed) + + if health > 0 then + local playerPed = PlayerPedId() + + IsBusy = true + ESX.ShowNotification(_U('heal_inprogress')) + TaskStartScenarioInPlace(playerPed, 'CODE_HUMAN_MEDIC_TEND_TO_DEAD', 0, true) + Citizen.Wait(10000) + ClearPedTasks(playerPed) + + TriggerServerEvent('esx_ambulancejob:removeItem', 'medikit') + TriggerServerEvent('esx_ambulancejob:heal', GetPlayerServerId(closestPlayer), 'big') + ESX.ShowNotification(_U('heal_complete', GetPlayerName(closestPlayer))) + IsBusy = false + else + ESX.ShowNotification(_U('player_not_conscious')) + end + else + ESX.ShowNotification(_U('not_enough_medikit')) + end + end, 'medikit') + + elseif data.current.value == 'put_in_vehicle' then + TriggerServerEvent('esx_ambulancejob:putInVehicle', GetPlayerServerId(closestPlayer)) + end + end + end, function(data, menu) + menu.close() + end) + end + + end, function(data, menu) + menu.close() + end) +end + + +AddEventHandler('esx_ambulancejob:hasEnteredMarker', function(zone) + if zone == 'HospitalInteriorEntering1' then + TeleportFadeEffect(PlayerPedId(), Config.Zones.HospitalInteriorInside1.Pos) + elseif zone == 'HospitalInteriorExit1' then + TeleportFadeEffect(PlayerPedId(), Config.Zones.HospitalInteriorOutside1.Pos) + elseif zone == 'HospitalInteriorEntering2' then + local heli = Config.HelicopterSpawner + + if not IsAnyVehicleNearPoint(heli.SpawnPoint.x, heli.SpawnPoint.y, heli.SpawnPoint.z, 3.0) and ESX.PlayerData.job ~= nil and ESX.PlayerData.job.name == 'ambulance' then + ESX.Game.SpawnVehicle('polmav', { + x = heli.SpawnPoint.x, + y = heli.SpawnPoint.y, + z = heli.SpawnPoint.z + }, heli.Heading, function(vehicle) + SetVehicleModKit(vehicle, 0) + SetVehicleLivery(vehicle, 1) + end) + end + TeleportFadeEffect(PlayerPedId(), Config.Zones.HospitalInteriorInside2.Pos) + elseif zone == 'HospitalInteriorExit2' then + TeleportFadeEffect(PlayerPedId(), Config.Zones.HospitalInteriorOutside2.Pos) + elseif zone == 'ParkingDoorGoOutInside' then + TeleportFadeEffect(PlayerPedId(), Config.Zones.ParkingDoorGoOutOutside.Pos) + elseif zone == 'ParkingDoorGoInOutside' then + TeleportFadeEffect(PlayerPedId(), Config.Zones.ParkingDoorGoInInside.Pos) + elseif zone == 'StairsGoTopBottom' then + CurrentAction = 'fast_travel_goto_top' + CurrentActionMsg = _U('fast_travel') + CurrentActionData = {pos = Config.Zones.StairsGoTopTop.Pos} + elseif zone == 'StairsGoBottomTop' then + CurrentAction = 'fast_travel_goto_bottom' + CurrentActionMsg = _U('fast_travel') + CurrentActionData = {pos = Config.Zones.StairsGoBottomBottom.Pos} + elseif zone == 'AmbulanceActions' then + CurrentAction = 'ambulance_actions_menu' + CurrentActionMsg = _U('open_menu') + CurrentActionData = {} + elseif zone == 'VehicleSpawner' then + CurrentAction = 'vehicle_spawner_menu' + CurrentActionMsg = _U('veh_spawn') + CurrentActionData = {} + elseif zone == 'Pharmacy' then + CurrentAction = 'pharmacy' + CurrentActionMsg = _U('open_pharmacy') + CurrentActionData = {} + elseif zone == 'VehicleDeleter' then + local playerPed = PlayerPedId() + local coords = GetEntityCoords(playerPed) + + if IsPedInAnyVehicle(playerPed, false) then + local vehicle, distance = ESX.Game.GetClosestVehicle({ + x = coords.x, + y = coords.y, + z = coords.z + }) + + if distance ~= -1 and distance <= 1.0 then + CurrentAction = 'delete_vehicle' + CurrentActionMsg = _U('store_veh') + CurrentActionData = {vehicle = vehicle} + end + end + end +end) + +function FastTravel(pos) + TeleportFadeEffect(PlayerPedId(), pos) +end + +AddEventHandler('esx_ambulancejob:hasExitedMarker', function(zone) + ESX.UI.Menu.CloseAll() + CurrentAction = nil +end) + +-- Create blips +Citizen.CreateThread(function() + local blip = AddBlipForCoord(Config.Blip.Pos.x, Config.Blip.Pos.y, Config.Blip.Pos.z) + + SetBlipSprite(blip, Config.Blip.Sprite) + SetBlipDisplay(blip, Config.Blip.Display) + SetBlipScale(blip, Config.Blip.Scale) + SetBlipColour(blip, Config.Blip.Colour) + SetBlipAsShortRange(blip, true) + + BeginTextCommandSetBlipName("STRING") + AddTextComponentString(_U('hospital')) + EndTextCommandSetBlipName(blip) +end) + +-- Display markers +Citizen.CreateThread(function() + while true do + Citizen.Wait(0) + + local coords = GetEntityCoords(PlayerPedId()) + for k,v in pairs(Config.Zones) do + if(v.Type ~= -1 and GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < Config.DrawDistance) then + if ESX.PlayerData.job ~= nil and ESX.PlayerData.job.name == 'ambulance' then + DrawMarker(v.Type, v.Pos.x, v.Pos.y, v.Pos.z, 0.0, 0.0, 0.0, 0, 0.0, 0.0, Config.MarkerSize.x, Config.MarkerSize.y, Config.MarkerSize.z, Config.MarkerColor.r, Config.MarkerColor.g, Config.MarkerColor.b, 100, false, true, 2, false, false, false, false) + elseif k ~= 'AmbulanceActions' and k ~= 'VehicleSpawner' and k ~= 'VehicleDeleter' and k ~= 'Pharmacy' and k ~= 'StairsGoTopBottom' and k ~= 'StairsGoBottomTop' then + DrawMarker(v.Type, v.Pos.x, v.Pos.y, v.Pos.z, 0.0, 0.0, 0.0, 0, 0.0, 0.0, Config.MarkerSize.x, Config.MarkerSize.y, Config.MarkerSize.z, Config.MarkerColor.r, Config.MarkerColor.g, Config.MarkerColor.b, 100, false, true, 2, false, false, false, false) + end + end + end + end +end) + +-- Activate menu when player is inside marker +Citizen.CreateThread(function() + while true do + Citizen.Wait(10) + + local coords = GetEntityCoords(PlayerPedId()) + local isInMarker = false + local currentZone = nil + + for k,v in pairs(Config.Zones) do + if ESX.PlayerData.job ~= nil and ESX.PlayerData.job.name == 'ambulance' then + if(GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < Config.MarkerSize.x) then + isInMarker = true + currentZone = k + end + elseif k ~= 'AmbulanceActions' and k ~= 'VehicleSpawner' and k ~= 'VehicleDeleter' and k ~= 'Pharmacy' and k ~= 'StairsGoTopBottom' and k ~= 'StairsGoBottomTop' then + if(GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < Config.MarkerSize.x) then + isInMarker = true + currentZone = k + end + end + end + + if isInMarker and not hasAlreadyEnteredMarker then + hasAlreadyEnteredMarker = true + lastZone = currentZone + TriggerEvent('esx_ambulancejob:hasEnteredMarker', currentZone) + end + + if not isInMarker and hasAlreadyEnteredMarker then + hasAlreadyEnteredMarker = false + TriggerEvent('esx_ambulancejob:hasExitedMarker', lastZone) + end + end +end) + +-- Key Controls +Citizen.CreateThread(function() + while true do + Citizen.Wait(10) + + if CurrentAction ~= nil then + ESX.ShowHelpNotification(CurrentActionMsg) + + if IsControlJustReleased(0, Keys['E']) and ESX.PlayerData.job ~= nil and ESX.PlayerData.job.name == 'ambulance' then + + if CurrentAction == 'ambulance_actions_menu' then + OpenAmbulanceActionsMenu() + elseif CurrentAction == 'vehicle_spawner_menu' then + OpenVehicleSpawnerMenu() + elseif CurrentAction == 'pharmacy' then + OpenPharmacyMenu() + elseif CurrentAction == 'fast_travel_goto_top' or CurrentAction == 'fast_travel_goto_bottom' then + FastTravel(CurrentActionData.pos) + elseif CurrentAction == 'delete_vehicle' then + if Config.EnableSocietyOwnedVehicles then + local vehicleProps = ESX.Game.GetVehicleProperties(CurrentActionData.vehicle) + TriggerServerEvent('esx_society:putVehicleInGarage', 'ambulance', vehicleProps) + end + ESX.Game.DeleteVehicle(CurrentActionData.vehicle) + end + + CurrentAction = nil + + end + + end + + if IsControlJustReleased(0, Keys['F6']) and ESX.PlayerData.job ~= nil and ESX.PlayerData.job.name == 'ambulance' and not IsDead then + OpenMobileAmbulanceActionsMenu() + end + end +end) + +RegisterNetEvent('esx_ambulancejob:putInVehicle') +AddEventHandler('esx_ambulancejob:putInVehicle', function() + local playerPed = PlayerPedId() + local coords = GetEntityCoords(playerPed) + + if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then + local vehicle = GetClosestVehicle(coords.x, coords.y, coords.z, 5.0, 0, 71) + + if DoesEntityExist(vehicle) then + local maxSeats = GetVehicleMaxNumberOfPassengers(vehicle) + local freeSeat = nil + + for i=maxSeats - 1, 0, -1 do + if IsVehicleSeatFree(vehicle, i) then + freeSeat = i + break + end + end + + if freeSeat ~= nil then + TaskWarpPedIntoVehicle(playerPed, vehicle, freeSeat) + end + end + end +end) + + +function OpenCloakroomMenu() + ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'cloakroom', + { + title = _U('cloakroom'), + align = 'top-left', + elements = { + {label = _U('ems_clothes_civil'), value = 'citizen_wear'}, + {label = _U('ems_clothes_ems'), value = 'ambulance_wear'}, + } + }, function(data, menu) + if data.current.value == 'citizen_wear' then + ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin) + TriggerEvent('skinchanger:loadSkin', skin) + end) + elseif data.current.value == 'ambulance_wear' then + ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin) + if skin.sex == 0 then + TriggerEvent('skinchanger:loadClothes', skin, jobSkin.skin_male) + else + TriggerEvent('skinchanger:loadClothes', skin, jobSkin.skin_female) + end + end) + end + + menu.close() + CurrentAction = 'ambulance_actions_menu' + CurrentActionMsg = _U('open_menu') + CurrentActionData = {} + end, function(data, menu) + menu.close() + end) +end + +function OpenVehicleSpawnerMenu() + + ESX.UI.Menu.CloseAll() + + if Config.EnableSocietyOwnedVehicles then + + local elements = {} + + ESX.TriggerServerCallback('esx_society:getVehiclesInGarage', function(vehicles) + for i=1, #vehicles, 1 do + table.insert(elements, {label = GetDisplayNameFromVehicleModel(vehicles[i].model) .. ' [' .. vehicles[i].plate .. ']', value = vehicles[i]}) + end + + ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'vehicle_spawner', + { + title = _U('veh_menu'), + align = 'top-left', + elements = elements + }, function(data, menu) + menu.close() + + local vehicleProps = data.current.value + ESX.Game.SpawnVehicle(vehicleProps.model, Config.Zones.VehicleSpawnPoint.Pos, 270.0, function(vehicle) + ESX.Game.SetVehicleProperties(vehicle, vehicleProps) + local playerPed = PlayerPedId() + TaskWarpPedIntoVehicle(playerPed, vehicle, -1) + end) + TriggerServerEvent('esx_society:removeVehicleFromGarage', 'ambulance', vehicleProps) + end, function(data, menu) + menu.close() + CurrentAction = 'vehicle_spawner_menu' + CurrentActionMsg = _U('veh_spawn') + CurrentActionData = {} + end) + end, 'ambulance') + + else -- not society vehicles + + ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'vehicle_spawner', + { + title = _U('veh_menu'), + align = 'top-left', + elements = Config.AuthorizedVehicles + }, function(data, menu) + menu.close() + + ESX.Game.SpawnVehicle(data.current.model, Config.Zones.VehicleSpawnPoint.Pos, 230.0, function(vehicle) + local playerPed = PlayerPedId() + TaskWarpPedIntoVehicle(playerPed, vehicle, -1) + end) + end, function(data, menu) + menu.close() + CurrentAction = 'vehicle_spawner_menu' + CurrentActionMsg = _U('veh_spawn') + CurrentActionData = {} + end) + + end +end + +function OpenPharmacyMenu() + ESX.UI.Menu.CloseAll() + + ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'pharmacy', + { + title = _U('pharmacy_menu_title'), + align = 'top-left', + elements = { + {label = _U('pharmacy_take') .. ' ' .. _('medikit'), value = 'medikit'}, + {label = _U('pharmacy_take') .. ' ' .. _('bandage'), value = 'bandage'} + } + }, function(data, menu) + TriggerServerEvent('esx_ambulancejob:giveItem', data.current.value) + end, function(data, menu) + menu.close() + CurrentAction = 'pharmacy' + CurrentActionMsg = _U('open_pharmacy') + CurrentActionData = {} + end) +end + +function WarpPedInClosestVehicle(ped) + local coords = GetEntityCoords(ped) + + local vehicle, distance = ESX.Game.GetClosestVehicle({ + x = coords.x, + y = coords.y, + z = coords.z + }) + + if distance ~= -1 and distance <= 5.0 then + local maxSeats = GetVehicleMaxNumberOfPassengers(vehicle) + local freeSeat = nil + + for i=maxSeats - 1, 0, -1 do + if IsVehicleSeatFree(vehicle, i) then + freeSeat = i + break + end + end + + if freeSeat ~= nil then + TaskWarpPedIntoVehicle(ped, vehicle, freeSeat) + end + else + ESX.ShowNotification(_U('no_vehicles')) + end +end + +RegisterNetEvent('esx_ambulancejob:heal') +AddEventHandler('esx_ambulancejob:heal', function(healType) + local playerPed = PlayerPedId() + local maxHealth = GetEntityMaxHealth(playerPed) + + if healType == 'small' then + local health = GetEntityHealth(playerPed) + local newHealth = math.min(maxHealth , math.floor(health + maxHealth/8)) + SetEntityHealth(playerPed, newHealth) + elseif healType == 'big' then + SetEntityHealth(playerPed, maxHealth) + end + + ESX.ShowNotification(_U('healed')) +end) \ No newline at end of file diff --git a/client/main.lua b/client/main.lua index 93364e4f..169d5697 100644 --- a/client/main.lua +++ b/client/main.lua @@ -1,4 +1,4 @@ -local Keys = { +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, @@ -10,17 +10,10 @@ local Keys = { ["NENTER"] = 201, ["N4"] = 108, ["N5"] = 60, ["N6"] = 107, ["N+"] = 96, ["N-"] = 97, ["N7"] = 117, ["N8"] = 61, ["N9"] = 118 } -local PlayerData = {} -local FirstSpawn = true -local IsDead = false -local HasAlreadyEnteredMarker = false -local LastZone = nil -local CurrentAction = nil -local CurrentActionMsg = '' -local CurrentActionData = {} -local IsBusy = false +local FirstSpawn, IsBusy = true, false -ESX = nil +IsDead = false +ESX = nil Citizen.CreateThread(function() while ESX == nil do @@ -28,43 +21,46 @@ Citizen.CreateThread(function() Citizen.Wait(0) end - Citizen.Wait(5000) - PlayerData = ESX.GetPlayerData() -end) - -function RespawnPed(ped, coords) - SetEntityCoordsNoOffset(ped, coords.x, coords.y, coords.z, false, false, false, true) - NetworkResurrectLocalPlayer(coords.x, coords.y, coords.z, coords.heading, true, false) - SetPlayerInvincible(ped, false) - TriggerEvent('playerSpawned', coords.x, coords.y, coords.z, coords.heading) - ClearPedBloodDamage(ped) - - ESX.UI.Menu.CloseAll() -end - -RegisterNetEvent('esx_ambulancejob:heal') -AddEventHandler('esx_ambulancejob:heal', function(healType) - local playerPed = PlayerPedId() - local maxHealth = GetEntityMaxHealth(playerPed) - - if healType == 'small' then - local health = GetEntityHealth(playerPed) - local newHealth = math.min(maxHealth , math.floor(health + maxHealth/8)) - SetEntityHealth(playerPed, newHealth) - elseif healType == 'big' then - SetEntityHealth(playerPed, maxHealth) + while ESX.GetPlayerData().job == nil do + Citizen.Wait(100) end - ESX.ShowNotification(_U('healed')) + ESX.PlayerData = ESX.GetPlayerData() end) +RegisterNetEvent('esx:playerLoaded') +AddEventHandler('esx:playerLoaded', function(xPlayer) + ESX.PlayerData = xPlayer +end) -function StartRespawnTimer() - Citizen.SetTimeout(Config.RespawnDelayAfterRPDeath, function() - if IsDead then - RemoveItemsAfterRPDeath() - end - end) +RegisterNetEvent('esx:setJob') +AddEventHandler('esx:setJob', function(job) + ESX.PlayerData.job = job +end) + +AddEventHandler('playerSpawned', function() + IsDead = false + + if FirstSpawn then + TriggerServerEvent('esx_ambulancejob:firstSpawn') + exports.spawnmanager:setAutoSpawn(false) -- disable respawn + FirstSpawn = false + end +end) + +function OnPlayerDeath() + IsDead = true + TriggerServerEvent('esx_ambulancejob:setDeathStatus', 1) + + if Config.ShowDeathTimer == true then + ShowDeathTimer() + end + + StartRespawnTimer() + StartDistressSignal() + + ClearPedTasksImmediately(PlayerPedId()) + StartScreenEffect('DeathFailOut', 0, false) end function StartDistressSignal() @@ -202,29 +198,30 @@ end function PayFine() ESX.TriggerServerCallback('esx_ambulancejob:payFine', function() - RemoveItemsAfterRPDeath() + RemoveItemsAfterRPDeath() end) end -function OnPlayerDeath() - IsDead = true - TriggerServerEvent('esx_ambulancejob:setDeathStatus', 1) +function RespawnPed(ped, coords) + SetEntityCoordsNoOffset(ped, coords.x, coords.y, coords.z, false, false, false, true) + NetworkResurrectLocalPlayer(coords.x, coords.y, coords.z, coords.heading, true, false) + SetPlayerInvincible(ped, false) + TriggerEvent('playerSpawned', coords.x, coords.y, coords.z, coords.heading) + ClearPedBloodDamage(ped) - if Config.ShowDeathTimer == true then - ShowDeathTimer() - end + ESX.UI.Menu.CloseAll() +end - StartRespawnTimer() - StartDistressSignal() - - ClearPedTasksImmediately(PlayerPedId()) - StartScreenEffect('DeathFailOut', 0, false) +function StartRespawnTimer() + Citizen.SetTimeout(Config.RespawnDelayAfterRPDeath, function() + if IsDead then + RemoveItemsAfterRPDeath() + end + end) end function TeleportFadeEffect(entity, coords) - Citizen.CreateThread(function() - DoScreenFadeOut(800) while not IsScreenFadedOut() do @@ -234,407 +231,18 @@ function TeleportFadeEffect(entity, coords) ESX.Game.Teleport(entity, coords, function() DoScreenFadeIn(800) end) - - end) - -end - -function WarpPedInClosestVehicle(ped) - - local coords = GetEntityCoords(ped) - - local vehicle, distance = ESX.Game.GetClosestVehicle({ - x = coords.x, - y = coords.y, - z = coords.z - }) - - if distance ~= -1 and distance <= 5.0 then - - local maxSeats = GetVehicleMaxNumberOfPassengers(vehicle) - local freeSeat = nil - - for i=maxSeats - 1, 0, -1 do - if IsVehicleSeatFree(vehicle, i) then - freeSeat = i - break - end - end - - if freeSeat ~= nil then - TaskWarpPedIntoVehicle(ped, vehicle, freeSeat) - end - - else - ESX.ShowNotification(_U('no_vehicles')) - end - -end - -function OpenAmbulanceActionsMenu() - - local elements = { - {label = _U('cloakroom'), value = 'cloakroom'} - } - - if Config.EnablePlayerManagement and PlayerData.job.grade_name == 'boss' then - table.insert(elements, {label = _U('boss_actions'), value = 'boss_actions'}) - end - - ESX.UI.Menu.CloseAll() - - ESX.UI.Menu.Open( - 'default', GetCurrentResourceName(), 'ambulance_actions', - { - title = _U('ambulance'), - align = 'top-left', - elements = elements - }, - function(data, menu) - - if data.current.value == 'cloakroom' then - OpenCloakroomMenu() - end - - if data.current.value == 'boss_actions' then - TriggerEvent('esx_society:openBossMenu', 'ambulance', function(data, menu) - menu.close() - end, {wash = false}) - end - - end, - function(data, menu) - - menu.close() - - CurrentAction = 'ambulance_actions_menu' - CurrentActionMsg = _U('open_menu') - CurrentActionData = {} - - end - ) - -end - -function OpenMobileAmbulanceActionsMenu() - - ESX.UI.Menu.CloseAll() - - ESX.UI.Menu.Open( - 'default', GetCurrentResourceName(), 'mobile_ambulance_actions', - { - title = _U('ambulance'), - align = 'top-left', - elements = { - {label = _U('ems_menu'), value = 'citizen_interaction'}, - } - }, function(data, menu) - if data.current.value == 'citizen_interaction' then - ESX.UI.Menu.Open( - 'default', GetCurrentResourceName(), 'citizen_interaction', - { - title = _U('ems_menu_title'), - align = 'top-left', - elements = { - {label = _U('ems_menu_revive'), value = 'revive'}, - {label = _U('ems_menu_small'), value = 'small'}, - {label = _U('ems_menu_big'), value = 'big'}, - {label = _U('ems_menu_putincar'), value = 'put_in_vehicle'}, - } - }, function(data, menu) - if IsBusy then return end - if data.current.value == 'revive' then -- revive - - local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() - - if closestPlayer == -1 or closestDistance > 3.0 then - ESX.ShowNotification(_U('no_players')) - else - ESX.TriggerServerCallback('esx_ambulancejob:getItemAmount', function(qtty) - if qtty > 0 then - local closestPlayerPed = GetPlayerPed(closestPlayer) - local health = GetEntityHealth(closestPlayerPed) - - if health == 0 then - local playerPed = PlayerPedId() - - IsBusy = true - ESX.ShowNotification(_U('revive_inprogress')) - TaskStartScenarioInPlace(playerPed, 'CODE_HUMAN_MEDIC_TEND_TO_DEAD', 0, true) - Citizen.Wait(10000) - ClearPedTasks(playerPed) - - TriggerServerEvent('esx_ambulancejob:removeItem', 'medikit') - TriggerServerEvent('esx_ambulancejob:revive', GetPlayerServerId(closestPlayer)) - IsBusy = false - - -- Show revive award? - if Config.ReviveReward > 0 then - ESX.ShowNotification(_U('revive_complete_award', GetPlayerName(closestPlayer), Config.ReviveReward)) - else - ESX.ShowNotification(_U('revive_complete', GetPlayerName(closestPlayer))) - end - else - ESX.ShowNotification(_U('player_not_unconscious')) - end - else - ESX.ShowNotification(_U('not_enough_medikit')) - end - end, 'medikit') - end - elseif data.current.value == 'small' then - - local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() - if closestPlayer == -1 or closestDistance > 3.0 then - ESX.ShowNotification(_U('no_players')) - else - ESX.TriggerServerCallback('esx_ambulancejob:getItemAmount', function(qtty) - if qtty > 0 then - local closestPlayerPed = GetPlayerPed(closestPlayer) - local health = GetEntityHealth(closestPlayerPed) - - if health > 0 then - local playerPed = PlayerPedId() - - IsBusy = true - ESX.ShowNotification(_U('heal_inprogress')) - TaskStartScenarioInPlace(playerPed, 'CODE_HUMAN_MEDIC_TEND_TO_DEAD', 0, true) - Citizen.Wait(10000) - ClearPedTasks(playerPed) - - TriggerServerEvent('esx_ambulancejob:removeItem', 'bandage') - TriggerServerEvent('esx_ambulancejob:heal', GetPlayerServerId(closestPlayer), 'small') - ESX.ShowNotification(_U('heal_complete', GetPlayerName(closestPlayer))) - IsBusy = false - else - ESX.ShowNotification(_U('player_not_conscious')) - end - else - ESX.ShowNotification(_U('not_enough_bandage')) - end - end, 'bandage') - end - elseif data.current.value == 'big' then - - local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() - if closestPlayer == -1 or closestDistance > 3.0 then - ESX.ShowNotification(_U('no_players')) - else - ESX.TriggerServerCallback('esx_ambulancejob:getItemAmount', function(qtty) - if qtty > 0 then - local closestPlayerPed = GetPlayerPed(closestPlayer) - local health = GetEntityHealth(closestPlayerPed) - - if health > 0 then - local playerPed = PlayerPedId() - - IsBusy = true - ESX.ShowNotification(_U('heal_inprogress')) - TaskStartScenarioInPlace(playerPed, 'CODE_HUMAN_MEDIC_TEND_TO_DEAD', 0, true) - Citizen.Wait(10000) - ClearPedTasks(playerPed) - - TriggerServerEvent('esx_ambulancejob:removeItem', 'medikit') - TriggerServerEvent('esx_ambulancejob:heal', GetPlayerServerId(closestPlayer), 'big') - ESX.ShowNotification(_U('heal_complete', GetPlayerName(closestPlayer))) - IsBusy = false - else - ESX.ShowNotification(_U('player_not_conscious')) - end - else - ESX.ShowNotification(_U('not_enough_medikit')) - end - end, 'medikit') - end - elseif data.current.value == 'put_in_vehicle' then - - local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() - if closestPlayer == -1 or closestDistance > 3.0 then - ESX.ShowNotification(_U('no_vehicles')) - else - menu.close() - WarpPedInClosestVehicle(GetPlayerPed(closestPlayer)) - end - end - end, function(data, menu) - menu.close() - end) - end - - end, function(data, menu) - menu.close() end) end -function OpenCloakroomMenu() - - ESX.UI.Menu.Open( - 'default', GetCurrentResourceName(), 'cloakroom', - { - title = _U('cloakroom'), - align = 'top-left', - elements = { - {label = _U('ems_clothes_civil'), value = 'citizen_wear'}, - {label = _U('ems_clothes_ems'), value = 'ambulance_wear'}, - }, - }, - function(data, menu) - - menu.close() - - if data.current.value == 'citizen_wear' then - - ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin) - TriggerEvent('skinchanger:loadSkin', skin) - end) - - end - - if data.current.value == 'ambulance_wear' then - - ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin) - - if skin.sex == 0 then - TriggerEvent('skinchanger:loadClothes', skin, jobSkin.skin_male) - else - TriggerEvent('skinchanger:loadClothes', skin, jobSkin.skin_female) - end - - end) - - end - - CurrentAction = 'ambulance_actions_menu' - CurrentActionMsg = _U('open_menu') - CurrentActionData = {} - - end, - function(data, menu) - menu.close() - end - ) - -end - -function OpenVehicleSpawnerMenu() - - ESX.UI.Menu.CloseAll() - - if Config.EnableSocietyOwnedVehicles then - - local elements = {} - - ESX.TriggerServerCallback('esx_society:getVehiclesInGarage', function(vehicles) - - for i=1, #vehicles, 1 do - table.insert(elements, {label = GetDisplayNameFromVehicleModel(vehicles[i].model) .. ' [' .. vehicles[i].plate .. ']', value = vehicles[i]}) - end - - ESX.UI.Menu.Open( - 'default', GetCurrentResourceName(), 'vehicle_spawner', - { - title = _U('veh_menu'), - align = 'top-left', - elements = elements, - }, function(data, menu) - menu.close() - - local vehicleProps = data.current.value - ESX.Game.SpawnVehicle(vehicleProps.model, Config.Zones.VehicleSpawnPoint.Pos, 270.0, function(vehicle) - ESX.Game.SetVehicleProperties(vehicle, vehicleProps) - local playerPed = PlayerPedId() - TaskWarpPedIntoVehicle(playerPed, vehicle, -1) - end) - TriggerServerEvent('esx_society:removeVehicleFromGarage', 'ambulance', vehicleProps) - - end, function(data, menu) - menu.close() - CurrentAction = 'vehicle_spawner_menu' - CurrentActionMsg = _U('veh_spawn') - CurrentActionData = {} - end - ) - end, 'ambulance') - - else -- not society vehicles - - ESX.UI.Menu.Open( - 'default', GetCurrentResourceName(), 'vehicle_spawner', - { - title = _U('veh_menu'), - align = 'top-left', - elements = Config.AuthorizedVehicles - }, function(data, menu) - menu.close() - ESX.Game.SpawnVehicle(data.current.model, Config.Zones.VehicleSpawnPoint.Pos, 230.0, function(vehicle) - local playerPed = PlayerPedId() - TaskWarpPedIntoVehicle(playerPed, vehicle, -1) - end) - end, function(data, menu) - menu.close() - CurrentAction = 'vehicle_spawner_menu' - CurrentActionMsg = _U('veh_spawn') - CurrentActionData = {} - end - ) - end -end - -function OpenPharmacyMenu() - ESX.UI.Menu.CloseAll() - - ESX.UI.Menu.Open( - 'default', GetCurrentResourceName(), 'pharmacy', - { - title = _U('pharmacy_menu_title'), - align = 'top-left', - elements = { - {label = _U('pharmacy_take') .. ' ' .. _('medikit'), value = 'medikit'}, - {label = _U('pharmacy_take') .. ' ' .. _('bandage'), value = 'bandage'} - }, - }, function(data, menu) - TriggerServerEvent('esx_ambulancejob:giveItem', data.current.value) - - end, function(data, menu) - menu.close() - CurrentAction = 'pharmacy' - CurrentActionMsg = _U('open_pharmacy') - CurrentActionData = {} - end - ) -end - -AddEventHandler('playerSpawned', function() - IsDead = false - - if FirstSpawn then - TriggerServerEvent('esx_ambulancejob:firstSpawn') - exports.spawnmanager:setAutoSpawn(false) -- disable respawn - FirstSpawn = false - end -end) - -RegisterNetEvent('esx:playerLoaded') -AddEventHandler('esx:playerLoaded', function(xPlayer) - PlayerData = xPlayer -end) - -RegisterNetEvent('esx:setJob') -AddEventHandler('esx:setJob', function(job) - PlayerData.job = job -end) - RegisterNetEvent('esx_phone:loaded') AddEventHandler('esx_phone:loaded', function(phoneNumber, contacts) - local specialContact = { - name = 'Ambulance', - number = 'ambulance', - base64Icon = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEwAACxMBAJqcGAAABp5JREFUWIW1l21sFNcVhp/58npn195de23Ha4Mh2EASSvk0CPVHmmCEI0RCTQMBKVVooxYoalBVCVokICWFVFVEFeKoUdNECkZQIlAoFGMhIkrBQGxHwhAcChjbeLcsYHvNfsx+zNz+MBDWNrYhzSvdP+e+c973XM2cc0dihFi9Yo6vSzN/63dqcwPZcnEwS9PDmYoE4IxZIj+ciBb2mteLwlZdfji+dXtNU2AkeaXhCGteLZ/X/IS64/RoR5mh9tFVAaMiAldKQUGiRzFp1wXJPj/YkxblbfFLT/tjq9/f1XD0sQyse2li7pdP5tYeLXXMMGUojAiWKeOodE1gqpmNfN2PFeoF00T2uLGKfZzTwhzqbaEmeYWAQ0K1oKIlfPb7t+7M37aruXvEBlYvnV7xz2ec/2jNs9kKooKNjlksiXhJfLqf1PXOIU9M8fmw/XgRu523eTNyhhu6xLjbSeOFC6EX3t3V9PmwBla9Vv7K7u85d3bpqlwVcvHn7B8iVX+IFQoNKdwfstuFtWoFvwp9zj5XL7nRlPXyudjS9z+u35tmuH/lu6dl7+vSVXmDUcpbX+skP65BxOOPJA4gjDicOM2PciejeTwcsYek1hyl6me5nhNnmwPXBhjYuGC699OpzoaAO0PbYJSy5vgt4idOPrJwf6QuX2FO0oOtqIgj9pDU5dCWrMlyvXf86xsGgHyPeLos83Brns1WFXLxxgVBorHpW4vfQ6KhkbUtCot6srns1TLPjNVr7+1J0PepVc92H/Eagkb7IsTWd4ZMaN+yCXv5zLRY9GQ9xuYtQz4nfreWGdH9dNlkfnGq5/kdO88ekwGan1B3mDJsdMxCqv5w2Iq0khLs48vSllrsG/Y5pfojNugzScnQXKBVA8hrX51ddHq0o6wwIlgS8Y7obZdUZVjOYLC6e3glWkBBVHC2RJ+w/qezCuT/2sV6Q5VYpowjvnf/iBJJqvpYBgBS+w6wVB5DLEOiTZHWy36nNheg0jUBs3PoJnMfyuOdAECqrZ3K7KcACGQp89RAtlysCphqZhPtRzYlcPx+ExklJUiq0le5omCfOGFAYn3qFKS/fZAWS7a3Y2wa+GJOEy4US+B3aaPUYJamj4oI5LA/jWQBt5HIK5+JfXzZsJVpXi/ac8+mxWIXWzAG4Wb4g/jscNMp63I4U5FcKaVvsNyFALokSA47Kx8PVk83OabCHZsiqwAKEpjmfUJIkoh/R+L9oTpjluhRkGSPG4A7EkS+Y3HZk0OXYpIVNy01P5yItnptDsvtIwr0SunqoVP1GG1taTHn1CloXm9aLBEIEDl/IS2W6rg+qIFEYR7+OJTesqJqYa95/VKBNOHLjDBZ8sDS2998a0Bs/F//gvu5Z9NivadOc/U3676pEsizBIN1jCYlhClL+ELJDrkobNUBfBZqQfMN305HAgnIeYi4OnYMh7q/AsAXSdXK+eH41sykxd+TV/AsXvR/MeARAttD9pSqF9nDNfSEoDQsb5O31zQFprcaV244JPY7bqG6Xd9K3C3ALgbfk3NzqNE6CdplZrVFL27eWR+UASb6479ULfhD5AzOlSuGFTE6OohebElbcb8fhxA4xEPUgdTK19hiNKCZgknB+Ep44E44d82cxqPPOKctCGXzTmsBXbV1j1S5XQhyHq6NvnABPylu46A7QmVLpP7w9pNz4IEb0YyOrnmjb8bjB129fDBRkDVj2ojFbYBnCHHb7HL+OC7KQXeEsmAiNrnTqLy3d3+s/bvlVmxpgffM1fyM5cfsPZLuK+YHnvHELl8eUlwV4BXim0r6QV+4gD9Nlnjbfg1vJGktbI5UbN/TcGmAAYDG84Gry/MLLl/zKouO2Xukq/YkCyuWYV5owTIGjhVFCPL6J7kLOTcH89ereF1r4qOsm3gjSevl85El1Z98cfhB3qBN9+dLp1fUTco+0OrVMnNjFuv0chYbBYT2HcBoa+8TALyWQOt/ImPHoFS9SI3WyRajgdt2mbJgIlbREplfveuLf/XXemjXX7v46ZxzPlfd8YlZ01My5MUEVdIY5rueYopw4fQHkbv7/rZkTw6JwjyalBCHur9iD9cI2mU0UzD3P9H6yZ1G5dt7Gwe96w07dl5fXj7vYqH2XsNovdTI6KMrlsAXhRyz7/C7FBO/DubdVq4nBLPaohcnBeMr3/2k4fhQ+Uc8995YPq2wMzNjww2X+vwNt1p00ynrd2yKDJAVN628sBX1hZIdxXdStU9G5W2bd9YHR5L3f/CNmJeY9G8WAAAAAElFTkSuQmCC' + name = 'Ambulance', + number = 'ambulance', + base64Icon = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEwAACxMBAJqcGAAABp5JREFUWIW1l21sFNcVhp/58npn195de23Ha4Mh2EASSvk0CPVHmmCEI0RCTQMBKVVooxYoalBVCVokICWFVFVEFeKoUdNECkZQIlAoFGMhIkrBQGxHwhAcChjbeLcsYHvNfsx+zNz+MBDWNrYhzSvdP+e+c973XM2cc0dihFi9Yo6vSzN/63dqcwPZcnEwS9PDmYoE4IxZIj+ciBb2mteLwlZdfji+dXtNU2AkeaXhCGteLZ/X/IS64/RoR5mh9tFVAaMiAldKQUGiRzFp1wXJPj/YkxblbfFLT/tjq9/f1XD0sQyse2li7pdP5tYeLXXMMGUojAiWKeOodE1gqpmNfN2PFeoF00T2uLGKfZzTwhzqbaEmeYWAQ0K1oKIlfPb7t+7M37aruXvEBlYvnV7xz2ec/2jNs9kKooKNjlksiXhJfLqf1PXOIU9M8fmw/XgRu523eTNyhhu6xLjbSeOFC6EX3t3V9PmwBla9Vv7K7u85d3bpqlwVcvHn7B8iVX+IFQoNKdwfstuFtWoFvwp9zj5XL7nRlPXyudjS9z+u35tmuH/lu6dl7+vSVXmDUcpbX+skP65BxOOPJA4gjDicOM2PciejeTwcsYek1hyl6me5nhNnmwPXBhjYuGC699OpzoaAO0PbYJSy5vgt4idOPrJwf6QuX2FO0oOtqIgj9pDU5dCWrMlyvXf86xsGgHyPeLos83Brns1WFXLxxgVBorHpW4vfQ6KhkbUtCot6srns1TLPjNVr7+1J0PepVc92H/Eagkb7IsTWd4ZMaN+yCXv5zLRY9GQ9xuYtQz4nfreWGdH9dNlkfnGq5/kdO88ekwGan1B3mDJsdMxCqv5w2Iq0khLs48vSllrsG/Y5pfojNugzScnQXKBVA8hrX51ddHq0o6wwIlgS8Y7obZdUZVjOYLC6e3glWkBBVHC2RJ+w/qezCuT/2sV6Q5VYpowjvnf/iBJJqvpYBgBS+w6wVB5DLEOiTZHWy36nNheg0jUBs3PoJnMfyuOdAECqrZ3K7KcACGQp89RAtlysCphqZhPtRzYlcPx+ExklJUiq0le5omCfOGFAYn3qFKS/fZAWS7a3Y2wa+GJOEy4US+B3aaPUYJamj4oI5LA/jWQBt5HIK5+JfXzZsJVpXi/ac8+mxWIXWzAG4Wb4g/jscNMp63I4U5FcKaVvsNyFALokSA47Kx8PVk83OabCHZsiqwAKEpjmfUJIkoh/R+L9oTpjluhRkGSPG4A7EkS+Y3HZk0OXYpIVNy01P5yItnptDsvtIwr0SunqoVP1GG1taTHn1CloXm9aLBEIEDl/IS2W6rg+qIFEYR7+OJTesqJqYa95/VKBNOHLjDBZ8sDS2998a0Bs/F//gvu5Z9NivadOc/U3676pEsizBIN1jCYlhClL+ELJDrkobNUBfBZqQfMN305HAgnIeYi4OnYMh7q/AsAXSdXK+eH41sykxd+TV/AsXvR/MeARAttD9pSqF9nDNfSEoDQsb5O31zQFprcaV244JPY7bqG6Xd9K3C3ALgbfk3NzqNE6CdplZrVFL27eWR+UASb6479ULfhD5AzOlSuGFTE6OohebElbcb8fhxA4xEPUgdTK19hiNKCZgknB+Ep44E44d82cxqPPOKctCGXzTmsBXbV1j1S5XQhyHq6NvnABPylu46A7QmVLpP7w9pNz4IEb0YyOrnmjb8bjB129fDBRkDVj2ojFbYBnCHHb7HL+OC7KQXeEsmAiNrnTqLy3d3+s/bvlVmxpgffM1fyM5cfsPZLuK+YHnvHELl8eUlwV4BXim0r6QV+4gD9Nlnjbfg1vJGktbI5UbN/TcGmAAYDG84Gry/MLLl/zKouO2Xukq/YkCyuWYV5owTIGjhVFCPL6J7kLOTcH89ereF1r4qOsm3gjSevl85El1Z98cfhB3qBN9+dLp1fUTco+0OrVMnNjFuv0chYbBYT2HcBoa+8TALyWQOt/ImPHoFS9SI3WyRajgdt2mbJgIlbREplfveuLf/XXemjXX7v46ZxzPlfd8YlZ01My5MUEVdIY5rueYopw4fQHkbv7/rZkTw6JwjyalBCHur9iD9cI2mU0UzD3P9H6yZ1G5dt7Gwe96w07dl5fXj7vYqH2XsNovdTI6KMrlsAXhRyz7/C7FBO/DubdVq4nBLPaohcnBeMr3/2k4fhQ+Uc8995YPq2wMzNjww2X+vwNt1p00ynrd2yKDJAVN628sBX1hZIdxXdStU9G5W2bd9YHR5L3f/CNmJeY9G8WAAAAAElFTkSuQmCC' } TriggerEvent('esx_phone:addSpecialContact', specialContact.name, specialContact.number, specialContact.base64Icon) - end) AddEventHandler('esx:onPlayerDeath', function(reason) @@ -643,269 +251,40 @@ end) RegisterNetEvent('esx_ambulancejob:revive') AddEventHandler('esx_ambulancejob:revive', function() - local playerPed = PlayerPedId() local coords = GetEntityCoords(playerPed) TriggerServerEvent('esx_ambulancejob:setDeathStatus', 0) Citizen.CreateThread(function() + DoScreenFadeOut(800) - DoScreenFadeOut(800) + while not IsScreenFadedOut() do + Citizen.Wait(0) + end - while not IsScreenFadedOut() do - Citizen.Wait(0) - end + ESX.SetPlayerData('lastPosition', { + x = coords.x, + y = coords.y, + z = coords.z + }) - ESX.SetPlayerData('lastPosition', { - x = coords.x, - y = coords.y, - z = coords.z - }) + TriggerServerEvent('esx:updateLastPosition', { + x = coords.x, + y = coords.y, + z = coords.z + }) - TriggerServerEvent('esx:updateLastPosition', { - x = coords.x, - y = coords.y, - z = coords.z - }) - - RespawnPed(playerPed, { - x = coords.x, - y = coords.y, - z = coords.z - }) - - StopScreenEffect('DeathFailOut') - - DoScreenFadeIn(800) + RespawnPed(playerPed, { + x = coords.x, + y = coords.y, + z = coords.z + }) + StopScreenEffect('DeathFailOut') + DoScreenFadeIn(800) end) - end) -AddEventHandler('esx_ambulancejob:hasEnteredMarker', function(zone) - - if zone == 'HospitalInteriorEntering1' then - TeleportFadeEffect(PlayerPedId(), Config.Zones.HospitalInteriorInside1.Pos) - end - - if zone == 'HospitalInteriorExit1' then - TeleportFadeEffect(PlayerPedId(), Config.Zones.HospitalInteriorOutside1.Pos) - end - - if zone == 'HospitalInteriorEntering2' then - local heli = Config.HelicopterSpawner - - if not IsAnyVehicleNearPoint(heli.SpawnPoint.x, heli.SpawnPoint.y, heli.SpawnPoint.z, 3.0) and PlayerData.job ~= nil and PlayerData.job.name == 'ambulance' then - ESX.Game.SpawnVehicle('polmav', { - x = heli.SpawnPoint.x, - y = heli.SpawnPoint.y, - z = heli.SpawnPoint.z - }, heli.Heading, function(vehicle) - SetVehicleModKit(vehicle, 0) - SetVehicleLivery(vehicle, 1) - end) - - end - TeleportFadeEffect(PlayerPedId(), Config.Zones.HospitalInteriorInside2.Pos) - end - - if zone == 'HospitalInteriorExit2' then - TeleportFadeEffect(PlayerPedId(), Config.Zones.HospitalInteriorOutside2.Pos) - end - - if zone == 'ParkingDoorGoOutInside' then - TeleportFadeEffect(PlayerPedId(), Config.Zones.ParkingDoorGoOutOutside.Pos) - end - - if zone == 'ParkingDoorGoInOutside' then - TeleportFadeEffect(PlayerPedId(), Config.Zones.ParkingDoorGoInInside.Pos) - end - - if zone == 'StairsGoTopBottom' then - CurrentAction = 'fast_travel_goto_top' - CurrentActionMsg = _U('fast_travel') - CurrentActionData = {pos = Config.Zones.StairsGoTopTop.Pos} - end - - if zone == 'StairsGoBottomTop' then - CurrentAction = 'fast_travel_goto_bottom' - CurrentActionMsg = _U('fast_travel') - CurrentActionData = {pos = Config.Zones.StairsGoBottomBottom.Pos} - end - - if zone == 'AmbulanceActions' then - CurrentAction = 'ambulance_actions_menu' - CurrentActionMsg = _U('open_menu') - CurrentActionData = {} - end - - if zone == 'VehicleSpawner' then - CurrentAction = 'vehicle_spawner_menu' - CurrentActionMsg = _U('veh_spawn') - CurrentActionData = {} - end - - if zone == 'Pharmacy' then - CurrentAction = 'pharmacy' - CurrentActionMsg = _U('open_pharmacy') - CurrentActionData = {} - end - - if zone == 'VehicleDeleter' then - - local playerPed = PlayerPedId() - local coords = GetEntityCoords(playerPed) - - if IsPedInAnyVehicle(playerPed, false) then - - local vehicle, distance = ESX.Game.GetClosestVehicle({ - x = coords.x, - y = coords.y, - z = coords.z - }) - - if distance ~= -1 and distance <= 1.0 then - - CurrentAction = 'delete_vehicle' - CurrentActionMsg = _U('store_veh') - CurrentActionData = {vehicle = vehicle} - - end - - end - - end - -end) - -function FastTravel(pos) - TeleportFadeEffect(PlayerPedId(), pos) -end - -AddEventHandler('esx_ambulancejob:hasExitedMarker', function(zone) - ESX.UI.Menu.CloseAll() - CurrentAction = nil -end) - --- Create blips -Citizen.CreateThread(function() - - local blip = AddBlipForCoord(Config.Blip.Pos.x, Config.Blip.Pos.y, Config.Blip.Pos.z) - - SetBlipSprite(blip, Config.Blip.Sprite) - SetBlipDisplay(blip, Config.Blip.Display) - SetBlipScale(blip, Config.Blip.Scale) - SetBlipColour(blip, Config.Blip.Colour) - SetBlipAsShortRange(blip, true) - - BeginTextCommandSetBlipName("STRING") - AddTextComponentString(_U('hospital')) - EndTextCommandSetBlipName(blip) - -end) - --- Display markers -Citizen.CreateThread(function() - while true do - Citizen.Wait(0) - - local coords = GetEntityCoords(PlayerPedId()) - for k,v in pairs(Config.Zones) do - if(v.Type ~= -1 and GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < Config.DrawDistance) then - if PlayerData.job ~= nil and PlayerData.job.name == 'ambulance' then - DrawMarker(v.Type, v.Pos.x, v.Pos.y, v.Pos.z, 0.0, 0.0, 0.0, 0, 0.0, 0.0, Config.MarkerSize.x, Config.MarkerSize.y, Config.MarkerSize.z, Config.MarkerColor.r, Config.MarkerColor.g, Config.MarkerColor.b, 100, false, true, 2, false, false, false, false) - elseif k ~= 'AmbulanceActions' and k ~= 'VehicleSpawner' and k ~= 'VehicleDeleter' and k ~= 'Pharmacy' and k ~= 'StairsGoTopBottom' and k ~= 'StairsGoBottomTop' then - DrawMarker(v.Type, v.Pos.x, v.Pos.y, v.Pos.z, 0.0, 0.0, 0.0, 0, 0.0, 0.0, Config.MarkerSize.x, Config.MarkerSize.y, Config.MarkerSize.z, Config.MarkerColor.r, Config.MarkerColor.g, Config.MarkerColor.b, 100, false, true, 2, false, false, false, false) - end - end - end - end -end) - --- Activate menu when player is inside marker -Citizen.CreateThread(function() - while true do - Citizen.Wait(10) - - local coords = GetEntityCoords(PlayerPedId()) - local isInMarker = false - local currentZone = nil - for k,v in pairs(Config.Zones) do - if PlayerData.job ~= nil and PlayerData.job.name == 'ambulance' then - if(GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < Config.MarkerSize.x) then - isInMarker = true - currentZone = k - end - elseif k ~= 'AmbulanceActions' and k ~= 'VehicleSpawner' and k ~= 'VehicleDeleter' and k ~= 'Pharmacy' and k ~= 'StairsGoTopBottom' and k ~= 'StairsGoBottomTop' then - if(GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < Config.MarkerSize.x) then - isInMarker = true - currentZone = k - end - end - end - if isInMarker and not hasAlreadyEnteredMarker then - hasAlreadyEnteredMarker = true - lastZone = currentZone - TriggerEvent('esx_ambulancejob:hasEnteredMarker', currentZone) - end - - if not isInMarker and hasAlreadyEnteredMarker then - hasAlreadyEnteredMarker = false - TriggerEvent('esx_ambulancejob:hasExitedMarker', lastZone) - end - end -end) - --- Key Controls -Citizen.CreateThread(function() - while true do - - Citizen.Wait(10) - - if CurrentAction ~= nil then - - SetTextComponentFormat('STRING') - AddTextComponentString(CurrentActionMsg) - DisplayHelpTextFromStringLabel(0, 0, 1, -1) - - if IsControlJustReleased(0, Keys['E']) and PlayerData.job ~= nil and PlayerData.job.name == 'ambulance' then - - if CurrentAction == 'ambulance_actions_menu' then - OpenAmbulanceActionsMenu() - end - - if CurrentAction == 'vehicle_spawner_menu' then - OpenVehicleSpawnerMenu() - end - - if CurrentAction == 'pharmacy' then - OpenPharmacyMenu() - end - - if CurrentAction == 'fast_travel_goto_top' or CurrentAction == 'fast_travel_goto_bottom' then - FastTravel(CurrentActionData.pos) - end - - if CurrentAction == 'delete_vehicle' then - if Config.EnableSocietyOwnedVehicles then - local vehicleProps = ESX.Game.GetVehicleProperties(CurrentActionData.vehicle) - TriggerServerEvent('esx_society:putVehicleInGarage', 'ambulance', vehicleProps) - end - ESX.Game.DeleteVehicle(CurrentActionData.vehicle) - end - - CurrentAction = nil - - end - - end - - if IsControlJustReleased(0, Keys['F6']) and PlayerData.job ~= nil and PlayerData.job.name == 'ambulance' and not IsDead then - OpenMobileAmbulanceActionsMenu() - end - - end -end) RegisterNetEvent('esx_ambulancejob:requestDeath') AddEventHandler('esx_ambulancejob:requestDeath', function() diff --git a/locales/sv.lua b/locales/sv.lua index 6e08adbd..18770e4b 100644 --- a/locales/sv.lua +++ b/locales/sv.lua @@ -11,9 +11,9 @@ Locales['sv'] = { ['helicopter'] = 'helikopter', -- Action Menu ['hospital'] = 'sjukhus', - ['revive_inprogress'] = 'återupplivning pågår . . .', + ['revive_inprogress'] = 'en återupplivning har börjats', ['revive_complete'] = 'du har återupplivat ~y~%s~s~, bra jobbat!', - ['revive_complete_award'] = 'du har återupplivat ~y~%s~s~ och tjärnat ~g~%s SEK~s~ i processen, bra jobbat!', + ['revive_complete_award'] = 'du har återupplivat ~y~%s~s~ och tjärnat ~g~%s SEK~s~ för dina tjänster, bra jobbat!', ['heal_inprogress'] = 'du behandlar patienten!', ['heal_complete'] = 'du har behandlat ~y~%s~s~', ['no_players'] = 'det finns inga spelare i närheten!', diff --git a/server/main.lua b/server/main.lua index 5a2f52f2..2146680c 100644 --- a/server/main.lua +++ b/server/main.lua @@ -16,6 +16,12 @@ AddEventHandler('esx_ambulancejob:heal', function(target, type) TriggerClientEvent('esx_ambulancejob:heal', target, type) end) +RegisterServerEvent('esx_ambulancejob:putInVehicle') +AddEventHandler('esx_ambulancejob:putInVehicle', function(target) + + TriggerClientEvent('esx_ambulancejob:putInVehicle', target) +end) + TriggerEvent('esx_phone:registerNumber', 'ambulance', _U('alert_ambulance'), true, true) TriggerEvent('esx_society:registerSociety', 'ambulance', 'Ambulance', 'society_ambulance', 'society_ambulance', 'society_ambulance', {type = 'public'}) @@ -46,7 +52,7 @@ ESX.RegisterServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function( for i=1, #xPlayer.loadout, 1 do xPlayer.removeWeapon(xPlayer.loadout[i].name) end - else -- save weapons & restore em' since + else -- save weapons & restore em' since spawnmanager removes them for i=1, #xPlayer.loadout, 1 do table.insert(playerLoadout, xPlayer.loadout[i]) end @@ -67,39 +73,35 @@ end) if Config.EarlyRespawn and Config.EarlyRespawnFine then ESX.RegisterServerCallback('esx_ambulancejob:checkBalance', function(source, cb) - local xPlayer = ESX.GetPlayerFromId(source) local bankBalance = xPlayer.getAccount('bank').money - local finePayable = false - if bankBalance >= Config.EarlyRespawnFineAmount then - finePayable = true - else - finePayable = false - end - - cb(finePayable) + cb(bankBalance >= Config.EarlyRespawnFineAmount) end) ESX.RegisterServerCallback('esx_ambulancejob:payFine', function(source, cb) local xPlayer = ESX.GetPlayerFromId(source) TriggerClientEvent('esx:showNotification', xPlayer.source, _U('respawn_fine', Config.EarlyRespawnFineAmount)) xPlayer.removeAccountMoney('bank', Config.EarlyRespawnFineAmount) + cb() end) end ESX.RegisterServerCallback('esx_ambulancejob:getItemAmount', function(source, cb, item) local xPlayer = ESX.GetPlayerFromId(source) - local qtty = xPlayer.getInventoryItem(item).count - cb(qtty) + local quantity = xPlayer.getInventoryItem(item).count + + cb(quantity) end) RegisterServerEvent('esx_ambulancejob:removeItem') AddEventHandler('esx_ambulancejob:removeItem', function(item) local _source = source local xPlayer = ESX.GetPlayerFromId(_source) + xPlayer.removeInventoryItem(item, 1) + if item == 'bandage' then TriggerClientEvent('esx:showNotification', _source, _U('used_bandage')) elseif item == 'medikit' then @@ -108,17 +110,18 @@ AddEventHandler('esx_ambulancejob:removeItem', function(item) end) RegisterServerEvent('esx_ambulancejob:giveItem') -AddEventHandler('esx_ambulancejob:giveItem', function(item) +AddEventHandler('esx_ambulancejob:giveItem', function(itemName) local _source = source local xPlayer = ESX.GetPlayerFromId(_source) - local limit = xPlayer.getInventoryItem(item).limit - local delta = 1 - local qtty = xPlayer.getInventoryItem(item).count - if limit ~= -1 then - delta = limit - qtty + local item = xPlayer.getInventoryItem(itemName) + local count = 1 + + if item.limit ~= -1 then + count = item.limit - item.count end - if qtty < limit then - xPlayer.addInventoryItem(item, delta) + + if item.count < item.limit then + xPlayer.addInventoryItem(itemName, count) else TriggerClientEvent('esx:showNotification', _source, _U('max_item')) end From 9189039cbcbe08b8465705e1c26278f681704888 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Tue, 30 Oct 2018 23:14:41 +0100 Subject: [PATCH 094/177] Removed incomplete translation --- __resource.lua | 2 -- locales/de.lua | 47 ----------------------------------------------- 2 files changed, 49 deletions(-) delete mode 100644 locales/de.lua diff --git a/__resource.lua b/__resource.lua index 2e95ff1e..d44b69fd 100644 --- a/__resource.lua +++ b/__resource.lua @@ -7,7 +7,6 @@ version '1.0.7' server_scripts { '@mysql-async/lib/MySQL.lua', '@es_extended/locale.lua', - 'locales/de.lua', 'locales/br.lua', 'locales/en.lua', 'locales/fi.lua', @@ -21,7 +20,6 @@ server_scripts { client_scripts { '@es_extended/locale.lua', - 'locales/de.lua', 'locales/br.lua', 'locales/en.lua', 'locales/fi.lua', diff --git a/locales/de.lua b/locales/de.lua deleted file mode 100644 index b1671811..00000000 --- a/locales/de.lua +++ /dev/null @@ -1,47 +0,0 @@ -Locales['de'] = { - -- Cloakroom - ['cloakroom'] = 'Umkleide', - ['ems_clothes_civil'] = 'Zivilkleidung', - ['ems_clothes_ems'] = 'Arbeitskleidung', - -- Vehicles - ['veh_menu'] = 'Fahrzeuge', - ['veh_spawn'] = 'Drücke ~INPUT_CONTEXT~ um ein Fahrzeug zu bekommen', - ['store_veh'] = 'Drücke ~INPUT_CONTEXT~ um das Fahrzeug zu parken', - ['ambulance'] = 'Krankenwagen', - ['helicopter'] = 'Helicopter', - -- Action Menu - ['hospital'] = 'Krankenhaus', - ['revive_inprogress'] = 'wiederbeleben im Gange', - ['revive_complete'] = 'du wurdest wiederbelebt ~y~%s~s~', - ['revive_complete_award'] = 'du wurdest wiederbelebt ~y~%s~s~, ~g~$%s~s~', - ['heal_inprogress'] = 'you are healing!', - ['heal_complete'] = 'you have healed ~y~%s~s~', - ['no_players'] = 'keine Spieler in der Nähe', - ['no_vehicles'] = 'keine Fahrzeuge in der Nähe', - ['player_not_unconscious'] = 'ist nicht im Koma', - ['player_not_conscious'] = 'that player is not conscious!', - -- Boss Menu - ['boss_actions'] = 'boss actions', - -- Misc - ['invalid_amount'] = '~r~ungültiger Betrag', - ['open_menu'] = 'Drücke ~INPUT_CONTEXT~ um das Menü zu öffnen', - ['deposit_amount'] = 'Betrag zum einzahlen', - ['money_withdraw'] = 'Betrag zum abheben', - -- F6 Menu - ['ems_menu'] = 'Notdienst - Menü', - ['ems_menu_title'] = 'Notdienst - Menü', - ['ems_menu_revive'] = 'Spieler wiederbeleben', - ['ems_menu_putincar'] = 'in Fahrzeug setzen', - -- Phone - ['alert_ambulance'] = 'Notdienst anrufen', - -- Death - ['please_wait'] = 'you will bleed out in ~b~%s minutes %s seconds~s~\n', - ['press_respawn'] = 'press [~b~E~w~] to respawn.', - ['respawn_now_fine'] = 'respawn now for ~g~$%s ~w~[Press ~b~E~w~]', - ['respawn_fine'] = 'you paid ~r~$%s~s~ to respawn.', - ['distress_send'] = 'press [~b~G~s~] to send distress signal', - ['distress_sent'] = 'distress signal has been sent to available units!', - ['distress_message'] = 'medical attention required: unconscious citizen!', - -- Revive - ['revive_help'] = 'Spieler wiederbeleben', -} From 8f18c991b8f5714d9849018295506e11348373f8 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Tue, 30 Oct 2018 23:22:58 +0100 Subject: [PATCH 095/177] Death screen update, see description The system has been changed, so that you will first enter a 'respawn available in x' timer, then after that a bleedout timer will appear. --- client/main.lua | 167 +++++++++++++++++++++++++++--------------------- config.lua | 29 ++++----- locales/br.lua | 9 +-- locales/en.lua | 17 ++--- locales/es.lua | 24 +++++-- locales/fi.lua | 10 +-- locales/fr.lua | 10 +-- locales/pl.lua | 10 +-- locales/sv.lua | 10 +-- server/main.lua | 11 ++-- 10 files changed, 166 insertions(+), 131 deletions(-) diff --git a/client/main.lua b/client/main.lua index 169d5697..ef30436a 100644 --- a/client/main.lua +++ b/client/main.lua @@ -52,11 +52,7 @@ function OnPlayerDeath() IsDead = true TriggerServerEvent('esx_ambulancejob:setDeathStatus', 1) - if Config.ShowDeathTimer == true then - ShowDeathTimer() - end - - StartRespawnTimer() + StartDeathTimer() StartDistressSignal() ClearPedTasksImmediately(PlayerPedId()) @@ -65,7 +61,7 @@ end function StartDistressSignal() Citizen.CreateThread(function() - local timer = Config.RespawnDelayAfterRPDeath + local timer = Config.BleedoutTimer while timer > 0 and IsDead do Citizen.Wait(2) @@ -103,74 +99,113 @@ function SendDistressSignal() }) end -function ShowDeathTimer() - local respawnTimer = Config.RespawnDelayAfterRPDeath - local allowRespawn = Config.RespawnDelayAfterRPDeath/2 - local fineAmount = Config.EarlyRespawnFineAmount - local payFine = false +function DrawGenericTextThisFrame() + SetTextFont(4) + SetTextProportional(0) + SetTextScale(0.0, 0.5) + SetTextColour(255, 255, 255, 255) + SetTextDropshadow(0, 0, 0, 0, 255) + SetTextEdge(1, 0, 0, 0, 255) + SetTextDropShadow() + SetTextOutline() + SetTextCentre(true) +end - if Config.EarlyRespawn and Config.EarlyRespawnFine then - ESX.TriggerServerCallback('esx_ambulancejob:checkBalance', function(finePayable) - if finePayable then - payFine = true - else - payFine = false - end +function secondsToClock(seconds) + local seconds, hours, mins, secs = tonumber(seconds), 0, 0, 0 + + if seconds <= 0 then + return 0, 0 + else + local hours = string.format("%02.f", math.floor(seconds / 3600)) + local mins = string.format("%02.f", math.floor(seconds / 60 - (hours * 60))) + local secs = string.format("%02.f", math.floor(seconds - hours * 3600 - mins * 60)) + + return mins, secs + end +end + +function StartDeathTimer() + local canPayFine = false + + if Config.EarlyRespawnFine then + ESX.TriggerServerCallback('esx_ambulancejob:checkBalance', function(canPay) + canPayFine = canPay end) end + local earlySpawnTimer = ESX.Round(Config.EarlyRespawnTimer / 1000) + local bleedoutTimer = ESX.Round(Config.BleedoutTimer / 1000) + Citizen.CreateThread(function() - while respawnTimer > 0 and IsDead do - Citizen.Wait(0) + -- early respawn timer + while earlySpawnTimer > 0 and IsDead do + Citizen.Wait(1000) - raw_seconds = respawnTimer/1000 - raw_minutes = raw_seconds/60 - minutes = stringsplit(raw_minutes, ".")[1] - seconds = stringsplit(raw_seconds-(minutes*60), ".")[1] - - SetTextFont(4) - SetTextProportional(0) - SetTextScale(0.0, 0.5) - SetTextColour(255, 255, 255, 255) - SetTextDropshadow(0, 0, 0, 0, 255) - SetTextEdge(1, 0, 0, 0, 255) - SetTextDropShadow() - SetTextOutline() - - local text = _U('please_wait', minutes, seconds) - - if Config.EarlyRespawn then - if not Config.EarlyRespawnFine and respawnTimer <= allowRespawn then - text = text .. _U('press_respawn') - elseif Config.EarlyRespawnFine and respawnTimer <= allowRespawn and payFine then - text = text .. _U('respawn_now_fine', fineAmount) - else - text = text - end + if earlySpawnTimer > 0 then + earlySpawnTimer = earlySpawnTimer - 1 end + end + + -- bleedout timer + while bleedoutTimer > 0 and IsDead do + Citizen.Wait(1000) + + if bleedoutTimer > 0 then + bleedoutTimer = bleedoutTimer - 1 + end + end + end) + + Citizen.CreateThread(function() + local text, timeHeld + + -- early respawn timer + while earlySpawnTimer > 0 and IsDead do + Citizen.Wait(0) + text = _U('respawn_available_in', secondsToClock(earlySpawnTimer)) + + DrawGenericTextThisFrame() - SetTextCentre(true) SetTextEntry("STRING") AddTextComponentString(text) DrawText(0.5, 0.8) + end - if Config.EarlyRespawn then - if not Config.EarlyRespawnFine then - if IsControlPressed(0, Keys['E']) then - RemoveItemsAfterRPDeath() - break - end - elseif Config.EarlyRespawnFine then - if respawnTimer <= allowRespawn and payFine then - if IsControlPressed(0, Keys['E']) then - PayFine() - break - end - end + -- bleedout timer + while bleedoutTimer > 0 and IsDead do + Citizen.Wait(0) + text = _U('respawn_bleedout_in', secondsToClock(bleedoutTimer)) + + if not Config.EarlyRespawnFine then + text = text .. _U('respawn_bleedout_prompt') + + if IsControlPressed(0, Keys['E']) and timeHeld > 60 then + break + end + elseif Config.EarlyRespawnFine and canPayFine then + text = text .. _U('respawn_bleedout_fine', ESX.Math.GroupDigits(Config.EarlyRespawnFineAmount)) + + if IsControlPressed(0, Keys['E']) and timeHeld > 60 then + TriggerServerEvent('esx_ambulancejob:payFine') + break end end - respawnTimer = respawnTimer - 15 + + if IsControlPressed(0, Keys['E']) then + timeHeld = timeHeld + 1 + else + timeHeld = 0 + end + + DrawGenericTextThisFrame() + + SetTextEntry("STRING") + AddTextComponentString(text) + DrawText(0.5, 0.8) end + + RemoveItemsAfterRPDeath() end) end @@ -196,12 +231,6 @@ function RemoveItemsAfterRPDeath() end) end -function PayFine() - ESX.TriggerServerCallback('esx_ambulancejob:payFine', function() - RemoveItemsAfterRPDeath() - end) -end - function RespawnPed(ped, coords) SetEntityCoordsNoOffset(ped, coords.x, coords.y, coords.z, false, false, false, true) NetworkResurrectLocalPlayer(coords.x, coords.y, coords.z, coords.heading, true, false) @@ -212,14 +241,6 @@ function RespawnPed(ped, coords) ESX.UI.Menu.CloseAll() end -function StartRespawnTimer() - Citizen.SetTimeout(Config.RespawnDelayAfterRPDeath, function() - if IsDead then - RemoveItemsAfterRPDeath() - end - end) -end - function TeleportFadeEffect(entity, coords) Citizen.CreateThread(function() DoScreenFadeOut(800) diff --git a/config.lua b/config.lua index 313ac88a..9b71a678 100644 --- a/config.lua +++ b/config.lua @@ -11,31 +11,26 @@ Config.Locale = 'fr' local second = 1000 local minute = 60 * second --- How much time before auto respawn at hospital -Config.RespawnDelayAfterRPDeath = 10 * minute +Config.EarlyRespawnTimer = 2 * minute -- Time til respawn is available +Config.BleedoutTimer = 10 * minute -- Time til the player bleeds out -Config.EnablePlayerManagement = false -Config.EnableSocietyOwnedVehicles = false +Config.EnablePlayerManagement = false +Config.EnableSocietyOwnedVehicles = false -Config.RemoveWeaponsAfterRPDeath = true -Config.RemoveCashAfterRPDeath = true -Config.RemoveItemsAfterRPDeath = true +Config.RemoveWeaponsAfterRPDeath = true +Config.RemoveCashAfterRPDeath = true +Config.RemoveItemsAfterRPDeath = true --- Will display a timer that shows RespawnDelayAfterRPDeath as a countdown -Config.ShowDeathTimer = true - --- Will allow respawn after half of RespawnDelayAfterRPDeath has elapsed. -Config.EarlyRespawn = false --- The player will be fined for respawning early (on bank account) -Config.EarlyRespawnFine = false -Config.EarlyRespawnFineAmount = 500 +-- Let the player pay for respawning early, if he can afford it. +Config.EarlyRespawnFine = false +Config.EarlyRespawnFineAmount = 5000 Config.Blip = { Pos = { x = 307.76, y = -1433.47, z = 28.97 }, Sprite = 61, Display = 4, Scale = 1.2, - Colour = 2, + Colour = 2 } Config.HelicopterSpawner = { @@ -43,7 +38,7 @@ Config.HelicopterSpawner = { Heading = 0.0 } --- https://wiki.fivem.net/wiki/Vehicles +-- https://wiki.rage.mp/index.php?title=Vehicles Config.AuthorizedVehicles = { { diff --git a/locales/br.lua b/locales/br.lua index 9f7e1114..aada55b4 100644 --- a/locales/br.lua +++ b/locales/br.lua @@ -44,10 +44,11 @@ Locales['br'] = { -- Phone ['alert_ambulance'] = 'Alerta Socorro', -- Death - ['please_wait'] = 'you will bleed out in ~b~%s minutes %s seconds~s~\n', - ['press_respawn'] = 'press [~b~E~w~] to respawn.', - ['respawn_now_fine'] = 'respawn now for ~g~$%s ~w~[Press ~b~E~w~]', - ['respawn_fine'] = 'you paid ~r~$%s~s~ to respawn.', + ['respawn_available_in'] = 'respawn available in ~b~%s minutes %s seconds~s~', + ['respawn_bleedout_in'] = 'you will bleed out in ~b~%s minutes %s seconds~s~\n', + ['respawn_bleedout_prompt'] = 'hold [~b~E~s~] to respawn', + ['respawn_bleedout_fine'] = 'hold [~b~E~s~] to respawn for ~g~$%s~s~', + ['respawn_bleedout_fine_msg'] = 'you paid ~r~$%s~s~ to respawn.', ['distress_send'] = 'press [~b~G~s~] to send distress signal', ['distress_sent'] = 'distress signal has been sent to available units!', ['distress_message'] = 'medical attention required: unconscious citizen!', diff --git a/locales/en.lua b/locales/en.lua index 9b7a1f92..8bef3b95 100644 --- a/locales/en.lua +++ b/locales/en.lua @@ -2,7 +2,7 @@ Locales['en'] = { -- Cloakroom ['cloakroom'] = 'locker Room', ['ems_clothes_civil'] = 'civilian Clothes', - ['ems_clothes_ems'] = 'eMS Clothes', + ['ems_clothes_ems'] = 'EMS Clothes', -- Vehicles ['veh_menu'] = 'vehicle', ['veh_spawn'] = 'press ~INPUT_CONTEXT~ to get a Vehicle or Helicopter', @@ -35,7 +35,7 @@ Locales['en'] = { ['bandage'] = 'bandage', ['max_item'] = 'You are already carrying enough on yourself.', -- F6 Menu - ['ems_menu'] = 'eMS Menu', + ['ems_menu'] = 'EMS Menu', ['ems_menu_title'] = 'ambulance - EMS Menu', ['ems_menu_revive'] = 'revive Player', ['ems_menu_putincar'] = 'put in Vehicle', @@ -44,10 +44,11 @@ Locales['en'] = { -- Phone ['alert_ambulance'] = 'alert Ambulance', -- Death - ['please_wait'] = 'you will bleed out in ~b~%s minutes %s seconds~s~\n', - ['press_respawn'] = 'press [~b~E~w~] to respawn.', - ['respawn_now_fine'] = 'respawn now for ~g~$%s ~w~[Press ~b~E~w~]', - ['respawn_fine'] = 'you paid ~r~$%s~s~ to respawn.', + ['respawn_available_in'] = 'respawn available in ~b~%s minutes %s seconds~s~', + ['respawn_bleedout_in'] = 'you will bleed out in ~b~%s minutes %s seconds~s~\n', + ['respawn_bleedout_prompt'] = 'hold [~b~E~s~] to respawn', + ['respawn_bleedout_fine'] = 'hold [~b~E~s~] to respawn for ~g~$%s~s~', + ['respawn_bleedout_fine_msg'] = 'you paid ~r~$%s~s~ to respawn.', ['distress_send'] = 'press [~b~G~s~] to send distress signal', ['distress_sent'] = 'distress signal has been sent to available units!', ['distress_message'] = 'medical attention required: unconscious citizen!', @@ -56,7 +57,7 @@ Locales['en'] = { -- Item ['used_medikit'] = 'You have used ~y~1x~s~ medikit', ['used_bandage'] = 'You have used ~y~1x~s~ bandage', - ['not_enough_medikit'] = 'You do not have ~b~medikit~w~.', - ['not_enough_bandage'] = 'You do not have ~b~bandage~w~.', + ['not_enough_medikit'] = 'You do not have ~b~medikit~s~.', + ['not_enough_bandage'] = 'You do not have ~b~bandage~s~.', ['healed'] = 'you have been treated.', } diff --git a/locales/es.lua b/locales/es.lua index 47f009c9..00f3a7ef 100644 --- a/locales/es.lua +++ b/locales/es.lua @@ -27,21 +27,37 @@ Locales['es'] = { ['open_menu'] = 'Presione ~INPUT_CONTEXT~ para abrir el menú', ['deposit_amount'] = 'cantidad de fianza depositada', ['money_withdraw'] = 'cantidad de fianza retirada', + ['fast_travel'] = 'Press on ~INPUT_CONTEXT~ to fast travel.', + ['open_pharmacy'] = 'Press on ~INPUT_CONTEXT~ to open the pharmacy.', + ['pharmacy_menu_title'] = 'Pharmacy', + ['pharmacy_take'] = 'Take', + ['medikit'] = 'medikit', + ['bandage'] = 'bandage', + ['max_item'] = 'You are already carrying enough on yourself.', -- F6 Menu ['ems_menu'] = 'ayuda ciudadana', ['ems_menu_title'] = 'ambulancia - Ayuda Ciudadana', ['ems_menu_revive'] = 'reanimar', ['ems_menu_putincar'] = 'meter en el vehículo', + ['ems_menu_small'] = 'heal small wounds', + ['ems_menu_big'] = 'treat serious injuries', -- Phone ['alert_ambulance'] = 'Alerta de ambulancia', -- Death - ['please_wait'] = 'you will bleed out in ~b~%s minutes %s seconds~s~\n', - ['press_respawn'] = 'press [~b~E~w~] to respawn.', - ['respawn_now_fine'] = 'respawn now for ~g~$%s ~w~[Press ~b~E~w~]', - ['respawn_fine'] = 'you paid ~r~$%s~s~ to respawn.', + ['respawn_available_in'] = 'respawn available in ~b~%s minutes %s seconds~s~', + ['respawn_bleedout_in'] = 'you will bleed out in ~b~%s minutes %s seconds~s~\n', + ['respawn_bleedout_prompt'] = 'hold [~b~E~s~] to respawn', + ['respawn_bleedout_fine'] = 'hold [~b~E~s~] to respawn for ~g~$%s~s~', + ['respawn_bleedout_fine_msg'] = 'you paid ~r~$%s~s~ to respawn.', ['distress_send'] = 'press [~b~G~s~] to send distress signal', ['distress_sent'] = 'distress signal has been sent to available units!', ['distress_message'] = 'medical attention required: unconscious citizen!', -- Revive ['revive_help'] = 'reviver un jugador', + -- Item + ['used_medikit'] = 'You have used ~y~1x~s~ medikit', + ['used_bandage'] = 'You have used ~y~1x~s~ bandage', + ['not_enough_medikit'] = 'You do not have ~b~medikit~s~.', + ['not_enough_bandage'] = 'You do not have ~b~bandage~s~.', + ['healed'] = 'you have been treated.', } diff --git a/locales/fi.lua b/locales/fi.lua index 4c34e898..d51ba970 100644 --- a/locales/fi.lua +++ b/locales/fi.lua @@ -44,10 +44,11 @@ Locales['fi'] = { -- Phone ['alert_ambulance'] = 'hälyytys Ensihoidolle', -- Death - ['please_wait'] = 'you will bleed out in ~b~%s minutes %s seconds~s~\n', - ['press_respawn'] = 'press [~b~E~w~] to respawn.', - ['respawn_now_fine'] = 'respawn now for ~g~$%s ~w~[Press ~b~E~w~]', - ['respawn_fine'] = 'you paid ~r~$%s~s~ to respawn.', + ['respawn_available_in'] = 'respawn available in ~b~%s minutes %s seconds~s~', + ['respawn_bleedout_in'] = 'you will bleed out in ~b~%s minutes %s seconds~s~\n', + ['respawn_bleedout_prompt'] = 'hold [~b~E~s~] to respawn', + ['respawn_bleedout_fine'] = 'hold [~b~E~s~] to respawn for ~g~$%s~s~', + ['respawn_bleedout_fine_msg'] = 'you paid ~r~$%s~s~ to respawn.', ['distress_send'] = 'press [~b~G~s~] to send distress signal', ['distress_sent'] = 'distress signal has been sent to available units!', ['distress_message'] = 'medical attention required: unconscious citizen!', @@ -59,5 +60,4 @@ Locales['fi'] = { ['not_enough_medikit'] = 'ei tarpeeksi ~b~ensiapupakkauksia~w~.', ['not_enough_bandage'] = 'ei tarpeeksi ~b~sideharsoja~w~.', ['healed'] = 'sinua parannettiin', - -- Misc } diff --git a/locales/fr.lua b/locales/fr.lua index 2e94632c..3664d892 100644 --- a/locales/fr.lua +++ b/locales/fr.lua @@ -44,10 +44,11 @@ Locales['fr'] = { -- Phone ['alert_ambulance'] = 'alerte Ambulance', -- Death - ['please_wait'] = 'you will bleed out in ~b~%s minutes %s seconds~s~\n', - ['press_respawn'] = 'press [~b~E~w~] to respawn.', - ['respawn_now_fine'] = 'respawn now for ~g~$%s ~w~[Press ~b~E~w~]', - ['respawn_fine'] = 'you paid ~r~$%s~s~ to respawn.', + ['respawn_available_in'] = 'respawn available in ~b~%s minutes %s seconds~s~', + ['respawn_bleedout_in'] = 'you will bleed out in ~b~%s minutes %s seconds~s~\n', + ['respawn_bleedout_prompt'] = 'hold [~b~E~s~] to respawn', + ['respawn_bleedout_fine'] = 'hold [~b~E~s~] to respawn for ~g~$%s~s~', + ['respawn_bleedout_fine_msg'] = 'you paid ~r~$%s~s~ to respawn.', ['distress_send'] = 'press [~b~G~s~] to send distress signal', ['distress_sent'] = 'distress signal has been sent to available units!', ['distress_message'] = 'medical attention required: unconscious citizen!', @@ -59,5 +60,4 @@ Locales['fr'] = { ['not_enough_medikit'] = 'vous n\'avez pas de ~b~kit de soin~w~.', ['not_enough_bandage'] = 'vous n\'avez pas de ~b~bandage~w~.', ['healed'] = 'vous avez été soigné.', - -- Misc } diff --git a/locales/pl.lua b/locales/pl.lua index c6e299b7..1d2a0931 100644 --- a/locales/pl.lua +++ b/locales/pl.lua @@ -44,10 +44,11 @@ Locales['pl'] = { -- Phone ['alert_ambulance'] = 'wezwij ambulans', -- Death - ['please_wait'] = 'you will bleed out in ~b~%s minutes %s seconds~s~\n', - ['press_respawn'] = 'press [~b~E~w~] to respawn.', - ['respawn_now_fine'] = 'respawn now for ~g~$%s ~w~[Press ~b~E~w~]', - ['respawn_fine'] = 'you paid ~r~$%s~s~ to respawn.', + ['respawn_available_in'] = 'respawn available in ~b~%s minutes %s seconds~s~', + ['respawn_bleedout_in'] = 'you will bleed out in ~b~%s minutes %s seconds~s~\n', + ['respawn_bleedout_prompt'] = 'hold [~b~E~s~] to respawn', + ['respawn_bleedout_fine'] = 'hold [~b~E~s~] to respawn for ~g~$%s~s~', + ['respawn_bleedout_fine_msg'] = 'you paid ~r~$%s~s~ to respawn.', ['distress_send'] = 'press [~b~G~s~] to send distress signal', ['distress_sent'] = 'distress signal has been sent to available units!', ['distress_message'] = 'medical attention required: unconscious citizen!', @@ -59,5 +60,4 @@ Locales['pl'] = { ['not_enough_medikit'] = 'nie posiadasz ~b~apteczki~w~.', ['not_enough_bandage'] = 'nie posiadasz ~b~bandaża~w~.', ['healed'] = 'zostałeś potraktowany', - -- Misc } diff --git a/locales/sv.lua b/locales/sv.lua index 18770e4b..72fb6b05 100644 --- a/locales/sv.lua +++ b/locales/sv.lua @@ -44,10 +44,11 @@ Locales['sv'] = { -- Phone ['alert_ambulance'] = 'ambulanssamtal', -- Death - ['please_wait'] = 'du är medvetslös och kommer att dö om ~b~%s minuter och %s sekunder~s~\n', - ['press_respawn'] = 'tryck [~b~E~s~] för att respawna.', - ['respawn_now_fine'] = 'respawna nu för ~g~%s SEK~s~ [Tryck ~b~E~s~]', - ['respawn_fine'] = 'du betalade ~r~%s SEK~s~ för att respawna.', + ['respawn_available_in'] = 'respawn tillgänglig om ~b~%s:%s~s~', + ['respawn_bleedout_in'] = 'du kommer att blöda ut om ~b~%s:%s~s~\n', + ['respawn_bleedout_prompt'] = 'håll [~b~E~s~] för att respawna', + ['respawn_bleedout_fine'] = 'håll [~b~E~s~] för att respawna, kostar ~g~$%s~s~', + ['respawn_bleedout_fine_msg'] = 'du betalade ~r~%s SEK~s~ för att respawna.', ['distress_send'] = 'tryck ~b~[G]~s~ för att skicka nödsignal', ['distress_sent'] = 'nödsignal har skickats till samtliga enheter!', ['distress_message'] = 'läkarvård krävs: medvetslös medborgare!', @@ -59,5 +60,4 @@ Locales['sv'] = { ['not_enough_medikit'] = 'du har inget ~b~Medecinkit~s~.', ['not_enough_bandage'] = 'du har inget ~b~Bandage~s~.', ['healed'] = 'dina skador har blivit behandlade.', - -- Misc } diff --git a/server/main.lua b/server/main.lua index 2146680c..76604682 100644 --- a/server/main.lua +++ b/server/main.lua @@ -71,7 +71,7 @@ ESX.RegisterServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function( cb() end) -if Config.EarlyRespawn and Config.EarlyRespawnFine then +if Config.EarlyRespawnFine then ESX.RegisterServerCallback('esx_ambulancejob:checkBalance', function(source, cb) local xPlayer = ESX.GetPlayerFromId(source) local bankBalance = xPlayer.getAccount('bank').money @@ -79,12 +79,13 @@ if Config.EarlyRespawn and Config.EarlyRespawnFine then cb(bankBalance >= Config.EarlyRespawnFineAmount) end) - ESX.RegisterServerCallback('esx_ambulancejob:payFine', function(source, cb) + RegisterServerEvent('esx_ambulancejob:payFine') + AddEventHandler('esx_ambulancejob:payFine', function() local xPlayer = ESX.GetPlayerFromId(source) - TriggerClientEvent('esx:showNotification', xPlayer.source, _U('respawn_fine', Config.EarlyRespawnFineAmount)) - xPlayer.removeAccountMoney('bank', Config.EarlyRespawnFineAmount) + local fineAmount = Config.EarlyRespawnFineAmount - cb() + TriggerClientEvent('esx:showNotification', xPlayer.source, _U('respawn_bleedout_fine_msg', ESX.Math.GroupDigits(fineAmount))) + xPlayer.removeAccountMoney('bank', fineAmount) end) end From c2b1c1de8ba9e816682990cfa912d120ace0343a Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Tue, 30 Oct 2018 23:33:32 +0100 Subject: [PATCH 096/177] Enforce 4 tab indent, final commit v1.1.0 --- __resource.lua | 2 +- esx_ambulancejob.sql | 22 +++++++++++----------- localization/de_esx_ambulancejob.sql | 22 +++++++++++----------- localization/en_esx_ambulancejob.sql | 23 +++++++++++------------ localization/fi_esx_ambulancejob.sql | 15 +++++++-------- localization/pl_esx_ambulancejob.sql | 23 +++++++++++------------ 6 files changed, 52 insertions(+), 55 deletions(-) diff --git a/__resource.lua b/__resource.lua index d44b69fd..fc60045b 100644 --- a/__resource.lua +++ b/__resource.lua @@ -2,7 +2,7 @@ resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937' description 'ESX Ambulance Job' -version '1.0.7' +version '1.1.0' server_scripts { '@mysql-async/lib/MySQL.lua', diff --git a/esx_ambulancejob.sql b/esx_ambulancejob.sql index a2aa8fa9..ddb05e02 100644 --- a/esx_ambulancejob.sql +++ b/esx_ambulancejob.sql @@ -1,31 +1,31 @@ USE `essentialmode`; INSERT INTO `addon_account` (name, label, shared) VALUES - ('society_ambulance', 'Ambulance', 1) + ('society_ambulance', 'Ambulance', 1) ; INSERT INTO `addon_inventory` (name, label, shared) VALUES - ('society_ambulance', 'Ambulance', 1) + ('society_ambulance', 'Ambulance', 1) ; INSERT INTO `datastore` (name, label, shared) VALUES - ('society_ambulance', 'Ambulance', 1) + ('society_ambulance', 'Ambulance', 1) ; INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_female) VALUES - ('ambulance',0,'ambulance','Ambulancier',20,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), - ('ambulance',1,'doctor','Medecin',40,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), - ('ambulance',2,'chief_doctor','Medecin-chef',60,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), - ('ambulance',3,'boss','Chirurgien',80,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}') + ('ambulance',0,'ambulance','Ambulancier',20,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), + ('ambulance',1,'doctor','Medecin',40,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), + ('ambulance',2,'chief_doctor','Medecin-chef',60,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), + ('ambulance',3,'boss','Chirurgien',80,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}') ; INSERT INTO `jobs` (name, label) VALUES - ('ambulance','Ambulance') + ('ambulance','Ambulance') ; INSERT INTO `items` (name, label, `limit`) VALUES - ('bandage','Bandage', 20), - ('medikit','Medikit', 5) + ('bandage','Bandage', 20), + ('medikit','Medikit', 5) ; -ALTER TABLE `users` ADD `isDead` BIT(1) DEFAULT b'0' \ No newline at end of file +ALTER TABLE `users` ADD `isDead` BIT(1) DEFAULT b'0' diff --git a/localization/de_esx_ambulancejob.sql b/localization/de_esx_ambulancejob.sql index fc1a52af..d11f2575 100644 --- a/localization/de_esx_ambulancejob.sql +++ b/localization/de_esx_ambulancejob.sql @@ -1,31 +1,31 @@ USE `essentialmode`; INSERT INTO `addon_account` (name, label, shared) VALUES - ('society_ambulance', 'Notdienst', 1) + ('society_ambulance', 'Notdienst', 1) ; INSERT INTO `addon_inventory` (name, label, shared) VALUES - ('society_ambulance', 'Ambulance', 1) + ('society_ambulance', 'Ambulance', 1) ; INSERT INTO `datastore` (name, label, shared) VALUES - ('society_ambulance', 'Ambulance', 1) + ('society_ambulance', 'Ambulance', 1) ; INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_female) VALUES - ('ambulance',0,'ambulance','Sanitäter',20,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), - ('ambulance',1,'doctor','Arzt',40,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), - ('ambulance',2,'chief_doctor','Chefarzt',60,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), - ('ambulance',3,'boss','Chirurg',80,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}') + ('ambulance',0,'ambulance','Sanitäter',20,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), + ('ambulance',1,'doctor','Arzt',40,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), + ('ambulance',2,'chief_doctor','Chefarzt',60,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), + ('ambulance',3,'boss','Chirurg',80,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}') ; INSERT INTO `jobs` (name, label) VALUES - ('ambulance','Notdienst') + ('ambulance','Notdienst') ; INSERT INTO `items` (name, label, `limit`) VALUES - ('bandage','Bandage', 20), - ('medikit','Medikit', 5) + ('bandage','Bandage', 20), + ('medikit','Medikit', 5) ; -ALTER TABLE `users` ADD `isDead` BIT(1) DEFAULT b'0' \ No newline at end of file +ALTER TABLE `users` ADD `isDead` BIT(1) DEFAULT b'0' diff --git a/localization/en_esx_ambulancejob.sql b/localization/en_esx_ambulancejob.sql index 8ba7a87a..cbe37090 100644 --- a/localization/en_esx_ambulancejob.sql +++ b/localization/en_esx_ambulancejob.sql @@ -1,32 +1,31 @@ USE `essentialmode`; INSERT INTO `addon_account` (name, label, shared) VALUES - ('society_ambulance', 'EMS', 1) + ('society_ambulance', 'EMS', 1) ; INSERT INTO `addon_inventory` (name, label, shared) VALUES - ('society_ambulance', 'EMS', 1) + ('society_ambulance', 'EMS', 1) ; INSERT INTO `datastore` (name, label, shared) VALUES - ('society_ambulance', 'EMS', 1) + ('society_ambulance', 'EMS', 1) ; - INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_female) VALUES - ('ambulance',0,'ambulance','Jr. EMT',20,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), - ('ambulance',1,'doctor','EMT',40,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), - ('ambulance',2,'chief_doctor','Sr. EMT',60,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), - ('ambulance',3,'boss','EMT Supervisor',80,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}') + ('ambulance',0,'ambulance','Jr. EMT',20,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), + ('ambulance',1,'doctor','EMT',40,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), + ('ambulance',2,'chief_doctor','Sr. EMT',60,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), + ('ambulance',3,'boss','EMT Supervisor',80,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}') ; INSERT INTO `jobs` (name, label) VALUES - ('ambulance','EMS') + ('ambulance','EMS') ; INSERT INTO `items` (name, label, `limit`) VALUES - ('bandage','Bandage', 20), - ('medikit','Medikit', 5) + ('bandage','Bandage', 20), + ('medikit','Medikit', 5) ; -ALTER TABLE `users` ADD `isDead` BIT(1) DEFAULT b'0' \ No newline at end of file +ALTER TABLE `users` ADD `isDead` BIT(1) DEFAULT b'0' diff --git a/localization/fi_esx_ambulancejob.sql b/localization/fi_esx_ambulancejob.sql index 4e6be961..3ea64c07 100644 --- a/localization/fi_esx_ambulancejob.sql +++ b/localization/fi_esx_ambulancejob.sql @@ -1,18 +1,17 @@ USE `essentialmode`; INSERT INTO `addon_account` (name, label, shared) VALUES - ('society_ambulance', 'Ensihoito', 1) + ('society_ambulance', 'Ensihoito', 1) ; INSERT INTO `addon_inventory` (name, label, shared) VALUES - ('society_ambulance', 'Ensihoito', 1) + ('society_ambulance', 'Ensihoito', 1) ; INSERT INTO `datastore` (name, label, shared) VALUES - ('society_ambulance', 'Ensihoito', 1) + ('society_ambulance', 'Ensihoito', 1) ; - INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_female) VALUES ('ambulance',0,'ambulance','Ensihoitaja',20,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), ('ambulance',1,'doctor','Lääkäri',40,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), @@ -21,12 +20,12 @@ INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_ ; INSERT INTO `jobs` (name, label) VALUES - ('ambulance','Ensihoito') + ('ambulance','Ensihoito') ; INSERT INTO `items` (name, label, `limit`) VALUES - ('bandage','Sideharso', 20), - ('medikit','Ensiapupakkaus', 5) + ('bandage','Sideharso', 20), + ('medikit','Ensiapupakkaus', 5) ; -ALTER TABLE `users` ADD `isDead` BIT(1) DEFAULT b'0' \ No newline at end of file +ALTER TABLE `users` ADD `isDead` BIT(1) DEFAULT b'0' diff --git a/localization/pl_esx_ambulancejob.sql b/localization/pl_esx_ambulancejob.sql index abbad63c..a9035d79 100644 --- a/localization/pl_esx_ambulancejob.sql +++ b/localization/pl_esx_ambulancejob.sql @@ -1,32 +1,31 @@ USE `essentialmode`; INSERT INTO `addon_account` (name, label, shared) VALUES - ('society_ambulance', 'Ambulance', 1) + ('society_ambulance', 'Ambulance', 1) ; INSERT INTO `addon_inventory` (name, label, shared) VALUES - ('society_ambulance', 'Ambulance', 1) + ('society_ambulance', 'Ambulance', 1) ; INSERT INTO `datastore` (name, label, shared) VALUES - ('society_ambulance', 'Pogotowie ratunkowe', 1) + ('society_ambulance', 'Pogotowie ratunkowe', 1) ; - INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_female) VALUES - ('ambulance',0,'ambulance','Ratownik',20,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), - ('ambulance',1,'doctor','Lekarz',40,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), - ('ambulance',2,'chief_doctor','Chirurg',60,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), - ('ambulance',3,'boss','Ordynator',80,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}') + ('ambulance',0,'ambulance','Ratownik',20,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), + ('ambulance',1,'doctor','Lekarz',40,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), + ('ambulance',2,'chief_doctor','Chirurg',60,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), + ('ambulance',3,'boss','Ordynator',80,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}') ; INSERT INTO `jobs` (name, label) VALUES - ('ambulance','Pogotowie ratunkowe') + ('ambulance','Pogotowie ratunkowe') ; INSERT INTO `items` (name, label, `limit`) VALUES - ('bandage','Bandaż', 20), - ('medikit','Defibrylator', 5) + ('bandage','Bandaż', 20), + ('medikit','Defibrylator', 5) ; -ALTER TABLE `users` ADD `isDead` BIT(1) DEFAULT b'0' \ No newline at end of file +ALTER TABLE `users` ADD `isDead` BIT(1) DEFAULT b'0' From fab5f4d167c1354ae4ea3e14cb0c563ddf24e413 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Tue, 30 Oct 2018 23:58:00 +0100 Subject: [PATCH 097/177] Disable most inputs when dead (unconscious can't speak, right?) --- client/main.lua | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/client/main.lua b/client/main.lua index ef30436a..b3fe27ee 100644 --- a/client/main.lua +++ b/client/main.lua @@ -48,6 +48,22 @@ AddEventHandler('playerSpawned', function() end end) +-- Disable most inputs when dead +Citizen.CreateThread(function() + while true do + Citizen.Wait(0) + + if IsDead then + DisableAllControlActions(0) + EnableControlAction(0, Keys['G'], true) + EnableControlAction(0, Keys['T'], true) + EnableControlAction(0, Keys['E'], true) + else + Citizen.Wait(500) + end + end +end) + function OnPlayerDeath() IsDead = true TriggerServerEvent('esx_ambulancejob:setDeathStatus', 1) @@ -323,16 +339,3 @@ if Config.LoadIpl then RequestIpl('Coroner_Int_on') -- Morgue end) end - --- String string -function stringsplit(inputstr, sep) - if sep == nil then - sep = "%s" - end - local t={} ; i=1 - for str in string.gmatch(inputstr, "([^"..sep.."]+)") do - t[i] = str - i = i + 1 - end - return t -end From 5410bf75e89e69087421b1c279ffbf80e2f3b04e Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Wed, 31 Oct 2018 14:33:05 +0100 Subject: [PATCH 098/177] Secutity improvements, lua executor safe --- client/job.lua | 14 ++++++---- locales/br.lua | 2 +- locales/en.lua | 10 ++++---- locales/es.lua | 6 ++--- locales/fi.lua | 2 +- locales/fr.lua | 2 +- locales/pl.lua | 2 +- locales/sv.lua | 4 +-- server/main.lua | 68 ++++++++++++++++++++++++++++++++----------------- 9 files changed, 68 insertions(+), 42 deletions(-) diff --git a/client/job.lua b/client/job.lua index 80943ecc..529ec5fb 100644 --- a/client/job.lua +++ b/client/job.lua @@ -420,7 +420,10 @@ function OpenVehicleSpawnerMenu() ESX.TriggerServerCallback('esx_society:getVehiclesInGarage', function(vehicles) for i=1, #vehicles, 1 do - table.insert(elements, {label = GetDisplayNameFromVehicleModel(vehicles[i].model) .. ' [' .. vehicles[i].plate .. ']', value = vehicles[i]}) + table.insert(elements, { + label = GetDisplayNameFromVehicleModel(vehicles[i].model) .. ' [' .. vehicles[i].plate .. ']', + value = vehicles[i] + }) end ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'vehicle_spawner', @@ -432,7 +435,7 @@ function OpenVehicleSpawnerMenu() menu.close() local vehicleProps = data.current.value - ESX.Game.SpawnVehicle(vehicleProps.model, Config.Zones.VehicleSpawnPoint.Pos, 270.0, function(vehicle) + ESX.Game.SpawnVehicle(vehicleProps.model, Config.Zones.VehicleSpawnPoint.Pos, 230.0, function(vehicle) ESX.Game.SetVehicleProperties(vehicle, vehicleProps) local playerPed = PlayerPedId() TaskWarpPedIntoVehicle(playerPed, vehicle, -1) @@ -478,13 +481,14 @@ function OpenPharmacyMenu() title = _U('pharmacy_menu_title'), align = 'top-left', elements = { - {label = _U('pharmacy_take') .. ' ' .. _('medikit'), value = 'medikit'}, - {label = _U('pharmacy_take') .. ' ' .. _('bandage'), value = 'bandage'} + {label = _U('pharmacy_take', _U('medikit')), value = 'medikit'}, + {label = _U('pharmacy_take', _U('bandage')), value = 'bandage'} } }, function(data, menu) TriggerServerEvent('esx_ambulancejob:giveItem', data.current.value) end, function(data, menu) menu.close() + CurrentAction = 'pharmacy' CurrentActionMsg = _U('open_pharmacy') CurrentActionData = {} @@ -526,7 +530,7 @@ AddEventHandler('esx_ambulancejob:heal', function(healType) if healType == 'small' then local health = GetEntityHealth(playerPed) - local newHealth = math.min(maxHealth , math.floor(health + maxHealth/8)) + local newHealth = math.min(maxHealth, math.floor(health + maxHealth / 8)) SetEntityHealth(playerPed, newHealth) elseif healType == 'big' then SetEntityHealth(playerPed, maxHealth) diff --git a/locales/br.lua b/locales/br.lua index aada55b4..1e934fcb 100644 --- a/locales/br.lua +++ b/locales/br.lua @@ -30,7 +30,7 @@ Locales['br'] = { ['fast_travel'] = 'Aperte ~INPUT_CONTEXT~ para mover-se rapidamente.', ['open_pharmacy'] = 'Aperte ~INPUT_CONTEXT~ para abrir a farmácia.', ['pharmacy_menu_title'] = 'Farmácia', - ['pharmacy_take'] = 'Tomar', + ['pharmacy_take'] = 'tomar ~y~%s~s~', ['medikit'] = 'Seringa', ['bandage'] = 'Vendagem', ['max_item'] = 'você já carrega o suficiente sobre você.', diff --git a/locales/en.lua b/locales/en.lua index 8bef3b95..17c85a22 100644 --- a/locales/en.lua +++ b/locales/en.lua @@ -27,13 +27,13 @@ Locales['en'] = { ['open_menu'] = 'press ~INPUT_CONTEXT~ to open the menu', ['deposit_amount'] = 'deposit Amount', ['money_withdraw'] = 'amount withdrawn', - ['fast_travel'] = 'Press on ~INPUT_CONTEXT~ to fast travel.', - ['open_pharmacy'] = 'Press on ~INPUT_CONTEXT~ to open the pharmacy.', - ['pharmacy_menu_title'] = 'Pharmacy', - ['pharmacy_take'] = 'Take', + ['fast_travel'] = 'press ~INPUT_CONTEXT~ to fast travel.', + ['open_pharmacy'] = 'press ~INPUT_CONTEXT~ to open the pharmacy.', + ['pharmacy_menu_title'] = 'pharmacy', + ['pharmacy_take'] = 'take ~y~%s~s~', ['medikit'] = 'medikit', ['bandage'] = 'bandage', - ['max_item'] = 'You are already carrying enough on yourself.', + ['max_item'] = 'You are already carrying enough.', -- F6 Menu ['ems_menu'] = 'EMS Menu', ['ems_menu_title'] = 'ambulance - EMS Menu', diff --git a/locales/es.lua b/locales/es.lua index 00f3a7ef..2445a06e 100644 --- a/locales/es.lua +++ b/locales/es.lua @@ -27,10 +27,10 @@ Locales['es'] = { ['open_menu'] = 'Presione ~INPUT_CONTEXT~ para abrir el menú', ['deposit_amount'] = 'cantidad de fianza depositada', ['money_withdraw'] = 'cantidad de fianza retirada', - ['fast_travel'] = 'Press on ~INPUT_CONTEXT~ to fast travel.', - ['open_pharmacy'] = 'Press on ~INPUT_CONTEXT~ to open the pharmacy.', + ['fast_travel'] = 'Press ~INPUT_CONTEXT~ to fast travel.', + ['open_pharmacy'] = 'Press ~INPUT_CONTEXT~ to open the pharmacy.', ['pharmacy_menu_title'] = 'Pharmacy', - ['pharmacy_take'] = 'Take', + ['pharmacy_take'] = 'take ~y~%s~s~', ['medikit'] = 'medikit', ['bandage'] = 'bandage', ['max_item'] = 'You are already carrying enough on yourself.', diff --git a/locales/fi.lua b/locales/fi.lua index d51ba970..59574c21 100644 --- a/locales/fi.lua +++ b/locales/fi.lua @@ -30,7 +30,7 @@ Locales['fi'] = { ['fast_travel'] = 'paina ~INPUT_CONTEXT~ liikkuaksesi nopeasti kerrosten välillä', ['open_pharmacy'] = 'paina ~INPUT_CONTEXT~ avataksesi lääkekaappi', ['pharmacy_menu_title'] = 'lääkekaappi', - ['pharmacy_take'] = 'ota', + ['pharmacy_take'] = 'ota ~y~%s~s~', ['medikit'] = 'ensiapupakkauksia', ['bandage'] = 'sideharsoja', ['max_item'] = 'sinulla on jo tarpeeksi mukana', diff --git a/locales/fr.lua b/locales/fr.lua index 3664d892..1fa2cca3 100644 --- a/locales/fr.lua +++ b/locales/fr.lua @@ -30,7 +30,7 @@ Locales['fr'] = { ['fast_travel'] = 'appuyez sur ~INPUT_CONTEXT~ pour vous déplacer rapidement.', ['open_pharmacy'] = 'appuyez sur ~INPUT_CONTEXT~ pour ouvrir la pharmacie.', ['pharmacy_menu_title'] = 'Pharmacie', - ['pharmacy_take'] = 'Prendre', + ['pharmacy_take'] = 'prendre ~y~%s~s~', ['medikit'] = 'kit de soin', ['bandage'] = 'bandage', ['max_item'] = 'vous en portez déjà assez sur vous.', diff --git a/locales/pl.lua b/locales/pl.lua index 1d2a0931..31b5486a 100644 --- a/locales/pl.lua +++ b/locales/pl.lua @@ -30,7 +30,7 @@ Locales['pl'] = { ['fast_travel'] = 'naciśnij na ~INPUT_CONTEXT~ do szybkiej podróży.', ['open_pharmacy'] = 'naciśnij na ~INPUT_CONTEXT~ aby otworzyć aptekę', ['pharmacy_menu_title'] = 'apteka', - ['pharmacy_take'] = 'weź', + ['pharmacy_take'] = 'weź ~y~%s~s~', ['medikit'] = 'apteczka', ['bandage'] = 'bandaż', ['max_item'] = 'już masz na sobie dość.', diff --git a/locales/sv.lua b/locales/sv.lua index 72fb6b05..ae3f4a04 100644 --- a/locales/sv.lua +++ b/locales/sv.lua @@ -30,7 +30,7 @@ Locales['sv'] = { ['fast_travel'] = 'tryck på ~INPUT_CONTEXT~ för att snabbresa.', ['open_pharmacy'] = 'tryck på ~INPUT_CONTEXT~ för att öppna apoteket.', ['pharmacy_menu_title'] = 'apotek', - ['pharmacy_take'] = 'ta', + ['pharmacy_take'] = 'ta ~y~%s~s~', ['medikit'] = 'medicinkit', ['bandage'] = 'bandage', ['max_item'] = 'du har redan tillräckligt mycket på dig.', @@ -47,7 +47,7 @@ Locales['sv'] = { ['respawn_available_in'] = 'respawn tillgänglig om ~b~%s:%s~s~', ['respawn_bleedout_in'] = 'du kommer att blöda ut om ~b~%s:%s~s~\n', ['respawn_bleedout_prompt'] = 'håll [~b~E~s~] för att respawna', - ['respawn_bleedout_fine'] = 'håll [~b~E~s~] för att respawna, kostar ~g~$%s~s~', + ['respawn_bleedout_fine'] = 'håll [~b~E~s~] för att respawna, kostar ~g~%s SEK~s~', ['respawn_bleedout_fine_msg'] = 'du betalade ~r~%s SEK~s~ för att respawna.', ['distress_send'] = 'tryck ~b~[G]~s~ för att skicka nödsignal', ['distress_sent'] = 'nödsignal har skickats till samtliga enheter!', diff --git a/server/main.lua b/server/main.lua index 76604682..4eb51635 100644 --- a/server/main.lua +++ b/server/main.lua @@ -4,22 +4,36 @@ TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) RegisterServerEvent('esx_ambulancejob:revive') AddEventHandler('esx_ambulancejob:revive', function(target) - local _source = source - local xPlayer = ESX.GetPlayerFromId(_source) + local xPlayer = ESX.GetPlayerFromId(source) - xPlayer.addMoney(Config.ReviveReward) - TriggerClientEvent('esx_ambulancejob:revive', target) + if xPlayer.job.name == 'ambulance' then + xPlayer.addMoney(Config.ReviveReward) + TriggerClientEvent('esx_ambulancejob:revive', target) + else + print(('esx_ambulancejob: %s attempted to revive!'):format(xPlayer.identifier)) + end end) RegisterServerEvent('esx_ambulancejob:heal') AddEventHandler('esx_ambulancejob:heal', function(target, type) - TriggerClientEvent('esx_ambulancejob:heal', target, type) + local xPlayer = ESX.GetPlayerFromId(source) + + if xPlayer.job.name == 'ambulance' then + TriggerClientEvent('esx_ambulancejob:heal', target, type) + else + print(('esx_ambulancejob: %s attempted to heal!'):format(xPlayer.identifier)) + end end) RegisterServerEvent('esx_ambulancejob:putInVehicle') AddEventHandler('esx_ambulancejob:putInVehicle', function(target) + local xPlayer = ESX.GetPlayerFromId(source) - TriggerClientEvent('esx_ambulancejob:putInVehicle', target) + if xPlayer.job.name == 'ambulance' then + TriggerClientEvent('esx_ambulancejob:putInVehicle', target) + else + print(('esx_ambulancejob: %s attempted to put in vehicle!'):format(xPlayer.identifier)) + end end) TriggerEvent('esx_phone:registerNumber', 'ambulance', _U('alert_ambulance'), true, true) @@ -112,26 +126,34 @@ end) RegisterServerEvent('esx_ambulancejob:giveItem') AddEventHandler('esx_ambulancejob:giveItem', function(itemName) - local _source = source - local xPlayer = ESX.GetPlayerFromId(_source) - local item = xPlayer.getInventoryItem(itemName) - local count = 1 + local xPlayer = ESX.GetPlayerFromId(source) - if item.limit ~= -1 then - count = item.limit - item.count + if xPlayer.job.name ~= 'ambulance' then + print(('esx_ambulancejob: %s attempted to spawn in an item!'):format(xPlayer.identifier)) + return + elseif itemName ~= 'medikit' or itemName ~= 'bandage' then + print(('esx_ambulancejob: %s attempted to spawn in an item!'):format(xPlayer.identifier)) + return end - if item.count < item.limit then + local xItem = xPlayer.getInventoryItem(itemName) + + local count = 1 + if xItem.limit ~= -1 then + count = xItem.limit - xItem.count + end + + if xItem.count < xItem.limit then xPlayer.addInventoryItem(itemName, count) else - TriggerClientEvent('esx:showNotification', _source, _U('max_item')) + TriggerClientEvent('esx:showNotification', source, _U('max_item')) end end) TriggerEvent('es:addGroupCommand', 'revive', 'admin', function(source, args, user) if args[1] ~= nil then if GetPlayerName(tonumber(args[1])) ~= nil then - print('esx_ambulancejob: ' .. GetPlayerName(source) .. ' is reviving a player!') + print(('esx_ambulancejob: %s used admin revive'):format(GetPlayerIdentifiers(source)[1])) TriggerClientEvent('esx_ambulancejob:revive', tonumber(args[1])) end else @@ -139,7 +161,7 @@ TriggerEvent('es:addGroupCommand', 'revive', 'admin', function(source, args, use end end, function(source, args, user) TriggerClientEvent('chat:addMessage', source, { args = { '^1SYSTEM', 'Insufficient Permissions.' } }) -end, { help = _U('revive_help'), params = { { name = 'id' } } }) +end, { help = _U('revive_help'), params = {{ name = 'id' }} }) ESX.RegisterUsableItem('medikit', function(source) local _source = source @@ -161,12 +183,11 @@ RegisterServerEvent('esx_ambulancejob:firstSpawn') AddEventHandler('esx_ambulancejob:firstSpawn', function() local _source = source local identifier = GetPlayerIdentifiers(_source)[1] - MySQL.Async.fetchScalar('SELECT isDead FROM users WHERE identifier=@identifier', - { + MySQL.Async.fetchScalar('SELECT isDead FROM users WHERE identifier = @identifier', { ['@identifier'] = identifier }, function(isDead) if isDead == 1 then - print('esx_ambulancejob: ' .. GetPlayerName(_source) .. ' (' .. identifier .. ') attempted combat logging!') + print(('esx_ambulancejob: %s attempted combat logging!'):format(identifier)) TriggerClientEvent('esx_ambulancejob:requestDeath', _source) end end) @@ -174,10 +195,11 @@ end) RegisterServerEvent('esx_ambulancejob:setDeathStatus') AddEventHandler('esx_ambulancejob:setDeathStatus', function(isDead) - local _source = source - MySQL.Sync.execute("UPDATE users SET isDead=@isDead WHERE identifier=@identifier", + local identifier = GetPlayerIdentifiers(source)[1] + + MySQL.Sync.execute("UPDATE users SET isDead=@isDead WHERE identifier = @identifier", { - ['@identifier'] = GetPlayerIdentifiers(_source)[1], - ['@isDead'] = isDead + ['@identifier'] = identifier, + ['@isDead'] = isDead }) end) From 5df65428717e379950eb2360443ec12d5cdf7b4f Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Sat, 3 Nov 2018 23:10:19 +0100 Subject: [PATCH 099/177] Renamed column isDead to is_dead --- client/main.lua | 2 +- esx_ambulancejob.sql | 4 +++- localization/de_esx_ambulancejob.sql | 4 +++- localization/en_esx_ambulancejob.sql | 4 +++- localization/fi_esx_ambulancejob.sql | 4 +++- localization/pl_esx_ambulancejob.sql | 4 +++- server/main.lua | 7 +++---- 7 files changed, 19 insertions(+), 10 deletions(-) diff --git a/client/main.lua b/client/main.lua index b3fe27ee..0e739c98 100644 --- a/client/main.lua +++ b/client/main.lua @@ -296,7 +296,7 @@ AddEventHandler('esx_ambulancejob:revive', function() DoScreenFadeOut(800) while not IsScreenFadedOut() do - Citizen.Wait(0) + Citizen.Wait(50) end ESX.SetPlayerData('lastPosition', { diff --git a/esx_ambulancejob.sql b/esx_ambulancejob.sql index ddb05e02..d88d5676 100644 --- a/esx_ambulancejob.sql +++ b/esx_ambulancejob.sql @@ -28,4 +28,6 @@ INSERT INTO `items` (name, label, `limit`) VALUES ('medikit','Medikit', 5) ; -ALTER TABLE `users` ADD `isDead` BIT(1) DEFAULT b'0' +ALTER TABLE `users` + ADD `is_dead` TINYINT(1) NULL DEFAULT '0' +; diff --git a/localization/de_esx_ambulancejob.sql b/localization/de_esx_ambulancejob.sql index d11f2575..0ebf079d 100644 --- a/localization/de_esx_ambulancejob.sql +++ b/localization/de_esx_ambulancejob.sql @@ -28,4 +28,6 @@ INSERT INTO `items` (name, label, `limit`) VALUES ('medikit','Medikit', 5) ; -ALTER TABLE `users` ADD `isDead` BIT(1) DEFAULT b'0' +ALTER TABLE `users` + ADD `is_dead` TINYINT(1) NULL DEFAULT '0' +; diff --git a/localization/en_esx_ambulancejob.sql b/localization/en_esx_ambulancejob.sql index cbe37090..6bb4ecf1 100644 --- a/localization/en_esx_ambulancejob.sql +++ b/localization/en_esx_ambulancejob.sql @@ -28,4 +28,6 @@ INSERT INTO `items` (name, label, `limit`) VALUES ('medikit','Medikit', 5) ; -ALTER TABLE `users` ADD `isDead` BIT(1) DEFAULT b'0' +ALTER TABLE `users` + ADD `is_dead` TINYINT(1) NULL DEFAULT '0' +; diff --git a/localization/fi_esx_ambulancejob.sql b/localization/fi_esx_ambulancejob.sql index 3ea64c07..7c001e0d 100644 --- a/localization/fi_esx_ambulancejob.sql +++ b/localization/fi_esx_ambulancejob.sql @@ -28,4 +28,6 @@ INSERT INTO `items` (name, label, `limit`) VALUES ('medikit','Ensiapupakkaus', 5) ; -ALTER TABLE `users` ADD `isDead` BIT(1) DEFAULT b'0' +ALTER TABLE `users` + ADD `is_dead` TINYINT(1) NULL DEFAULT '0' +; diff --git a/localization/pl_esx_ambulancejob.sql b/localization/pl_esx_ambulancejob.sql index a9035d79..c3715181 100644 --- a/localization/pl_esx_ambulancejob.sql +++ b/localization/pl_esx_ambulancejob.sql @@ -28,4 +28,6 @@ INSERT INTO `items` (name, label, `limit`) VALUES ('medikit','Defibrylator', 5) ; -ALTER TABLE `users` ADD `isDead` BIT(1) DEFAULT b'0' +ALTER TABLE `users` + ADD `is_dead` TINYINT(1) NULL DEFAULT '0' +; diff --git a/server/main.lua b/server/main.lua index 4eb51635..b233f93d 100644 --- a/server/main.lua +++ b/server/main.lua @@ -183,10 +183,10 @@ RegisterServerEvent('esx_ambulancejob:firstSpawn') AddEventHandler('esx_ambulancejob:firstSpawn', function() local _source = source local identifier = GetPlayerIdentifiers(_source)[1] - MySQL.Async.fetchScalar('SELECT isDead FROM users WHERE identifier = @identifier', { + MySQL.Async.fetchScalar('SELECT is_dead FROM users WHERE identifier = @identifier', { ['@identifier'] = identifier }, function(isDead) - if isDead == 1 then + if isDead then print(('esx_ambulancejob: %s attempted combat logging!'):format(identifier)) TriggerClientEvent('esx_ambulancejob:requestDeath', _source) end @@ -197,8 +197,7 @@ RegisterServerEvent('esx_ambulancejob:setDeathStatus') AddEventHandler('esx_ambulancejob:setDeathStatus', function(isDead) local identifier = GetPlayerIdentifiers(source)[1] - MySQL.Sync.execute("UPDATE users SET isDead=@isDead WHERE identifier = @identifier", - { + MySQL.Sync.execute('UPDATE users SET is_dead = @isDead WHERE identifier = @identifier', { ['@identifier'] = identifier, ['@isDead'] = isDead }) From db29c87ae4bbd23b61ec32f05b86ceade9f1867a Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Sat, 3 Nov 2018 23:10:52 +0100 Subject: [PATCH 100/177] Final commit v1.1.1 --- __resource.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/__resource.lua b/__resource.lua index fc60045b..957f6528 100644 --- a/__resource.lua +++ b/__resource.lua @@ -2,7 +2,7 @@ resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937' description 'ESX Ambulance Job' -version '1.1.0' +version '1.1.1' server_scripts { '@mysql-async/lib/MySQL.lua', From db3e45ce32d15531f241ce5a9e3aae13f37064c7 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Sun, 4 Nov 2018 21:20:54 +0100 Subject: [PATCH 101/177] Fixed bugs with setting death status, combat loggers now force-respawn --- client/job.lua | 1 + client/main.lua | 31 +++++++++++++++++-------------- locales/br.lua | 1 + locales/en.lua | 1 + locales/es.lua | 1 + locales/fi.lua | 1 + locales/fr.lua | 1 + locales/pl.lua | 1 + locales/sv.lua | 1 + server/main.lua | 10 +++++----- 10 files changed, 30 insertions(+), 19 deletions(-) diff --git a/client/job.lua b/client/job.lua index 529ec5fb..48da14d5 100644 --- a/client/job.lua +++ b/client/job.lua @@ -1,4 +1,5 @@ local HasAlreadyEnteredMarker, LastZone, CurrentAction, CurrentActionMsg, CurrentActionData = nil, nil, nil, '', {} +local IsBusy = false function OpenAmbulanceActionsMenu() local elements = { diff --git a/client/main.lua b/client/main.lua index 0e739c98..0141e83b 100644 --- a/client/main.lua +++ b/client/main.lua @@ -10,7 +10,7 @@ Keys = { ["NENTER"] = 201, ["N4"] = 108, ["N5"] = 60, ["N6"] = 107, ["N+"] = 96, ["N-"] = 97, ["N7"] = 117, ["N8"] = 61, ["N9"] = 118 } -local FirstSpawn, IsBusy = true, false +local FirstSpawn, PlayerLoaded = true, false IsDead = false ESX = nil @@ -25,12 +25,14 @@ Citizen.CreateThread(function() Citizen.Wait(100) end + PlayerLoaded = true ESX.PlayerData = ESX.GetPlayerData() end) RegisterNetEvent('esx:playerLoaded') AddEventHandler('esx:playerLoaded', function(xPlayer) ESX.PlayerData = xPlayer + PlayerLoaded = true end) RegisterNetEvent('esx:setJob') @@ -42,9 +44,19 @@ AddEventHandler('playerSpawned', function() IsDead = false if FirstSpawn then - TriggerServerEvent('esx_ambulancejob:firstSpawn') exports.spawnmanager:setAutoSpawn(false) -- disable respawn FirstSpawn = false + + ESX.TriggerServerCallback('esx_ambulancejob:getDeathStatus', function(isDead) + if isDead and Config.AntiCombatLog then + while not PlayerLoaded do + Citizen.Wait(1000) + end + + ESX.ShowNotification(_U('combatlog_message')) + RemoveItemsAfterRPDeath() + end + end) end end) @@ -66,7 +78,7 @@ end) function OnPlayerDeath() IsDead = true - TriggerServerEvent('esx_ambulancejob:setDeathStatus', 1) + TriggerServerEvent('esx_ambulancejob:setDeathStatus', true) StartDeathTimer() StartDistressSignal() @@ -226,7 +238,7 @@ function StartDeathTimer() end function RemoveItemsAfterRPDeath() - TriggerServerEvent('esx_ambulancejob:setDeathStatus', 0) + TriggerServerEvent('esx_ambulancejob:setDeathStatus', false) Citizen.CreateThread(function() DoScreenFadeOut(800) @@ -290,7 +302,7 @@ RegisterNetEvent('esx_ambulancejob:revive') AddEventHandler('esx_ambulancejob:revive', function() local playerPed = PlayerPedId() local coords = GetEntityCoords(playerPed) - TriggerServerEvent('esx_ambulancejob:setDeathStatus', 0) + TriggerServerEvent('esx_ambulancejob:setDeathStatus', true) Citizen.CreateThread(function() DoScreenFadeOut(800) @@ -322,15 +334,6 @@ AddEventHandler('esx_ambulancejob:revive', function() end) end) - -RegisterNetEvent('esx_ambulancejob:requestDeath') -AddEventHandler('esx_ambulancejob:requestDeath', function() - if Config.AntiCombatLog then - Citizen.Wait(5000) - SetEntityHealth(PlayerPedId(), 0) - end -end) - -- Load unloaded IPLs if Config.LoadIpl then Citizen.CreateThread(function() diff --git a/locales/br.lua b/locales/br.lua index 1e934fcb..2d7db462 100644 --- a/locales/br.lua +++ b/locales/br.lua @@ -52,6 +52,7 @@ Locales['br'] = { ['distress_send'] = 'press [~b~G~s~] to send distress signal', ['distress_sent'] = 'distress signal has been sent to available units!', ['distress_message'] = 'medical attention required: unconscious citizen!', + ['combatlog_message'] = 'you have been force-respawned because you\'ve previously left the server when dead.', -- Revive ['revive_help'] = 'reviver um jogador', -- Item diff --git a/locales/en.lua b/locales/en.lua index 17c85a22..053012f2 100644 --- a/locales/en.lua +++ b/locales/en.lua @@ -52,6 +52,7 @@ Locales['en'] = { ['distress_send'] = 'press [~b~G~s~] to send distress signal', ['distress_sent'] = 'distress signal has been sent to available units!', ['distress_message'] = 'medical attention required: unconscious citizen!', + ['combatlog_message'] = 'you have been force-respawned because you\'ve previously left the server when dead.', -- Revive ['revive_help'] = 'revive a player', -- Item diff --git a/locales/es.lua b/locales/es.lua index 2445a06e..df241022 100644 --- a/locales/es.lua +++ b/locales/es.lua @@ -52,6 +52,7 @@ Locales['es'] = { ['distress_send'] = 'press [~b~G~s~] to send distress signal', ['distress_sent'] = 'distress signal has been sent to available units!', ['distress_message'] = 'medical attention required: unconscious citizen!', + ['combatlog_message'] = 'you have been force-respawned because you\'ve previously left the server when dead.', -- Revive ['revive_help'] = 'reviver un jugador', -- Item diff --git a/locales/fi.lua b/locales/fi.lua index 59574c21..d474c1f5 100644 --- a/locales/fi.lua +++ b/locales/fi.lua @@ -52,6 +52,7 @@ Locales['fi'] = { ['distress_send'] = 'press [~b~G~s~] to send distress signal', ['distress_sent'] = 'distress signal has been sent to available units!', ['distress_message'] = 'medical attention required: unconscious citizen!', + ['combatlog_message'] = 'you have been force-respawned because you\'ve previously left the server when dead.', -- Revive ['revive_help'] = 'elvytä pelaaja', -- Item diff --git a/locales/fr.lua b/locales/fr.lua index 1fa2cca3..3dc156b1 100644 --- a/locales/fr.lua +++ b/locales/fr.lua @@ -52,6 +52,7 @@ Locales['fr'] = { ['distress_send'] = 'press [~b~G~s~] to send distress signal', ['distress_sent'] = 'distress signal has been sent to available units!', ['distress_message'] = 'medical attention required: unconscious citizen!', + ['combatlog_message'] = 'you have been force-respawned because you\'ve previously left the server when dead.', -- Revive ['revive_help'] = 'relancer un joueur', -- Item diff --git a/locales/pl.lua b/locales/pl.lua index 31b5486a..e301f8b4 100644 --- a/locales/pl.lua +++ b/locales/pl.lua @@ -52,6 +52,7 @@ Locales['pl'] = { ['distress_send'] = 'press [~b~G~s~] to send distress signal', ['distress_sent'] = 'distress signal has been sent to available units!', ['distress_message'] = 'medical attention required: unconscious citizen!', + ['combatlog_message'] = 'you have been force-respawned because you\'ve previously left the server when dead.', -- Revive ['revive_help'] = 'ożyw gracza', -- Item diff --git a/locales/sv.lua b/locales/sv.lua index ae3f4a04..7097678f 100644 --- a/locales/sv.lua +++ b/locales/sv.lua @@ -52,6 +52,7 @@ Locales['sv'] = { ['distress_send'] = 'tryck ~b~[G]~s~ för att skicka nödsignal', ['distress_sent'] = 'nödsignal har skickats till samtliga enheter!', ['distress_message'] = 'läkarvård krävs: medvetslös medborgare!', + ['combatlog_message'] = 'du har force-respawnats på grund av att du lämnat servern medans du var död', -- Revive ['revive_help'] = 'återuppliva en spelare', -- Item diff --git a/server/main.lua b/server/main.lua index b233f93d..2a66b62c 100644 --- a/server/main.lua +++ b/server/main.lua @@ -179,17 +179,17 @@ ESX.RegisterUsableItem('bandage', function(source) TriggerClientEvent('esx:showNotification', _source, _U('used_bandage')) end) -RegisterServerEvent('esx_ambulancejob:firstSpawn') -AddEventHandler('esx_ambulancejob:firstSpawn', function() - local _source = source - local identifier = GetPlayerIdentifiers(_source)[1] +ESX.RegisterServerCallback('esx_ambulancejob:getDeathStatus', function(source, cb) + local identifier = GetPlayerIdentifiers(source)[1] + MySQL.Async.fetchScalar('SELECT is_dead FROM users WHERE identifier = @identifier', { ['@identifier'] = identifier }, function(isDead) if isDead then print(('esx_ambulancejob: %s attempted combat logging!'):format(identifier)) - TriggerClientEvent('esx_ambulancejob:requestDeath', _source) end + + cb(isDead) end) end) From 485dc685f2f10d3b48084a84a9cba00fd804df14 Mon Sep 17 00:00:00 2001 From: Jeffrey-Lang <34451211+Jeffrey-Lang@users.noreply.github.com> Date: Sun, 4 Nov 2018 21:27:34 +0100 Subject: [PATCH 102/177] Fixed respawning with /revive (#87) - Fix spawning at hostiptal with /revive command or revive by ems menu - Now correctly repawning to hospital after bleedoutTimer runs out --- client/main.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/client/main.lua b/client/main.lua index 0141e83b..5b834543 100644 --- a/client/main.lua +++ b/client/main.lua @@ -209,6 +209,7 @@ function StartDeathTimer() text = text .. _U('respawn_bleedout_prompt') if IsControlPressed(0, Keys['E']) and timeHeld > 60 then + RemoveItemsAfterRPDeath() break end elseif Config.EarlyRespawnFine and canPayFine then @@ -216,6 +217,7 @@ function StartDeathTimer() if IsControlPressed(0, Keys['E']) and timeHeld > 60 then TriggerServerEvent('esx_ambulancejob:payFine') + RemoveItemsAfterRPDeath() break end end @@ -232,8 +234,10 @@ function StartDeathTimer() AddTextComponentString(text) DrawText(0.5, 0.8) end - - RemoveItemsAfterRPDeath() + + if bleedoutTimer < 1 and IsDead then + RemoveItemsAfterRPDeath() + end end) end From c9187dd6df65181f13f48570651673308fc3ec42 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Sun, 4 Nov 2018 21:28:54 +0100 Subject: [PATCH 103/177] Corrected is_dead --- client/main.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/main.lua b/client/main.lua index 5b834543..fb932b83 100644 --- a/client/main.lua +++ b/client/main.lua @@ -306,7 +306,7 @@ RegisterNetEvent('esx_ambulancejob:revive') AddEventHandler('esx_ambulancejob:revive', function() local playerPed = PlayerPedId() local coords = GetEntityCoords(playerPed) - TriggerServerEvent('esx_ambulancejob:setDeathStatus', true) + TriggerServerEvent('esx_ambulancejob:setDeathStatus', false) Citizen.CreateThread(function() DoScreenFadeOut(800) From a93361737ddea828959f802ca318903e8a2cb532 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Fri, 9 Nov 2018 22:18:39 +0100 Subject: [PATCH 104/177] Fixed #92 --- server/main.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/main.lua b/server/main.lua index 2a66b62c..649f4ae3 100644 --- a/server/main.lua +++ b/server/main.lua @@ -131,7 +131,7 @@ AddEventHandler('esx_ambulancejob:giveItem', function(itemName) if xPlayer.job.name ~= 'ambulance' then print(('esx_ambulancejob: %s attempted to spawn in an item!'):format(xPlayer.identifier)) return - elseif itemName ~= 'medikit' or itemName ~= 'bandage' then + elseif (itemName ~= 'medikit' and itemName ~= 'bandage') then print(('esx_ambulancejob: %s attempted to spawn in an item!'):format(xPlayer.identifier)) return end From 22b77b8d927f9818c03f8b29f148f8653dd5fc1d Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Fri, 9 Nov 2018 22:32:09 +0100 Subject: [PATCH 105/177] Fixed pharmacy color --- locales/br.lua | 2 +- locales/en.lua | 2 +- locales/es.lua | 2 +- locales/fi.lua | 2 +- locales/fr.lua | 2 +- locales/pl.lua | 2 +- locales/sv.lua | 4 ++-- server/main.lua | 4 +++- 8 files changed, 11 insertions(+), 9 deletions(-) diff --git a/locales/br.lua b/locales/br.lua index 2d7db462..cc22645d 100644 --- a/locales/br.lua +++ b/locales/br.lua @@ -30,7 +30,7 @@ Locales['br'] = { ['fast_travel'] = 'Aperte ~INPUT_CONTEXT~ para mover-se rapidamente.', ['open_pharmacy'] = 'Aperte ~INPUT_CONTEXT~ para abrir a farmácia.', ['pharmacy_menu_title'] = 'Farmácia', - ['pharmacy_take'] = 'tomar ~y~%s~s~', + ['pharmacy_take'] = 'tomar %s', ['medikit'] = 'Seringa', ['bandage'] = 'Vendagem', ['max_item'] = 'você já carrega o suficiente sobre você.', diff --git a/locales/en.lua b/locales/en.lua index 053012f2..ca1b0d39 100644 --- a/locales/en.lua +++ b/locales/en.lua @@ -30,7 +30,7 @@ Locales['en'] = { ['fast_travel'] = 'press ~INPUT_CONTEXT~ to fast travel.', ['open_pharmacy'] = 'press ~INPUT_CONTEXT~ to open the pharmacy.', ['pharmacy_menu_title'] = 'pharmacy', - ['pharmacy_take'] = 'take ~y~%s~s~', + ['pharmacy_take'] = 'take %s', ['medikit'] = 'medikit', ['bandage'] = 'bandage', ['max_item'] = 'You are already carrying enough.', diff --git a/locales/es.lua b/locales/es.lua index df241022..aea37cb3 100644 --- a/locales/es.lua +++ b/locales/es.lua @@ -30,7 +30,7 @@ Locales['es'] = { ['fast_travel'] = 'Press ~INPUT_CONTEXT~ to fast travel.', ['open_pharmacy'] = 'Press ~INPUT_CONTEXT~ to open the pharmacy.', ['pharmacy_menu_title'] = 'Pharmacy', - ['pharmacy_take'] = 'take ~y~%s~s~', + ['pharmacy_take'] = 'take %s', ['medikit'] = 'medikit', ['bandage'] = 'bandage', ['max_item'] = 'You are already carrying enough on yourself.', diff --git a/locales/fi.lua b/locales/fi.lua index d474c1f5..841e6a89 100644 --- a/locales/fi.lua +++ b/locales/fi.lua @@ -30,7 +30,7 @@ Locales['fi'] = { ['fast_travel'] = 'paina ~INPUT_CONTEXT~ liikkuaksesi nopeasti kerrosten välillä', ['open_pharmacy'] = 'paina ~INPUT_CONTEXT~ avataksesi lääkekaappi', ['pharmacy_menu_title'] = 'lääkekaappi', - ['pharmacy_take'] = 'ota ~y~%s~s~', + ['pharmacy_take'] = 'ota %s', ['medikit'] = 'ensiapupakkauksia', ['bandage'] = 'sideharsoja', ['max_item'] = 'sinulla on jo tarpeeksi mukana', diff --git a/locales/fr.lua b/locales/fr.lua index 3dc156b1..cfc249db 100644 --- a/locales/fr.lua +++ b/locales/fr.lua @@ -30,7 +30,7 @@ Locales['fr'] = { ['fast_travel'] = 'appuyez sur ~INPUT_CONTEXT~ pour vous déplacer rapidement.', ['open_pharmacy'] = 'appuyez sur ~INPUT_CONTEXT~ pour ouvrir la pharmacie.', ['pharmacy_menu_title'] = 'Pharmacie', - ['pharmacy_take'] = 'prendre ~y~%s~s~', + ['pharmacy_take'] = 'prendre %s', ['medikit'] = 'kit de soin', ['bandage'] = 'bandage', ['max_item'] = 'vous en portez déjà assez sur vous.', diff --git a/locales/pl.lua b/locales/pl.lua index e301f8b4..6d523288 100644 --- a/locales/pl.lua +++ b/locales/pl.lua @@ -30,7 +30,7 @@ Locales['pl'] = { ['fast_travel'] = 'naciśnij na ~INPUT_CONTEXT~ do szybkiej podróży.', ['open_pharmacy'] = 'naciśnij na ~INPUT_CONTEXT~ aby otworzyć aptekę', ['pharmacy_menu_title'] = 'apteka', - ['pharmacy_take'] = 'weź ~y~%s~s~', + ['pharmacy_take'] = 'weź %s', ['medikit'] = 'apteczka', ['bandage'] = 'bandaż', ['max_item'] = 'już masz na sobie dość.', diff --git a/locales/sv.lua b/locales/sv.lua index 7097678f..ea7abf73 100644 --- a/locales/sv.lua +++ b/locales/sv.lua @@ -23,14 +23,14 @@ Locales['sv'] = { -- Boss Menu ['boss_actions'] = 'chef meny', -- Misc - ['invalid_amount'] = '~r~ogiltig mängd', + ['invalid_amount'] = '~r~Ogiltig mängd', ['open_menu'] = 'tryck ~INPUT_CONTEXT~ för att öppna menyn.', ['deposit_amount'] = 'mängd att sätta in', ['money_withdraw'] = 'mängd att ta ut', ['fast_travel'] = 'tryck på ~INPUT_CONTEXT~ för att snabbresa.', ['open_pharmacy'] = 'tryck på ~INPUT_CONTEXT~ för att öppna apoteket.', ['pharmacy_menu_title'] = 'apotek', - ['pharmacy_take'] = 'ta ~y~%s~s~', + ['pharmacy_take'] = 'ta %s', ['medikit'] = 'medicinkit', ['bandage'] = 'bandage', ['max_item'] = 'du har redan tillräckligt mycket på dig.', diff --git a/server/main.lua b/server/main.lua index 649f4ae3..e2f86711 100644 --- a/server/main.lua +++ b/server/main.lua @@ -137,8 +137,8 @@ AddEventHandler('esx_ambulancejob:giveItem', function(itemName) end local xItem = xPlayer.getInventoryItem(itemName) - local count = 1 + if xItem.limit ~= -1 then count = xItem.limit - xItem.count end @@ -167,6 +167,7 @@ ESX.RegisterUsableItem('medikit', function(source) local _source = source local xPlayer = ESX.GetPlayerFromId(_source) xPlayer.removeInventoryItem('medikit', 1) + TriggerClientEvent('esx_ambulancejob:heal', _source, 'big') TriggerClientEvent('esx:showNotification', _source, _U('used_medikit')) end) @@ -175,6 +176,7 @@ ESX.RegisterUsableItem('bandage', function(source) local _source = source local xPlayer = ESX.GetPlayerFromId(_source) xPlayer.removeInventoryItem('bandage', 1) + TriggerClientEvent('esx_ambulancejob:heal', _source, 'small') TriggerClientEvent('esx:showNotification', _source, _U('used_bandage')) end) From 8fb57b856c5291e971646752959b45a0c75bee60 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Sun, 25 Nov 2018 14:41:36 +0100 Subject: [PATCH 106/177] Much better revive animation --- client/job.lua | 15 +++++++++++---- client/main.lua | 1 - 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/client/job.lua b/client/job.lua index 48da14d5..6e269163 100644 --- a/client/job.lua +++ b/client/job.lua @@ -62,7 +62,7 @@ function OpenMobileAmbulanceActionsMenu() local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() - if closestPlayer == -1 or closestDistance > 3.0 then + if closestPlayer == -1 or closestDistance > 1.0 then ESX.ShowNotification(_U('no_players')) else @@ -77,9 +77,16 @@ function OpenMobileAmbulanceActionsMenu() IsBusy = true ESX.ShowNotification(_U('revive_inprogress')) - TaskStartScenarioInPlace(playerPed, 'CODE_HUMAN_MEDIC_TEND_TO_DEAD', 0, true) - Citizen.Wait(10000) - ClearPedTasks(playerPed) + + local lib, anim = 'mini@cpr@char_a@cpr_str', 'cpr_pumpchest' + + for i=1, 15, 1 do + Citizen.Wait(900) + + ESX.Streaming.RequestAnimDict(lib, function() + TaskPlayAnim(PlayerPedId(), lib, anim, 8.0, -8.0, -1, 0, 0, false, false, false) + end) + end TriggerServerEvent('esx_ambulancejob:removeItem', 'medikit') TriggerServerEvent('esx_ambulancejob:revive', GetPlayerServerId(closestPlayer)) diff --git a/client/main.lua b/client/main.lua index fb932b83..d74657a7 100644 --- a/client/main.lua +++ b/client/main.lua @@ -83,7 +83,6 @@ function OnPlayerDeath() StartDeathTimer() StartDistressSignal() - ClearPedTasksImmediately(PlayerPedId()) StartScreenEffect('DeathFailOut', 0, false) end From a1862bdc4820ff488585da9e56e3f8560f04db5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rychl=C3=BD?= Date: Mon, 26 Nov 2018 09:11:54 +0100 Subject: [PATCH 107/177] Add of Czech translate (#91) --- __resource.lua | 2 + locales/cs.lua | 64 ++++++++++++++++++++++++++++ localization/cs_esx_ambulancejob.sql | 33 ++++++++++++++ 3 files changed, 99 insertions(+) create mode 100644 locales/cs.lua create mode 100644 localization/cs_esx_ambulancejob.sql diff --git a/__resource.lua b/__resource.lua index 957f6528..c6218a17 100644 --- a/__resource.lua +++ b/__resource.lua @@ -14,6 +14,7 @@ server_scripts { 'locales/es.lua', 'locales/sv.lua', 'locales/pl.lua', + 'locales/cs.lua', 'config.lua', 'server/main.lua' } @@ -27,6 +28,7 @@ client_scripts { 'locales/es.lua', 'locales/sv.lua', 'locales/pl.lua', + 'locales/cs.lua', 'config.lua', 'client/main.lua', 'client/job.lua' diff --git a/locales/cs.lua b/locales/cs.lua new file mode 100644 index 00000000..525538de --- /dev/null +++ b/locales/cs.lua @@ -0,0 +1,64 @@ +Locales['cs'] = { + -- Cloakroom + ['cloakroom'] = 'šatna', + ['ems_clothes_civil'] = 'civilní oblečení', + ['ems_clothes_ems'] = 'zdravotnické oblečení', + -- Vehicles + ['veh_menu'] = 'vozidlo', + ['veh_spawn'] = 'stiskněte ~INPUT_CONTEXT~ k vyzvednutí vozidla nebo helikoptéry', + ['store_veh'] = 'stiskněte ~INPUT_CONTEXT~ k vrácení vozidla', + ['ambulance'] = 'sanitka', + ['helicopter'] = 'helikoptéra', + -- Action Menu + ['hospital'] = 'nemocnice', + ['revive_inprogress'] = 'probíhá oživení!', + ['revive_complete'] = 'oživili jste ~y~%s~s~', + ['revive_complete_award'] = 'oživili jste ~y~%s~s~ a dostali jste ~g~$%s~s~!', + ['heal_inprogress'] = 'uzdravujete!', + ['heal_complete'] = 'uzdravili jste ~y~%s~s~', + ['no_players'] = 'v okolí není žádný hráč!', + ['no_vehicles'] = 'v okolí není žádné vozidlo', + ['player_not_unconscious'] = 'hráč není v bezvědomí!', + ['player_not_conscious'] = 'hráč je v bezvědomí!', + -- Boss Menu + ['boss_actions'] = 'akce šéfa', + -- Misc + ['invalid_amount'] = '~r~neplatná částka', + ['open_menu'] = 'stiskněte ~INPUT_CONTEXT~ k otevření menu', + ['deposit_amount'] = 'částka vkladu', + ['money_withdraw'] = 'částka výběru', + ['fast_travel'] = 'stiskněte ~INPUT_CONTEXT~ k rychlému odcestování.', + ['open_pharmacy'] = 'stiskněte ~INPUT_CONTEXT~ k otevření lékárny.', + ['pharmacy_menu_title'] = 'lékárna', + ['pharmacy_take'] = 'vzít ~y~%s~s~', + ['medikit'] = 'lékarnička', + ['bandage'] = 'obvaz', + ['max_item'] = 'již nesete dostatek věcí.', + -- F6 Menu + ['ems_menu'] = 'Zdravotnické menu', + ['ems_menu_title'] = 'záchranka - Zdravotnické menu', + ['ems_menu_revive'] = 'oživit hráče', + ['ems_menu_putincar'] = 'naložit do vozidla', + ['ems_menu_small'] = 'ošetřit malé zranění', + ['ems_menu_big'] = 'ošetřit vážné zranění', + -- Phone + ['alert_ambulance'] = 'zdravotnický poplach', + -- Death + ['respawn_available_in'] = 'oživení dostupné za ~b~%s minut a %s sekund~s~\n', + ['respawn_bleedout_in'] = 'vykrvácíte za ~b~%s minut a %s sekund~s~\n', + ['respawn_bleedout_prompt'] = 'držte [~b~E~s~] pro respawn.', + ['respawn_now_fine'] = 'držte [~b~E~s~] pro oživení za ~g~$%s~s~', + ['respawn_bleedout_fine_msg'] = 'zaplatili jste ~r~$%s~s~ za respawn.', + ['distress_send'] = 'stiskněte [~b~G~s~] pro vyslání tísňového signálu', + ['distress_sent'] = 'tísňový signál byl vyslán dostupným jednotkám!', + ['distress_message'] = 'nutná lékařská péče: občan v bezvědomí!', + ['combatlog_message'] = 'byli jste násilně oživeni, protože jste předtím opustili server, když jste byli mrtví.', + -- Revive + ['revive_help'] = 'oživit hráče', + -- Item + ['used_medikit'] = 'použili jste ~y~1x~s~ lékarničku', + ['used_bandage'] = 'použili jste ~y~1x~s~ obvaz', + ['not_enough_medikit'] = 'nemáte ~b~medikit~s~.', + ['not_enough_bandage'] = 'nemáte~b~bandage~s~.', + ['healed'] = 'byli jste ošetřeni.', +} diff --git a/localization/cs_esx_ambulancejob.sql b/localization/cs_esx_ambulancejob.sql new file mode 100644 index 00000000..a8af1939 --- /dev/null +++ b/localization/cs_esx_ambulancejob.sql @@ -0,0 +1,33 @@ +USE `essentialmode`; + +INSERT INTO `addon_account` (name, label, shared) VALUES + ('society_ambulance', 'Záchranka', 1) +; + +INSERT INTO `addon_inventory` (name, label, shared) VALUES + ('society_ambulance', 'Záchranka', 1) +; + +INSERT INTO `datastore` (name, label, shared) VALUES + ('society_ambulance', 'Záchranka', 1) +; + +INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_female) VALUES + ('ambulance',0,'ambulance','Zdravotník',20,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), + ('ambulance',1,'doctor','Doktor',40,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), + ('ambulance',2,'chief_doctor','Primář',60,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), + ('ambulance',3,'boss','Chirurg',80,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}') +; + +INSERT INTO `jobs` (name, label) VALUES + ('ambulance','Záchranka') +; + +INSERT INTO `items` (name, label, `limit`) VALUES + ('bandage','Obvaz', 20), + ('medikit','Lékarnička', 5) +; + +ALTER TABLE `users` + ADD `is_dead` TINYINT(1) NULL DEFAULT '0' +; From b15e2d95b1927edf22bc26a964c8be86ec1d1534 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Thu, 13 Dec 2018 19:21:11 +0100 Subject: [PATCH 108/177] Fixed spamming revive to get loads of money --- client/job.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/client/job.lua b/client/job.lua index 6e269163..b5cdc1ce 100644 --- a/client/job.lua +++ b/client/job.lua @@ -68,6 +68,8 @@ function OpenMobileAmbulanceActionsMenu() if data.current.value == 'revive' then + IsBusy = true + ESX.TriggerServerCallback('esx_ambulancejob:getItemAmount', function(quantity) if quantity > 0 then local closestPlayerPed = GetPlayerPed(closestPlayer) @@ -75,7 +77,6 @@ function OpenMobileAmbulanceActionsMenu() if IsPedDeadOrDying(closestPlayerPed, 1) then local playerPed = PlayerPedId() - IsBusy = true ESX.ShowNotification(_U('revive_inprogress')) local lib, anim = 'mini@cpr@char_a@cpr_str', 'cpr_pumpchest' @@ -90,7 +91,6 @@ function OpenMobileAmbulanceActionsMenu() TriggerServerEvent('esx_ambulancejob:removeItem', 'medikit') TriggerServerEvent('esx_ambulancejob:revive', GetPlayerServerId(closestPlayer)) - IsBusy = false -- Show revive award? if Config.ReviveReward > 0 then @@ -104,6 +104,9 @@ function OpenMobileAmbulanceActionsMenu() else ESX.ShowNotification(_U('not_enough_medikit')) end + + IsBusy = false + end, 'medikit') elseif data.current.value == 'small' then From ee6b8a4c85e5573e65b446e717431e4161c6afd6 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Sun, 23 Dec 2018 15:08:05 +0100 Subject: [PATCH 109/177] Proper math namespace --- client/main.lua | 5 +++-- locales/br.lua | 4 ++-- locales/fi.lua | 4 ++-- locales/fr.lua | 4 ++-- locales/pl.lua | 4 ++-- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/client/main.lua b/client/main.lua index d74657a7..f4f4e679 100644 --- a/client/main.lua +++ b/client/main.lua @@ -161,8 +161,8 @@ function StartDeathTimer() end) end - local earlySpawnTimer = ESX.Round(Config.EarlyRespawnTimer / 1000) - local bleedoutTimer = ESX.Round(Config.BleedoutTimer / 1000) + local earlySpawnTimer = ESX.Math.Round(Config.EarlyRespawnTimer / 1000) + local bleedoutTimer = ESX.Math.Round(Config.BleedoutTimer / 1000) Citizen.CreateThread(function() -- early respawn timer @@ -245,6 +245,7 @@ function RemoveItemsAfterRPDeath() Citizen.CreateThread(function() DoScreenFadeOut(800) + while not IsScreenFadedOut() do Citizen.Wait(10) end diff --git a/locales/br.lua b/locales/br.lua index cc22645d..f505145a 100644 --- a/locales/br.lua +++ b/locales/br.lua @@ -58,7 +58,7 @@ Locales['br'] = { -- Item ['used_medikit'] = 'você usou 1x Seringa', ['used_bandage'] = 'você usou 1x Vendagem', - ['not_enough_medikit'] = 'Você não tem ~b~Seringa~w~.', - ['not_enough_bandage'] = 'Você não tem ~b~Vendagem~w~.', + ['not_enough_medikit'] = 'Você não tem ~b~Seringa~s~.', + ['not_enough_bandage'] = 'Você não tem ~b~Vendagem~s~.', ['healed'] = 'Você foi tratado.', } diff --git a/locales/fi.lua b/locales/fi.lua index 841e6a89..c98a53af 100644 --- a/locales/fi.lua +++ b/locales/fi.lua @@ -58,7 +58,7 @@ Locales['fi'] = { -- Item ['used_medikit'] = 'sinä käytit ensiapupakkauksen', ['used_bandage'] = 'sinä käytit sideharsoja', - ['not_enough_medikit'] = 'ei tarpeeksi ~b~ensiapupakkauksia~w~.', - ['not_enough_bandage'] = 'ei tarpeeksi ~b~sideharsoja~w~.', + ['not_enough_medikit'] = 'ei tarpeeksi ~b~ensiapupakkauksia~s~.', + ['not_enough_bandage'] = 'ei tarpeeksi ~b~sideharsoja~s~.', ['healed'] = 'sinua parannettiin', } diff --git a/locales/fr.lua b/locales/fr.lua index cfc249db..c5819c6d 100644 --- a/locales/fr.lua +++ b/locales/fr.lua @@ -58,7 +58,7 @@ Locales['fr'] = { -- Item ['used_medikit'] = 'vous avez utilisé 1x kit de soin', ['used_bandage'] = 'vous avez utilisé 1x bandage', - ['not_enough_medikit'] = 'vous n\'avez pas de ~b~kit de soin~w~.', - ['not_enough_bandage'] = 'vous n\'avez pas de ~b~bandage~w~.', + ['not_enough_medikit'] = 'vous n\'avez pas de ~b~kit de soin~s~.', + ['not_enough_bandage'] = 'vous n\'avez pas de ~b~bandage~s~.', ['healed'] = 'vous avez été soigné.', } diff --git a/locales/pl.lua b/locales/pl.lua index 6d523288..cbe9d438 100644 --- a/locales/pl.lua +++ b/locales/pl.lua @@ -58,7 +58,7 @@ Locales['pl'] = { -- Item ['used_medikit'] = 'użyłeś 1x Apteczki', ['used_bandage'] = 'użyłeś 1x Bandaża', - ['not_enough_medikit'] = 'nie posiadasz ~b~apteczki~w~.', - ['not_enough_bandage'] = 'nie posiadasz ~b~bandaża~w~.', + ['not_enough_medikit'] = 'nie posiadasz ~b~apteczki~s~.', + ['not_enough_bandage'] = 'nie posiadasz ~b~bandaża~s~.', ['healed'] = 'zostałeś potraktowany', } From e7eabab21285efbf14e21e2d1184f2cbce62b041 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Sun, 30 Dec 2018 23:05:04 +0100 Subject: [PATCH 110/177] New helicopter system, Config re-write --- README.md | 3 +- __resource.lua | 5 +- client/job.lua | 750 ++++++++++++++++++++++++++++++++++-------------- client/main.lua | 42 +-- config.lua | 269 +++++++++-------- locales/br.lua | 36 ++- locales/cs.lua | 36 ++- locales/en.lua | 34 ++- locales/es.lua | 36 ++- locales/fi.lua | 36 ++- locales/fr.lua | 34 ++- locales/pl.lua | 36 ++- locales/sv.lua | 36 ++- server/main.lua | 78 +++++ 14 files changed, 1032 insertions(+), 399 deletions(-) diff --git a/README.md b/README.md index 0cbb8348..f2c3b451 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,9 @@ * Auto mode - [esx_skin](https://github.com/ESX-Org/esx_skin) + - [esx_vehicleshop](https://github.com/ESX-Org/esx_vehicleshop) -* Player management (boss actions **There is no way to earn money for now**) +* Player management (boss actions) - [esx_society](https://github.com/ESX-Org/esx_society) ## Download & Installation diff --git a/__resource.lua b/__resource.lua index c6218a17..5033c6cd 100644 --- a/__resource.lua +++ b/__resource.lua @@ -34,4 +34,7 @@ client_scripts { 'client/job.lua' } -dependency 'es_extended' +dependencies { + 'es_extended', + 'esx_vehicleshop' +} \ No newline at end of file diff --git a/client/job.lua b/client/job.lua index b5cdc1ce..ba29aabd 100644 --- a/client/job.lua +++ b/client/job.lua @@ -1,5 +1,7 @@ -local HasAlreadyEnteredMarker, LastZone, CurrentAction, CurrentActionMsg, CurrentActionData = nil, nil, nil, '', {} +local CurrentAction, CurrentActionMsg, CurrentActionData = nil, '', {} +local HasAlreadyEnteredMarker, LastHospital, LastPart, LastPartNum local IsBusy = false +local spawnedVehicles, isInShopMenu = {}, false function OpenAmbulanceActionsMenu() local elements = { @@ -27,10 +29,6 @@ function OpenAmbulanceActionsMenu() end end, function(data, menu) menu.close() - - CurrentAction = 'ambulance_actions_menu' - CurrentActionMsg = _U('open_menu') - CurrentActionData = {} end) end @@ -179,184 +177,246 @@ function OpenMobileAmbulanceActionsMenu() end) end - -AddEventHandler('esx_ambulancejob:hasEnteredMarker', function(zone) - if zone == 'HospitalInteriorEntering1' then - TeleportFadeEffect(PlayerPedId(), Config.Zones.HospitalInteriorInside1.Pos) - elseif zone == 'HospitalInteriorExit1' then - TeleportFadeEffect(PlayerPedId(), Config.Zones.HospitalInteriorOutside1.Pos) - elseif zone == 'HospitalInteriorEntering2' then - local heli = Config.HelicopterSpawner - - if not IsAnyVehicleNearPoint(heli.SpawnPoint.x, heli.SpawnPoint.y, heli.SpawnPoint.z, 3.0) and ESX.PlayerData.job ~= nil and ESX.PlayerData.job.name == 'ambulance' then - ESX.Game.SpawnVehicle('polmav', { - x = heli.SpawnPoint.x, - y = heli.SpawnPoint.y, - z = heli.SpawnPoint.z - }, heli.Heading, function(vehicle) - SetVehicleModKit(vehicle, 0) - SetVehicleLivery(vehicle, 1) - end) - end - TeleportFadeEffect(PlayerPedId(), Config.Zones.HospitalInteriorInside2.Pos) - elseif zone == 'HospitalInteriorExit2' then - TeleportFadeEffect(PlayerPedId(), Config.Zones.HospitalInteriorOutside2.Pos) - elseif zone == 'ParkingDoorGoOutInside' then - TeleportFadeEffect(PlayerPedId(), Config.Zones.ParkingDoorGoOutOutside.Pos) - elseif zone == 'ParkingDoorGoInOutside' then - TeleportFadeEffect(PlayerPedId(), Config.Zones.ParkingDoorGoInInside.Pos) - elseif zone == 'StairsGoTopBottom' then - CurrentAction = 'fast_travel_goto_top' - CurrentActionMsg = _U('fast_travel') - CurrentActionData = {pos = Config.Zones.StairsGoTopTop.Pos} - elseif zone == 'StairsGoBottomTop' then - CurrentAction = 'fast_travel_goto_bottom' - CurrentActionMsg = _U('fast_travel') - CurrentActionData = {pos = Config.Zones.StairsGoBottomBottom.Pos} - elseif zone == 'AmbulanceActions' then - CurrentAction = 'ambulance_actions_menu' - CurrentActionMsg = _U('open_menu') - CurrentActionData = {} - elseif zone == 'VehicleSpawner' then - CurrentAction = 'vehicle_spawner_menu' - CurrentActionMsg = _U('veh_spawn') - CurrentActionData = {} - elseif zone == 'Pharmacy' then - CurrentAction = 'pharmacy' - CurrentActionMsg = _U('open_pharmacy') - CurrentActionData = {} - elseif zone == 'VehicleDeleter' then - local playerPed = PlayerPedId() - local coords = GetEntityCoords(playerPed) - - if IsPedInAnyVehicle(playerPed, false) then - local vehicle, distance = ESX.Game.GetClosestVehicle({ - x = coords.x, - y = coords.y, - z = coords.z - }) - - if distance ~= -1 and distance <= 1.0 then - CurrentAction = 'delete_vehicle' - CurrentActionMsg = _U('store_veh') - CurrentActionData = {vehicle = vehicle} - end - end - end -end) - -function FastTravel(pos) - TeleportFadeEffect(PlayerPedId(), pos) +function FastTravel(coords, heading) + TeleportFadeEffect(PlayerPedId(), coords, heading) end -AddEventHandler('esx_ambulancejob:hasExitedMarker', function(zone) - ESX.UI.Menu.CloseAll() - CurrentAction = nil -end) +function TeleportFadeEffect(entity, coords, heading) + Citizen.CreateThread(function() + DoScreenFadeOut(800) --- Create blips -Citizen.CreateThread(function() - local blip = AddBlipForCoord(Config.Blip.Pos.x, Config.Blip.Pos.y, Config.Blip.Pos.z) + while not IsScreenFadedOut() do + Citizen.Wait(0) + end - SetBlipSprite(blip, Config.Blip.Sprite) - SetBlipDisplay(blip, Config.Blip.Display) - SetBlipScale(blip, Config.Blip.Scale) - SetBlipColour(blip, Config.Blip.Colour) - SetBlipAsShortRange(blip, true) + ESX.Game.Teleport(entity, coords, function() + DoScreenFadeIn(800) - BeginTextCommandSetBlipName("STRING") - AddTextComponentString(_U('hospital')) - EndTextCommandSetBlipName(blip) -end) + if heading then + SetEntityHeading(entity, heading) + end + end) + end) +end --- Display markers +-- Draw markers & Marker logic Citizen.CreateThread(function() while true do Citizen.Wait(0) + local playerCoords = GetEntityCoords(PlayerPedId()) + local canSleep, isInMarker, hasExited = true, false, false + local currentHospital, currentPart, currentPartNum - local coords = GetEntityCoords(PlayerPedId()) - for k,v in pairs(Config.Zones) do - if(v.Type ~= -1 and GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < Config.DrawDistance) then - if ESX.PlayerData.job ~= nil and ESX.PlayerData.job.name == 'ambulance' then - DrawMarker(v.Type, v.Pos.x, v.Pos.y, v.Pos.z, 0.0, 0.0, 0.0, 0, 0.0, 0.0, Config.MarkerSize.x, Config.MarkerSize.y, Config.MarkerSize.z, Config.MarkerColor.r, Config.MarkerColor.g, Config.MarkerColor.b, 100, false, true, 2, false, false, false, false) - elseif k ~= 'AmbulanceActions' and k ~= 'VehicleSpawner' and k ~= 'VehicleDeleter' and k ~= 'Pharmacy' and k ~= 'StairsGoTopBottom' and k ~= 'StairsGoBottomTop' then - DrawMarker(v.Type, v.Pos.x, v.Pos.y, v.Pos.z, 0.0, 0.0, 0.0, 0, 0.0, 0.0, Config.MarkerSize.x, Config.MarkerSize.y, Config.MarkerSize.z, Config.MarkerColor.r, Config.MarkerColor.g, Config.MarkerColor.b, 100, false, true, 2, false, false, false, false) + for hospitalNum,hospital in pairs(Config.Hospitals) do + + -- Ambulance Actions + for k,v in ipairs(hospital.AmbulanceActions) do + local distance = GetDistanceBetweenCoords(playerCoords, v, true) + + if distance < Config.DrawDistance then + DrawMarker(Config.Marker.type, v, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Config.Marker.x, Config.Marker.y, Config.Marker.z, Config.Marker.r, Config.Marker.g, Config.Marker.b, Config.Marker.a, false, false, 2, Config.Marker.rotate, nil, nil, false) + canSleep = false + end + + if distance < Config.Marker.x then + isInMarker, currentHospital, currentPart, currentPartNum = true, hospitalNum, 'AmbulanceActions', k end end + + -- Pharmacies + for k,v in ipairs(hospital.Pharmacies) do + local distance = GetDistanceBetweenCoords(playerCoords, v, true) + + if distance < Config.DrawDistance then + DrawMarker(Config.Marker.type, v, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Config.Marker.x, Config.Marker.y, Config.Marker.z, Config.Marker.r, Config.Marker.g, Config.Marker.b, Config.Marker.a, false, false, 2, Config.Marker.rotate, nil, nil, false) + canSleep = false + end + + if distance < Config.Marker.x then + isInMarker, currentHospital, currentPart, currentPartNum = true, hospitalNum, 'Pharmacy', k + end + end + + -- Vehicle Spawners + for k,v in ipairs(hospital.Vehicles) do + local distance = GetDistanceBetweenCoords(playerCoords, v.Spawner, true) + + if distance < Config.DrawDistance then + DrawMarker(v.Marker.type, v.Spawner, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, v.Marker.x, v.Marker.y, v.Marker.z, v.Marker.r, v.Marker.g, v.Marker.b, v.Marker.a, false, false, 2, v.Marker.rotate, nil, nil, false) + canSleep = false + end + + if distance < v.Marker.x then + isInMarker, currentHospital, currentPart, currentPartNum = true, hospitalNum, 'Vehicles', k + end + end + + -- Helicopter Spawners + for k,v in ipairs(hospital.Helicopters) do + local distance = GetDistanceBetweenCoords(playerCoords, v.Spawner, true) + + if distance < Config.DrawDistance then + DrawMarker(v.Marker.type, v.Spawner, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, v.Marker.x, v.Marker.y, v.Marker.z, v.Marker.r, v.Marker.g, v.Marker.b, v.Marker.a, false, false, 2, v.Marker.rotate, nil, nil, false) + canSleep = false + end + + if distance < v.Marker.x then + isInMarker, currentHospital, currentPart, currentPartNum = true, hospitalNum, 'Helicopters', k + end + end + + -- Vehicle Deleters + for k,v in ipairs(hospital.VehicleDeleters) do + local distance = GetDistanceBetweenCoords(playerCoords, v, true) + + if distance < Config.DrawDistance then + DrawMarker(Config.Marker.type, v, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Config.Marker.x, Config.Marker.y, Config.Marker.z, Config.Marker.r, Config.Marker.g, Config.Marker.b, Config.Marker.a, false, false, 2, Config.Marker.rotate, nil, nil, false) + canSleep = false + end + + if distance < Config.Marker.x then + isInMarker, currentHospital, currentPart, currentPartNum = true, hospitalNum, 'VehicleDeleter', k + end + end + + -- Fast Travels + for k,v in ipairs(hospital.FastTravels) do + local distance = GetDistanceBetweenCoords(playerCoords, v.From, true) + + if distance < Config.DrawDistance then + DrawMarker(v.Marker.type, v.From, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, v.Marker.x, v.Marker.y, v.Marker.z, v.Marker.r, v.Marker.g, v.Marker.b, v.Marker.a, false, false, 2, v.Marker.rotate, nil, nil, false) + canSleep = false + end + + + if distance < v.Marker.x then + FastTravel(v.To.coords, v.To.heading) + end + end + + -- Fast Travels (Prompt) + for k,v in ipairs(hospital.FastTravelsPrompt) do + local distance = GetDistanceBetweenCoords(playerCoords, v.From, true) + + if distance < Config.DrawDistance then + DrawMarker(v.Marker.type, v.From, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, v.Marker.x, v.Marker.y, v.Marker.z, v.Marker.r, v.Marker.g, v.Marker.b, v.Marker.a, false, false, 2, v.Marker.rotate, nil, nil, false) + canSleep = false + end + + if distance < v.Marker.x then + isInMarker, currentHospital, currentPart, currentPartNum = true, hospitalNum, 'FastTravelsPrompt', k + end + end + + -- Logic for exiting & entering markers + if isInMarker and not HasAlreadyEnteredMarker or (isInMarker and (LastHospital ~= currentHospital or LastPart ~= currentPart or LastPartNum ~= currentPartNum)) then + + if + (LastHospital ~= nil and LastPart ~= nil and LastPartNum ~= nil) and + (LastHospital ~= currentHospital or LastPart ~= currentPart or LastPartNum ~= currentPartNum) + then + TriggerEvent('esx_ambulancejob:hasExitedMarker', LastHospital, LastPart, LastPartNum) + hasExited = true + end + + HasAlreadyEnteredMarker, LastHospital, LastPart, LastPartNum = true, currentHospital, currentPart, currentPartNum + + TriggerEvent('esx_ambulancejob:hasEnteredMarker', currentHospital, currentPart, currentPartNum) + + end + + if not hasExited and not isInMarker and HasAlreadyEnteredMarker then + HasAlreadyEnteredMarker = false + TriggerEvent('esx_ambulancejob:hasExitedMarker', LastHospital, LastPart, LastPartNum) + end + end end end) --- Activate menu when player is inside marker -Citizen.CreateThread(function() - while true do - Citizen.Wait(10) +AddEventHandler('esx_ambulancejob:hasEnteredMarker', function(hospital, part, partNum) + if part == 'AmbulanceActions' then + CurrentAction = part + CurrentActionMsg = _U('actions_prompt') + CurrentActionData = {} + elseif part == 'Pharmacy' then + CurrentAction = part + CurrentActionMsg = _U('open_pharmacy') + CurrentActionData = {} + elseif part == 'Vehicles' then + CurrentAction = part + CurrentActionMsg = _U('garage_prompt') + CurrentActionData = {hospital = hospital, partNum = partNum} + elseif part == 'Helicopters' then + CurrentAction = part + CurrentActionMsg = _U('helicopter_prompt') + CurrentActionData = {hospital = hospital, partNum = partNum} + elseif part == 'VehicleDeleter' then - local coords = GetEntityCoords(PlayerPedId()) - local isInMarker = false - local currentZone = nil + local playerPed = PlayerPedId() + local coords = GetEntityCoords(playerPed) - for k,v in pairs(Config.Zones) do - if ESX.PlayerData.job ~= nil and ESX.PlayerData.job.name == 'ambulance' then - if(GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < Config.MarkerSize.x) then - isInMarker = true - currentZone = k - end - elseif k ~= 'AmbulanceActions' and k ~= 'VehicleSpawner' and k ~= 'VehicleDeleter' and k ~= 'Pharmacy' and k ~= 'StairsGoTopBottom' and k ~= 'StairsGoBottomTop' then - if(GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < Config.MarkerSize.x) then - isInMarker = true - currentZone = k - end + if IsPedInAnyVehicle(playerPed, false) then + local vehicle, distance = ESX.Game.GetClosestVehicle(coords) + + if distance ~= -1 and distance <= 1.0 then + CurrentAction = part + CurrentActionMsg = _U('store_veh') + CurrentActionData = {vehicle = vehicle} end end - if isInMarker and not hasAlreadyEnteredMarker then - hasAlreadyEnteredMarker = true - lastZone = currentZone - TriggerEvent('esx_ambulancejob:hasEnteredMarker', currentZone) - end + elseif part == 'FastTravelsPrompt' then + local travelItem = Config.Hospitals[hospital][part][partNum] - if not isInMarker and hasAlreadyEnteredMarker then - hasAlreadyEnteredMarker = false - TriggerEvent('esx_ambulancejob:hasExitedMarker', lastZone) - end + CurrentAction = part + CurrentActionMsg = travelItem.Prompt + CurrentActionData = {to = travelItem.To.coords, heading = travelItem.To.heading} end end) +AddEventHandler('esx_ambulancejob:hasExitedMarker', function(hospital, part, partNum) + if not isInShopMenu then + ESX.UI.Menu.CloseAll() + end + + CurrentAction = nil +end) + -- Key Controls Citizen.CreateThread(function() while true do - Citizen.Wait(10) + Citizen.Wait(0) - if CurrentAction ~= nil then + if CurrentAction then ESX.ShowHelpNotification(CurrentActionMsg) - if IsControlJustReleased(0, Keys['E']) and ESX.PlayerData.job ~= nil and ESX.PlayerData.job.name == 'ambulance' then + if IsControlJustReleased(0, Keys['E']) then - if CurrentAction == 'ambulance_actions_menu' then + if CurrentAction == 'AmbulanceActions' then OpenAmbulanceActionsMenu() - elseif CurrentAction == 'vehicle_spawner_menu' then - OpenVehicleSpawnerMenu() - elseif CurrentAction == 'pharmacy' then + elseif CurrentAction == 'Pharmacy' then OpenPharmacyMenu() - elseif CurrentAction == 'fast_travel_goto_top' or CurrentAction == 'fast_travel_goto_bottom' then - FastTravel(CurrentActionData.pos) - elseif CurrentAction == 'delete_vehicle' then - if Config.EnableSocietyOwnedVehicles then - local vehicleProps = ESX.Game.GetVehicleProperties(CurrentActionData.vehicle) - TriggerServerEvent('esx_society:putVehicleInGarage', 'ambulance', vehicleProps) - end + elseif CurrentAction == 'Vehicles' then + OpenVehicleSpawnerMenu(CurrentActionData.hospital, CurrentActionData.partNum) + elseif CurrentAction == 'Helicopters' then + OpenHelicopterSpawnerMenu(CurrentActionData.hospital, CurrentActionData.partNum) + elseif CurrentAction == 'VehicleDeleter' then ESX.Game.DeleteVehicle(CurrentActionData.vehicle) + elseif CurrentAction == 'FastTravelsPrompt' then + FastTravel(CurrentActionData.to, CurrentActionData.heading) end CurrentAction = nil end - end - - if IsControlJustReleased(0, Keys['F6']) and ESX.PlayerData.job ~= nil and ESX.PlayerData.job.name == 'ambulance' and not IsDead then - OpenMobileAmbulanceActionsMenu() + elseif ESX.PlayerData.job ~= nil and ESX.PlayerData.job.name == 'ambulance' and not IsDead then + if IsControlJustReleased(0, Keys['F6']) then + OpenMobileAmbulanceActionsMenu() + end + else + Citizen.Wait(500) end end end) @@ -366,12 +426,11 @@ AddEventHandler('esx_ambulancejob:putInVehicle', function() local playerPed = PlayerPedId() local coords = GetEntityCoords(playerPed) - if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then - local vehicle = GetClosestVehicle(coords.x, coords.y, coords.z, 5.0, 0, 71) + if IsAnyVehicleNearPoint(coords, 5.0) then + local vehicle = GetClosestVehicle(coords, 5.0, 0, 71) if DoesEntityExist(vehicle) then - local maxSeats = GetVehicleMaxNumberOfPassengers(vehicle) - local freeSeat = nil + local maxSeats, freeSeat = GetVehicleMaxNumberOfPassengers(vehicle) for i=maxSeats - 1, 0, -1 do if IsVehicleSeatFree(vehicle, i) then @@ -380,7 +439,7 @@ AddEventHandler('esx_ambulancejob:putInVehicle', function() end end - if freeSeat ~= nil then + if freeSeat then TaskWarpPedIntoVehicle(playerPed, vehicle, freeSeat) end end @@ -413,75 +472,349 @@ function OpenCloakroomMenu() end menu.close() - CurrentAction = 'ambulance_actions_menu' - CurrentActionMsg = _U('open_menu') - CurrentActionData = {} end, function(data, menu) menu.close() end) end -function OpenVehicleSpawnerMenu() +function OpenVehicleSpawnerMenu(hospital, partNum) ESX.UI.Menu.CloseAll() - if Config.EnableSocietyOwnedVehicles then - - local elements = {} - - ESX.TriggerServerCallback('esx_society:getVehiclesInGarage', function(vehicles) - for i=1, #vehicles, 1 do - table.insert(elements, { - label = GetDisplayNameFromVehicleModel(vehicles[i].model) .. ' [' .. vehicles[i].plate .. ']', - value = vehicles[i] - }) - end - - ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'vehicle_spawner', - { - title = _U('veh_menu'), - align = 'top-left', - elements = elements - }, function(data, menu) - menu.close() - - local vehicleProps = data.current.value - ESX.Game.SpawnVehicle(vehicleProps.model, Config.Zones.VehicleSpawnPoint.Pos, 230.0, function(vehicle) - ESX.Game.SetVehicleProperties(vehicle, vehicleProps) - local playerPed = PlayerPedId() - TaskWarpPedIntoVehicle(playerPed, vehicle, -1) - end) - TriggerServerEvent('esx_society:removeVehicleFromGarage', 'ambulance', vehicleProps) - end, function(data, menu) - menu.close() - CurrentAction = 'vehicle_spawner_menu' - CurrentActionMsg = _U('veh_spawn') - CurrentActionData = {} - end) - end, 'ambulance') - - else -- not society vehicles - ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'vehicle_spawner', { - title = _U('veh_menu'), - align = 'top-left', - elements = Config.AuthorizedVehicles + title = _U('garage_title'), + align = 'top-left', + elements = Config.AuthorizedVehicles }, function(data, menu) menu.close() - ESX.Game.SpawnVehicle(data.current.model, Config.Zones.VehicleSpawnPoint.Pos, 230.0, function(vehicle) - local playerPed = PlayerPedId() - TaskWarpPedIntoVehicle(playerPed, vehicle, -1) - end) + local foundSpawn, spawnPoint = GetAvailableVehicleSpawnPoint(hospital, 'Vehicles', partNum) + + if foundSpawn then + ESX.Game.SpawnVehicle(data.current.model, spawnPoint.coords, spawnPoint.heading, function(vehicle) + local playerPed = PlayerPedId() + TaskWarpPedIntoVehicle(playerPed, vehicle, -1) + end) + end end, function(data, menu) menu.close() - CurrentAction = 'vehicle_spawner_menu' - CurrentActionMsg = _U('veh_spawn') - CurrentActionData = {} + end) +end + +function GetAvailableVehicleSpawnPoint(hospital, part, partNum) + local spawnPoints = Config.Hospitals[hospital][part][partNum].SpawnPoints + local found, foundSpawnPoint = false, nil + + for i=1, #spawnPoints, 1 do + if ESX.Game.IsSpawnPointClear(spawnPoints[i].coords, spawnPoints[i].radius) then + found, foundSpawnPoint = true, spawnPoints[i] + break + end + end + + if found then + return true, foundSpawnPoint + else + ESX.ShowNotification(_U('garage_blocked')) + return false + end +end + +function OpenHelicopterSpawnerMenu(hospital, partNum) + local playerCoords = GetEntityCoords(PlayerPedId()) + local elements = { + {label = _U('helicopter_garage'), action = 'garage'}, + {label = _U('helicopter_store'), action = 'store_garage'}, + {label = _U('helicopter_buy'), action = 'buy_helicopter'} + } + + ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'helicopter_spawner', { + title = _U('helicopter_title'), + align = 'top-left', + elements = elements + }, function(data, menu) + + if data.current.action == 'buy_helicopter' then + local shopCoords = Config.Hospitals[hospital].Helicopters[partNum].InsideShop + local shopElements = {} + + local authorizedHelicopters = Config.AuthorizedHelicopters[ESX.PlayerData.job.grade_name] + + if #authorizedHelicopters > 0 then + for k,helicopter in ipairs(authorizedHelicopters) do + table.insert(shopElements, { + label = ('%s - %s'):format(helicopter.label, _U('shop_item', ESX.Math.GroupDigits(helicopter.price))), + name = helicopter.label, + model = helicopter.model, + price = helicopter.price, + type = 'helicopter' + }) + end + else + ESX.ShowNotification(_U('helicopter_notauthorized')) + return + end + + OpenShopMenu(shopElements, playerCoords, shopCoords) + elseif data.current.action == 'garage' then + local garage = {} + + ESX.TriggerServerCallback('esx_vehicleshop:retrieveJobVehicles', function(jobVehicles) + if #jobVehicles > 0 then + for k,v in ipairs(jobVehicles) do + local props = json.decode(v.vehicle) + local vehicleName = GetLabelText(GetDisplayNameFromVehicleModel(props.model)) + local label = ('%s - %s: '):format(vehicleName, props.plate) + + if v.stored then + label = label .. ('%s'):format(_U('garage_stored')) + else + label = label .. ('%s'):format(_U('garage_notstored')) + end + + table.insert(garage, { + label = label, + stored = v.stored, + model = props.model, + vehicleProps = props + }) + end + + ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'helicopter_garage', { + title = _U('helicopter_garage_title'), + align = 'top-left', + elements = garage + }, function(data2, menu2) + if data2.current.stored then + local foundSpawn, spawnPoint = GetAvailableVehicleSpawnPoint(hospital, 'Helicopters', partNum) + + if foundSpawn then + menu2.close() + + ESX.Game.SpawnVehicle(data2.current.model, spawnPoint.coords, spawnPoint.heading, function(vehicle) + ESX.Game.SetVehicleProperties(vehicle, data2.current.vehicleProps) + + TriggerServerEvent('esx_vehicleshop:setJobVehicleState', data2.current.vehicleProps.plate, false) + ESX.ShowNotification(_U('garage_released')) + end) + end + else + ESX.ShowNotification(_U('garage_notavailable')) + end + end, function(data2, menu2) + menu2.close() + end) + + else + ESX.ShowNotification(_U('garage_empty')) + end + end, 'helicopter') + + elseif data.current.action == 'store_garage' then + local vehicles, vehiclePlates = ESX.Game.GetVehiclesInArea(playerCoords, 30.0), {} + + if #vehicles > 0 then + for k,v in ipairs(vehicles) do + + -- Make sure the vehicle we're saving is empty, or else it wont be deleted + if GetVehicleNumberOfPassengers(v) == 0 and IsVehicleSeatFree(v, -1) then + table.insert(vehiclePlates, { + vehicle = v, + plate = ESX.Math.Trim(GetVehicleNumberPlateText(v)) + }) + end + end + else + ESX.ShowNotification(_U('garage_store_nearby')) + return + end + + ESX.TriggerServerCallback('esx_ambulancejob:storeNearbyVehicle', function(storeSuccess, foundNum) + if storeSuccess then + local vehicleId = vehiclePlates[foundNum] + local attempts = 0 + ESX.Game.DeleteVehicle(vehicleId.vehicle) + IsBusy = true + + Citizen.CreateThread(function() + while IsBusy do + Citizen.Wait(0) + drawLoadingText(_U('garage_storing'), 255, 255, 255, 255) + end + end) + + -- Workaround for vehicle not deleting when other players are near it. + while DoesEntityExist(vehicleId.vehicle) do + Citizen.Wait(500) + attempts = attempts + 1 + + -- Give up + if attempts > 30 then + break + end + + vehicles = ESX.Game.GetVehiclesInArea(playerCoords, 30.0) + if #vehicles > 0 then + for k,v in ipairs(vehicles) do + if ESX.Math.Trim(GetVehicleNumberPlateText(v)) == vehicleId.plate then + ESX.Game.DeleteVehicle(v) + break + end + end + end + end + + IsBusy = false + ESX.ShowNotification(_U('garage_has_stored')) + else + ESX.ShowNotification(_U('garage_has_notstored')) + end + end, vehiclePlates) + + end + + end, function(data, menu) + menu.close() + end) + +end + +function OpenShopMenu(elements, restoreCoords, shopCoords) + local playerPed = PlayerPedId() + isInShopMenu = true + + ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'vehicle_shop', { + title = _U('vehicleshop_title'), + align = 'top-left', + elements = elements + }, function(data, menu) + + ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'vehicle_shop_confirm', + { + title = _U('vehicleshop_confirm', data.current.name, data.current.price), + align = 'top-left', + elements = { + { label = _U('confirm_no'), value = 'no' }, + { label = _U('confirm_yes'), value = 'yes' } + } + }, function(data2, menu2) + + if data2.current.value == 'yes' then + local newPlate = exports['esx_vehicleshop']:GeneratePlate() + local vehicle = GetVehiclePedIsIn(playerPed, false) + local props = ESX.Game.GetVehicleProperties(vehicle) + props.plate = newPlate + + ESX.TriggerServerCallback('esx_ambulancejob:buyJobVehicle', function (bought) + if bought then + ESX.ShowNotification(_U('vehicleshop_bought', data.current.name, ESX.Math.GroupDigits(data.current.price))) + + isInShopMenu = false + ESX.UI.Menu.CloseAll() + + DeleteSpawnedVehicles() + FreezeEntityPosition(playerPed, false) + SetEntityVisible(playerPed, true) + + ESX.Game.Teleport(playerPed, restoreCoords) + else + ESX.ShowNotification(_U('vehicleshop_money')) + menu2.close() + end + end, props) + else + menu2.close() + end + + end, function(data2, menu2) + menu2.close() end) + end, function(data, menu) + isInShopMenu = false + ESX.UI.Menu.CloseAll() + + DeleteSpawnedVehicles() + FreezeEntityPosition(playerPed, false) + SetEntityVisible(playerPed, true) + + ESX.Game.Teleport(playerPed, restoreCoords) + end, function(data, menu) + DeleteSpawnedVehicles() + + WaitForVehicleToLoad(data.current.model) + ESX.Game.SpawnLocalVehicle(data.current.model, shopCoords, 0.0, function(vehicle) + table.insert(spawnedVehicles, vehicle) + TaskWarpPedIntoVehicle(playerPed, vehicle, -1) + FreezeEntityPosition(vehicle, true) + end) + end) + + WaitForVehicleToLoad(elements[1].model) + ESX.Game.SpawnLocalVehicle(elements[1].model, shopCoords, 0.0, function(vehicle) + table.insert(spawnedVehicles, vehicle) + TaskWarpPedIntoVehicle(playerPed, vehicle, -1) + FreezeEntityPosition(vehicle, true) + end) +end + +Citizen.CreateThread(function() + while true do + Citizen.Wait(0) + + if isInShopMenu then + DisableControlAction(0, 75, true) -- Disable exit vehicle + DisableControlAction(27, 75, true) -- Disable exit vehicle + else + Citizen.Wait(500) + end end +end) + +function DeleteSpawnedVehicles() + while #spawnedVehicles > 0 do + local vehicle = spawnedVehicles[1] + ESX.Game.DeleteVehicle(vehicle) + table.remove(spawnedVehicles, 1) + end +end + +function WaitForVehicleToLoad(modelHash) + modelHash = (type(modelHash) == 'number' and modelHash or GetHashKey(modelHash)) + + if not HasModelLoaded(modelHash) then + RequestModel(modelHash) + + while not HasModelLoaded(modelHash) do + Citizen.Wait(0) + + DisableControlAction(0, Keys['TOP'], true) + DisableControlAction(0, Keys['DOWN'], true) + DisableControlAction(0, Keys['LEFT'], true) + DisableControlAction(0, Keys['RIGHT'], true) + DisableControlAction(0, 176, true) -- ENTER key + DisableControlAction(0, Keys['BACKSPACE'], true) + + drawLoadingText(_U('vehicleshop_awaiting_model'), 255, 255, 255, 255) + end + end +end + +function drawLoadingText(text, red, green, blue, alpha) + SetTextFont(4) + SetTextProportional(0) + SetTextScale(0.0, 0.5) + SetTextColour(red, green, blue, alpha) + SetTextDropShadow(0, 0, 0, 0, 255) + SetTextEdge(1, 0, 0, 0, 255) + SetTextDropShadow() + SetTextOutline() + SetTextCentre(true) + + BeginTextCommandDisplayText("STRING") + AddTextComponentSubstringPlayerName(text) + EndTextCommandDisplayText(0.5, 0.5) end function OpenPharmacyMenu() @@ -489,8 +822,8 @@ function OpenPharmacyMenu() ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'pharmacy', { - title = _U('pharmacy_menu_title'), - align = 'top-left', + title = _U('pharmacy_menu_title'), + align = 'top-left', elements = { {label = _U('pharmacy_take', _U('medikit')), value = 'medikit'}, {label = _U('pharmacy_take', _U('bandage')), value = 'bandage'} @@ -499,25 +832,16 @@ function OpenPharmacyMenu() TriggerServerEvent('esx_ambulancejob:giveItem', data.current.value) end, function(data, menu) menu.close() - - CurrentAction = 'pharmacy' - CurrentActionMsg = _U('open_pharmacy') - CurrentActionData = {} end) end function WarpPedInClosestVehicle(ped) local coords = GetEntityCoords(ped) - local vehicle, distance = ESX.Game.GetClosestVehicle({ - x = coords.x, - y = coords.y, - z = coords.z - }) + local vehicle, distance = ESX.Game.GetClosestVehicle(coords) if distance ~= -1 and distance <= 5.0 then - local maxSeats = GetVehicleMaxNumberOfPassengers(vehicle) - local freeSeat = nil + local maxSeats, freeSeat = GetVehicleMaxNumberOfPassengers(vehicle) for i=maxSeats - 1, 0, -1 do if IsVehicleSeatFree(vehicle, i) then @@ -526,7 +850,7 @@ function WarpPedInClosestVehicle(ped) end end - if freeSeat ~= nil then + if freeSeat then TaskWarpPedIntoVehicle(ped, vehicle, freeSeat) end else @@ -548,4 +872,4 @@ AddEventHandler('esx_ambulancejob:heal', function(healType) end ESX.ShowNotification(_U('healed')) -end) \ No newline at end of file +end) diff --git a/client/main.lua b/client/main.lua index f4f4e679..623e73b4 100644 --- a/client/main.lua +++ b/client/main.lua @@ -60,6 +60,22 @@ AddEventHandler('playerSpawned', function() end end) +-- Create blips +Citizen.CreateThread(function() + for k,v in pairs(Config.Hospitals) do + local blip = AddBlipForCoord(v.Blip.coords) + + SetBlipSprite(blip, v.Blip.sprite) + SetBlipScale(blip, v.Blip.scale) + SetBlipColour(blip, v.Blip.color) + SetBlipAsShortRange(blip, true) + + BeginTextCommandSetBlipName('STRING') + AddTextComponentSubstringPlayerName(_U('hospital')) + EndTextCommandSetBlipName(blip) + end +end) + -- Disable most inputs when dead Citizen.CreateThread(function() while true do @@ -108,6 +124,14 @@ function StartDistressSignal() if IsControlPressed(0, Keys['G']) then SendDistressSignal() + + Citizen.CreateThread(function() + Citizen.Wait(1000 * 60 * 5) + if IsDead then + StartDistressSignal() + end + end) + break end end @@ -116,7 +140,7 @@ end function SendDistressSignal() local playerPed = PlayerPedId() - local coords = GetEntityCoords(playerPed) + local coords = GetEntityCoords(playerPed) ESX.ShowNotification(_U('distress_sent')) TriggerServerEvent('esx_phone:send', 'ambulance', _U('distress_message'), false, { @@ -273,20 +297,6 @@ function RespawnPed(ped, coords) ESX.UI.Menu.CloseAll() end -function TeleportFadeEffect(entity, coords) - Citizen.CreateThread(function() - DoScreenFadeOut(800) - - while not IsScreenFadedOut() do - Citizen.Wait(0) - end - - ESX.Game.Teleport(entity, coords, function() - DoScreenFadeIn(800) - end) - end) -end - RegisterNetEvent('esx_phone:loaded') AddEventHandler('esx_phone:loaded', function(phoneNumber, contacts) local specialContact = { @@ -305,7 +315,7 @@ end) RegisterNetEvent('esx_ambulancejob:revive') AddEventHandler('esx_ambulancejob:revive', function() local playerPed = PlayerPedId() - local coords = GetEntityCoords(playerPed) + local coords = GetEntityCoords(playerPed) TriggerServerEvent('esx_ambulancejob:setDeathStatus', false) Citizen.CreateThread(function() diff --git a/config.lua b/config.lua index 9b71a678..9ace4628 100644 --- a/config.lua +++ b/config.lua @@ -1,11 +1,13 @@ Config = {} Config.DrawDistance = 100.0 -Config.MarkerColor = { r = 102, g = 0, b = 102 } -Config.MarkerSize = { x = 1.5, y = 1.5, z = 1.0 } + +Config.Marker = { type = 1, x = 1.5, y = 1.5, z = 1.0, r = 102, g = 0, b = 102, rotate = false } + Config.ReviveReward = 700 -- revive reward, set to 0 if you don't want it enabled Config.AntiCombatLog = true -- enable anti-combat logging? Config.LoadIpl = true -- disable if you're using fivem-ipl or other IPL loaders + Config.Locale = 'fr' local second = 1000 @@ -21,24 +23,156 @@ Config.RemoveWeaponsAfterRPDeath = true Config.RemoveCashAfterRPDeath = true Config.RemoveItemsAfterRPDeath = true --- Let the player pay for respawning early, if he can afford it. +-- Let the player pay for respawning early, only if he can afford it. Config.EarlyRespawnFine = false Config.EarlyRespawnFineAmount = 5000 -Config.Blip = { - Pos = { x = 307.76, y = -1433.47, z = 28.97 }, - Sprite = 61, - Display = 4, - Scale = 1.2, - Colour = 2 +Config.Hospitals = { + + CentralLosSantos = { + + Blip = { + coords = vector3(307.7, -1433.4, 28.9), + sprite = 61, + scale = 1.2, + color = 2 + }, + + AmbulanceActions = { + vector3(268.4, -1363.3, 23.5) + }, + + Pharmacies = { + vector3(230.1, -1366.1, 38.5) + }, + + Vehicles = { + { + Spawner = vector3(307.7, -1433.4, 30.0), + Marker = { type = 36, x = 1.0, y = 1.0, z = 1.0, r = 100, g = 50, b = 200, a = 100, rotate = true }, + SpawnPoints = { + { coords = vector3(297.2, -1429.5, 29.8), heading = 227.6, radius = 4.0 }, + { coords = vector3(294.0, -1433.1, 29.8), heading = 227.6, radius = 4.0 }, + { coords = vector3(309.4, -1442.5, 29.8), heading = 227.6, radius = 6.0 } + } + } + }, + + Helicopters = { + { + Spawner = vector3(317.5, -1449.5, 46.5), + InsideShop = vector3(305.6, -1419.7, 41.5), + Marker = { type = 34, x = 1.5, y = 1.5, z = 1.5, r = 100, g = 150, b = 150, a = 100, rotate = true }, + SpawnPoints = { + { coords = vector3(313.5, -1465.1, 46.5), heading = 142.7, radius = 10.0 }, + { coords = vector3(299.5, -1453.2, 46.5), heading = 142.7, radius = 10.0 } + } + } + }, + + VehicleDeleters = { + vector3(327.6, -1481.1, 28.8) + }, + + FastTravels = { + { + From = vector3(294.7, -1448.1, 29.0), + To = { coords = vector3(272.8, -1358.8, 23.5), heading = 0.0 }, + Marker = { type = 1, x = 2.0, y = 2.0, z = 0.5, r = 102, g = 0, b = 102, rotate = false } + }, + + { + From = vector3(275.3, -1361, 23.5), + To = { coords = vector3(295.8, -1446.5, 28.9), heading = 0.0 }, + Marker = { type = 1, x = 2.0, y = 2.0, z = 0.5, r = 102, g = 0, b = 102, rotate = false } + }, + + { + From = vector3(247.3, -1371.5, 23.5), + To = { coords = vector3(333.1, -1434.9, 45.5), heading = 138.6 }, + Marker = { type = 1, x = 1.5, y = 1.5, z = 0.5, r = 102, g = 0, b = 102, rotate = false } + }, + + { + From = vector3(335.5, -1432.0, 45.50), + To = { coords = vector3(249.1, -1369.6, 23.5), heading = 0.0 }, + Marker = { type = 1, x = 2.0, y = 2.0, z = 0.5, r = 102, g = 0, b = 102, rotate = false } + }, + + { + From = vector3(234.5, -1373.7, 20.9), + To = { coords = vector3(320.9, -1478.6, 28.8), heading = 0.0 }, + Marker = { type = 1, x = 1.5, y = 1.5, z = 1.0, r = 102, g = 0, b = 102, rotate = false } + }, + + { + From = vector3(317.9, -1476.1, 28.9), + To = { coords = vector3(238.6, -1368.4, 23.5), heading = 0.0 }, + Marker = { type = 1, x = 1.5, y = 1.5, z = 1.0, r = 102, g = 0, b = 102, rotate = false } + } + }, + + FastTravelsPrompt = { + { + From = vector3(237.4, -1373.8, 26.0), + To = { coords = vector3(251.9, -1363.3, 38.5), heading = 0.0 }, + Marker = { type = 1, x = 1.5, y = 1.5, z = 0.5, r = 102, g = 0, b = 102, rotate = false }, + Prompt = _U('fast_travel') + }, + + { + From = vector3(256.5, -1357.7, 36.0), + To = { coords = vector3(235.4, -1372.8, 26.3), heading = 0.0 }, + Marker = { type = 1, x = 1.5, y = 1.5, z = 0.5, r = 102, g = 0, b = 102, rotate = false }, + Prompt = _U('fast_travel') + } + } + + } } -Config.HelicopterSpawner = { - SpawnPoint = { x = 313.33, y = -1465.2, z = 45.5 }, - Heading = 0.0 +Config.AuthorizedHelicopters = { + + ambulance = {}, + + doctor = { + { + model = 'buzzard2', + label = 'Nagasaki Buzzard', + price = 150000 + } + }, + + chief_doctor = { + { + model = 'buzzard2', + label = 'Nagasaki Buzzard', + price = 150000 + }, + + { + model = 'seasparrow', + label = 'Sea Sparrow', + price = 300000 + } + }, + + boss = { + { + model = 'buzzard2', + label = 'Nagasaki Buzzard', + price = 100000 + }, + + { + model = 'seasparrow', + label = 'Sea Sparrow', + price = 250000 + } + } + } --- https://wiki.rage.mp/index.php?title=Vehicles Config.AuthorizedVehicles = { { @@ -47,112 +181,3 @@ Config.AuthorizedVehicles = { } } - -Config.Zones = { - - HospitalInteriorEntering1 = { -- Main entrance - Pos = { x = 294.2, y = -1448.60, z = 29.0 }, - Type = 1 - }, - - HospitalInteriorInside1 = { - Pos = { x = 272.8, y = -1358.8, z = 23.5 }, - Type = -1 - }, - - HospitalInteriorOutside1 = { - Pos = { x = 295.8, y = -1446.5, z = 28.9 }, - Type = -1 - }, - - HospitalInteriorExit1 = { - Pos = { x = 275.7, y = -1361.5, z = 23.5 }, - Type = 1 - }, - - HospitalInteriorEntering2 = { -- Lift go to the roof - Pos = { x = 247.1, y = -1371.4, z = 23.5 }, - Type = 1 - }, - - HospitalInteriorInside2 = { -- Roof outlet - Pos = { x = 333.1, y = -1434.9, z = 45.5 }, - Type = -1 - }, - - HospitalInteriorOutside2 = { -- Lift back from roof - Pos = { x = 249.1, y = -1369.6, z = 23.5 }, - Type = -1 - }, - - HospitalInteriorExit2 = { -- Roof entrance - Pos = { x = 335.5, y = -1432.0, z = 45.5 }, - Type = 1 - }, - - AmbulanceActions = { -- Cloakroom - Pos = { x = 268.4, y = -1363.330, z = 23.5 }, - Type = 1 - }, - - VehicleSpawner = { - Pos = { x = 307.76, y = -1433.47, z = 28.97 }, - Type = 1 - }, - - VehicleSpawnPoint = { - Pos = { x = 304.87, y = -1437.69, z = 28.80 }, - Type = -1 - }, - - VehicleDeleter = { - Pos = { x = 327.67, y = -1481.1, z = 28.83 }, - Type = 1 - }, - - Pharmacy = { - Pos = { x = 230.13, y = -1366.18, z = 38.53 }, - Type = 1 - }, - - ParkingDoorGoOutInside = { - Pos = { x = 234.56, y = -1373.77, z = 20.97 }, - Type = 1 - }, - - ParkingDoorGoOutOutside = { - Pos = { x = 320.98, y = -1478.62, z = 28.81 }, - Type = -1 - }, - - ParkingDoorGoInInside = { - Pos = { x = 238.64, y = -1368.48, z = 23.53 }, - Type = -1 - }, - - ParkingDoorGoInOutside = { - Pos = { x = 317.97, y = -1476.13, z = 28.97 }, - Type = 1 - }, - - StairsGoTopTop = { - Pos = { x = 251.91, y = -1363.3, z = 38.53 }, - Type = -1 - }, - - StairsGoTopBottom = { - Pos = { x = 237.45, y = -1373.89, z = 26.30 }, - Type = -1 - }, - - StairsGoBottomTop = { - Pos = { x = 256.58, y = -1357.7, z = 37.30 }, - Type = -1 - }, - - StairsGoBottomBottom = { - Pos = { x = 235.45, y = -1372.89, z = 26.30 }, - Type = -1 - } - -} diff --git a/locales/br.lua b/locales/br.lua index f505145a..8e242216 100644 --- a/locales/br.lua +++ b/locales/br.lua @@ -4,11 +4,35 @@ Locales['br'] = { ['ems_clothes_civil'] = 'Roupa Normal', ['ems_clothes_ems'] = 'Entrar como Socorrista', -- Vehicles - ['veh_menu'] = 'véhicule', - ['veh_spawn'] = 'Aperte ~INPUT_CONTEXT~ para pegar veiculo', - ['store_veh'] = 'Aperte ~INPUT_CONTEXT~ para guardar Veiculo ', - ['ambulance'] = 'Ambulancia', - ['helicopter'] = 'Helicoptero', + ['store_veh'] = 'press ~INPUT_CONTEXT~ to store the vehicle', + ['ambulance'] = 'ambulance', + ['helicopter_prompt'] = 'press ~INPUT_CONTEXT~ to access the ~y~Helicopter Actions~s~.', + ['helicopter_buy'] = 'helicopter shop', + ['helicopter_garage'] = 'open garage', + ['helicopter_store'] = 'store helicopter in garage', + ['helicopter_garage_title'] = 'helicopter Garage', + ['helicopter_title'] = 'helicopter Actions', + ['helicopter_notauthorized'] = 'you\'re not authorized to buy helicopters.', + ['garage_prompt'] = 'press ~INPUT_CONTEXT~ to access the ~y~Vehicle Actions~s~.', + ['garage_title'] = 'vehicle Actions', + ['garage_stored'] = 'stored', + ['garage_notstored'] = 'not in garage', + ['garage_storing'] = 'we\'re attempting to remove the vehicle, make sure no players are around it.', + ['garage_has_stored'] = 'the vehicle has been stored in your garage', + ['garage_has_notstored'] = 'no nearby owned vehicles were found', + ['garage_notavailable'] = 'your vehicle is not stored in the garage.', + ['garage_blocked'] = 'there\'s no available spawn points!', + ['garage_empty'] = 'you dont have any vehicles in your garage.', + ['garage_released'] = 'your vehicle has been released from the garage.', + ['garage_store_nearby'] = 'there is no nearby vehicles.', + ['shop_item'] = '$%s', + ['vehicleshop_title'] = 'vehicle Shop', + ['vehicleshop_confirm'] = 'do you want to buy this vehicle?', + ['vehicleshop_bought'] = 'you have bought ~y~%s~s~ for ~r~$%s~s~', + ['vehicleshop_money'] = 'you cannot afford that vehicle', + ['vehicleshop_awaiting_model'] = 'the vehicle is currently ~g~DOWNLOADING & LOADING~s~ please wait', + ['confirm_no'] = 'no', + ['confirm_yes'] = 'yes', -- Action Menu ['hospital'] = 'Hôspital', ['revive_inprogress'] = 'Reanimação em andamento', @@ -24,7 +48,7 @@ Locales['br'] = { ['boss_actions'] = 'Menu Administração', -- Misc ['invalid_amount'] = '~r~Quantidade inválida', - ['open_menu'] = 'Aperte ~INPUT_CONTEXT~ para abrir o menu', + ['actions_prompt'] = 'press ~INPUT_CONTEXT~ access the ~y~Ambulance Actions~s~.', ['deposit_amount'] = 'Quantidade inválida para deposito', ['money_withdraw'] = 'Quantidade a ser retirada', ['fast_travel'] = 'Aperte ~INPUT_CONTEXT~ para mover-se rapidamente.', diff --git a/locales/cs.lua b/locales/cs.lua index 525538de..97830152 100644 --- a/locales/cs.lua +++ b/locales/cs.lua @@ -4,11 +4,35 @@ Locales['cs'] = { ['ems_clothes_civil'] = 'civilní oblečení', ['ems_clothes_ems'] = 'zdravotnické oblečení', -- Vehicles - ['veh_menu'] = 'vozidlo', - ['veh_spawn'] = 'stiskněte ~INPUT_CONTEXT~ k vyzvednutí vozidla nebo helikoptéry', - ['store_veh'] = 'stiskněte ~INPUT_CONTEXT~ k vrácení vozidla', - ['ambulance'] = 'sanitka', - ['helicopter'] = 'helikoptéra', + ['store_veh'] = 'press ~INPUT_CONTEXT~ to store the vehicle', + ['ambulance'] = 'ambulance', + ['helicopter_prompt'] = 'press ~INPUT_CONTEXT~ to access the ~y~Helicopter Actions~s~.', + ['helicopter_buy'] = 'helicopter shop', + ['helicopter_garage'] = 'open garage', + ['helicopter_store'] = 'store helicopter in garage', + ['helicopter_garage_title'] = 'helicopter Garage', + ['helicopter_title'] = 'helicopter Actions', + ['helicopter_notauthorized'] = 'you\'re not authorized to buy helicopters.', + ['garage_prompt'] = 'press ~INPUT_CONTEXT~ to access the ~y~Vehicle Actions~s~.', + ['garage_title'] = 'vehicle Actions', + ['garage_stored'] = 'stored', + ['garage_notstored'] = 'not in garage', + ['garage_storing'] = 'we\'re attempting to remove the vehicle, make sure no players are around it.', + ['garage_has_stored'] = 'the vehicle has been stored in your garage', + ['garage_has_notstored'] = 'no nearby owned vehicles were found', + ['garage_notavailable'] = 'your vehicle is not stored in the garage.', + ['garage_blocked'] = 'there\'s no available spawn points!', + ['garage_empty'] = 'you dont have any vehicles in your garage.', + ['garage_released'] = 'your vehicle has been released from the garage.', + ['garage_store_nearby'] = 'there is no nearby vehicles.', + ['shop_item'] = '$%s', + ['vehicleshop_title'] = 'vehicle Shop', + ['vehicleshop_confirm'] = 'do you want to buy this vehicle?', + ['vehicleshop_bought'] = 'you have bought ~y~%s~s~ for ~r~$%s~s~', + ['vehicleshop_money'] = 'you cannot afford that vehicle', + ['vehicleshop_awaiting_model'] = 'the vehicle is currently ~g~DOWNLOADING & LOADING~s~ please wait', + ['confirm_no'] = 'no', + ['confirm_yes'] = 'yes', -- Action Menu ['hospital'] = 'nemocnice', ['revive_inprogress'] = 'probíhá oživení!', @@ -24,7 +48,7 @@ Locales['cs'] = { ['boss_actions'] = 'akce šéfa', -- Misc ['invalid_amount'] = '~r~neplatná částka', - ['open_menu'] = 'stiskněte ~INPUT_CONTEXT~ k otevření menu', + ['actions_prompt'] = 'press ~INPUT_CONTEXT~ access the ~y~Ambulance Actions~s~.', ['deposit_amount'] = 'částka vkladu', ['money_withdraw'] = 'částka výběru', ['fast_travel'] = 'stiskněte ~INPUT_CONTEXT~ k rychlému odcestování.', diff --git a/locales/en.lua b/locales/en.lua index ca1b0d39..6630b045 100644 --- a/locales/en.lua +++ b/locales/en.lua @@ -4,11 +4,35 @@ Locales['en'] = { ['ems_clothes_civil'] = 'civilian Clothes', ['ems_clothes_ems'] = 'EMS Clothes', -- Vehicles - ['veh_menu'] = 'vehicle', - ['veh_spawn'] = 'press ~INPUT_CONTEXT~ to get a Vehicle or Helicopter', ['store_veh'] = 'press ~INPUT_CONTEXT~ to store the vehicle', ['ambulance'] = 'ambulance', - ['helicopter'] = 'helicopter', + ['helicopter_prompt'] = 'press ~INPUT_CONTEXT~ to access the ~y~Helicopter Actions~s~.', + ['helicopter_buy'] = 'helicopter shop', + ['helicopter_garage'] = 'open garage', + ['helicopter_store'] = 'store helicopter in garage', + ['helicopter_garage_title'] = 'helicopter Garage', + ['helicopter_title'] = 'helicopter Actions', + ['helicopter_notauthorized'] = 'you\'re not authorized to buy helicopters.', + ['garage_prompt'] = 'press ~INPUT_CONTEXT~ to access the ~y~Vehicle Actions~s~.', + ['garage_title'] = 'vehicle Actions', + ['garage_stored'] = 'stored', + ['garage_notstored'] = 'not in garage', + ['garage_storing'] = 'we\'re attempting to remove the vehicle, make sure no players are around it.', + ['garage_has_stored'] = 'the vehicle has been stored in your garage', + ['garage_has_notstored'] = 'no nearby owned vehicles were found', + ['garage_notavailable'] = 'your vehicle is not stored in the garage.', + ['garage_blocked'] = 'there\'s no available spawn points!', + ['garage_empty'] = 'you dont have any vehicles in your garage.', + ['garage_released'] = 'your vehicle has been released from the garage.', + ['garage_store_nearby'] = 'there is no nearby vehicles.', + ['shop_item'] = '$%s', + ['vehicleshop_title'] = 'vehicle Shop', + ['vehicleshop_confirm'] = 'do you want to buy this vehicle?', + ['vehicleshop_bought'] = 'you have bought ~y~%s~s~ for ~r~$%s~s~', + ['vehicleshop_money'] = 'you cannot afford that vehicle', + ['vehicleshop_awaiting_model'] = 'the vehicle is currently ~g~DOWNLOADING & LOADING~s~ please wait', + ['confirm_no'] = 'no', + ['confirm_yes'] = 'yes', -- Action Menu ['hospital'] = 'hospital', ['revive_inprogress'] = 'a revive is in progress!', @@ -23,8 +47,8 @@ Locales['en'] = { -- Boss Menu ['boss_actions'] = 'boss Actions', -- Misc - ['invalid_amount'] = '~r~invalid amount', - ['open_menu'] = 'press ~INPUT_CONTEXT~ to open the menu', + ['invalid_amount'] = '~r~Invalid amount', + ['actions_prompt'] = 'press ~INPUT_CONTEXT~ access the ~y~Ambulance Actions~s~.', ['deposit_amount'] = 'deposit Amount', ['money_withdraw'] = 'amount withdrawn', ['fast_travel'] = 'press ~INPUT_CONTEXT~ to fast travel.', diff --git a/locales/es.lua b/locales/es.lua index aea37cb3..d5632333 100644 --- a/locales/es.lua +++ b/locales/es.lua @@ -4,11 +4,35 @@ Locales['es'] = { ['ems_clothes_civil'] = 'Camiseta', ['ems_clothes_ems'] = 'Equipo de ambulancia', -- Vehicles - ['veh_menu'] = 'vehículo', - ['veh_spawn'] = 'Presione ~INPUT_CONTEXT~ para sacar un vehículo', - ['store_veh'] = 'Presione ~INPUT_CONTEXT~ para alamcenar un vehículo', - ['ambulance'] = 'Ambulancia', - ['helicopter'] = 'helicóptero', + ['store_veh'] = 'press ~INPUT_CONTEXT~ to store the vehicle', + ['ambulance'] = 'ambulance', + ['helicopter_prompt'] = 'press ~INPUT_CONTEXT~ to access the ~y~Helicopter Actions~s~.', + ['helicopter_buy'] = 'helicopter shop', + ['helicopter_garage'] = 'open garage', + ['helicopter_store'] = 'store helicopter in garage', + ['helicopter_garage_title'] = 'helicopter Garage', + ['helicopter_title'] = 'helicopter Actions', + ['helicopter_notauthorized'] = 'you\'re not authorized to buy helicopters.', + ['garage_prompt'] = 'press ~INPUT_CONTEXT~ to access the ~y~Vehicle Actions~s~.', + ['garage_title'] = 'vehicle Actions', + ['garage_stored'] = 'stored', + ['garage_notstored'] = 'not in garage', + ['garage_storing'] = 'we\'re attempting to remove the vehicle, make sure no players are around it.', + ['garage_has_stored'] = 'the vehicle has been stored in your garage', + ['garage_has_notstored'] = 'no nearby owned vehicles were found', + ['garage_notavailable'] = 'your vehicle is not stored in the garage.', + ['garage_blocked'] = 'there\'s no available spawn points!', + ['garage_empty'] = 'you dont have any vehicles in your garage.', + ['garage_released'] = 'your vehicle has been released from the garage.', + ['garage_store_nearby'] = 'there is no nearby vehicles.', + ['shop_item'] = '$%s', + ['vehicleshop_title'] = 'vehicle Shop', + ['vehicleshop_confirm'] = 'do you want to buy this vehicle?', + ['vehicleshop_bought'] = 'you have bought ~y~%s~s~ for ~r~$%s~s~', + ['vehicleshop_money'] = 'you cannot afford that vehicle', + ['vehicleshop_awaiting_model'] = 'the vehicle is currently ~g~DOWNLOADING & LOADING~s~ please wait', + ['confirm_no'] = 'no', + ['confirm_yes'] = 'yes', -- Action Menu ['hospital'] = 'hospital', ['revive_inprogress'] = 'reanimación en curso', @@ -24,7 +48,7 @@ Locales['es'] = { ['boss_actions'] = 'boss Actions', -- Misc ['invalid_amount'] = '~r~cantidad no válida', - ['open_menu'] = 'Presione ~INPUT_CONTEXT~ para abrir el menú', + ['actions_prompt'] = 'press ~INPUT_CONTEXT~ access the ~y~Ambulance Actions~s~.', ['deposit_amount'] = 'cantidad de fianza depositada', ['money_withdraw'] = 'cantidad de fianza retirada', ['fast_travel'] = 'Press ~INPUT_CONTEXT~ to fast travel.', diff --git a/locales/fi.lua b/locales/fi.lua index c98a53af..0d0d8e21 100644 --- a/locales/fi.lua +++ b/locales/fi.lua @@ -4,11 +4,35 @@ Locales['fi'] = { ['ems_clothes_civil'] = 'Siviilikamppeet', ['ems_clothes_ems'] = 'Työkamppeet', -- Vehicles - ['veh_menu'] = 'ajoneuvo', - ['veh_spawn'] = 'paina ~INPUT_CONTEXT~ otaaksesi ajoneuvon', - ['store_veh'] = 'paina ~INPUT_CONTEXT~ laittaaksesi auto säilöön', - ['ambulance'] = 'ambulanssi', - ['helicopter'] = 'helikopteri', + ['store_veh'] = 'press ~INPUT_CONTEXT~ to store the vehicle', + ['ambulance'] = 'ambulance', + ['helicopter_prompt'] = 'press ~INPUT_CONTEXT~ to access the ~y~Helicopter Actions~s~.', + ['helicopter_buy'] = 'helicopter shop', + ['helicopter_garage'] = 'open garage', + ['helicopter_store'] = 'store helicopter in garage', + ['helicopter_garage_title'] = 'helicopter Garage', + ['helicopter_title'] = 'helicopter Actions', + ['helicopter_notauthorized'] = 'you\'re not authorized to buy helicopters.', + ['garage_prompt'] = 'press ~INPUT_CONTEXT~ to access the ~y~Vehicle Actions~s~.', + ['garage_title'] = 'vehicle Actions', + ['garage_stored'] = 'stored', + ['garage_notstored'] = 'not in garage', + ['garage_storing'] = 'we\'re attempting to remove the vehicle, make sure no players are around it.', + ['garage_has_stored'] = 'the vehicle has been stored in your garage', + ['garage_has_notstored'] = 'no nearby owned vehicles were found', + ['garage_notavailable'] = 'your vehicle is not stored in the garage.', + ['garage_blocked'] = 'there\'s no available spawn points!', + ['garage_empty'] = 'you dont have any vehicles in your garage.', + ['garage_released'] = 'your vehicle has been released from the garage.', + ['garage_store_nearby'] = 'there is no nearby vehicles.', + ['shop_item'] = '$%s', + ['vehicleshop_title'] = 'vehicle Shop', + ['vehicleshop_confirm'] = 'do you want to buy this vehicle?', + ['vehicleshop_bought'] = 'you have bought ~y~%s~s~ for ~r~$%s~s~', + ['vehicleshop_money'] = 'you cannot afford that vehicle', + ['vehicleshop_awaiting_model'] = 'the vehicle is currently ~g~DOWNLOADING & LOADING~s~ please wait', + ['confirm_no'] = 'no', + ['confirm_yes'] = 'yes', -- Action Menu ['hospital'] = 'sairaala', ['revive_inprogress'] = 'elvytys on menossa!', @@ -24,7 +48,7 @@ Locales['fi'] = { ['boss_actions'] = 'pomovalikko', -- Misc ['invalid_amount'] = '~r~Virheellinen summa', - ['open_menu'] = 'paina ~INPUT_CONTEXT~ avataksesi menun', + ['actions_prompt'] = 'press ~INPUT_CONTEXT~ access the ~y~Ambulance Actions~s~.', ['deposit_amount'] = 'talletettava summa', ['money_withdraw'] = 'nostettava summa', ['fast_travel'] = 'paina ~INPUT_CONTEXT~ liikkuaksesi nopeasti kerrosten välillä', diff --git a/locales/fr.lua b/locales/fr.lua index c5819c6d..7e3615e6 100644 --- a/locales/fr.lua +++ b/locales/fr.lua @@ -4,11 +4,35 @@ Locales['fr'] = { ['ems_clothes_civil'] = 'Tenue Civil', ['ems_clothes_ems'] = 'Tenue Ambulancier', -- Vehicles - ['veh_menu'] = 'véhicule', - ['veh_spawn'] = 'appuyez sur ~INPUT_CONTEXT~ pour sortir un véhicule', - ['store_veh'] = 'appuyez sur ~INPUT_CONTEXT~ pour ranger le véhicule', + ['store_veh'] = 'press ~INPUT_CONTEXT~ to store the vehicle', ['ambulance'] = 'ambulance', - ['helicopter'] = 'hélicoptère', + ['helicopter_prompt'] = 'press ~INPUT_CONTEXT~ to access the ~y~Helicopter Actions~s~.', + ['helicopter_buy'] = 'helicopter shop', + ['helicopter_garage'] = 'open garage', + ['helicopter_store'] = 'store helicopter in garage', + ['helicopter_garage_title'] = 'helicopter Garage', + ['helicopter_title'] = 'helicopter Actions', + ['helicopter_notauthorized'] = 'you\'re not authorized to buy helicopters.', + ['garage_prompt'] = 'press ~INPUT_CONTEXT~ to access the ~y~Vehicle Actions~s~.', + ['garage_title'] = 'vehicle Actions', + ['garage_stored'] = 'stored', + ['garage_notstored'] = 'not in garage', + ['garage_storing'] = 'we\'re attempting to remove the vehicle, make sure no players are around it.', + ['garage_has_stored'] = 'the vehicle has been stored in your garage', + ['garage_has_notstored'] = 'no nearby owned vehicles were found', + ['garage_notavailable'] = 'your vehicle is not stored in the garage.', + ['garage_blocked'] = 'there\'s no available spawn points!', + ['garage_empty'] = 'you dont have any vehicles in your garage.', + ['garage_released'] = 'your vehicle has been released from the garage.', + ['garage_store_nearby'] = 'there is no nearby vehicles.', + ['shop_item'] = '$%s', + ['vehicleshop_title'] = 'vehicle Shop', + ['vehicleshop_confirm'] = 'do you want to buy this vehicle?', + ['vehicleshop_bought'] = 'you have bought ~y~%s~s~ for ~r~$%s~s~', + ['vehicleshop_money'] = 'you cannot afford that vehicle', + ['vehicleshop_awaiting_model'] = 'the vehicle is currently ~g~DOWNLOADING & LOADING~s~ please wait', + ['confirm_no'] = 'no', + ['confirm_yes'] = 'yes', -- Action Menu ['hospital'] = 'hôpital', ['revive_inprogress'] = 'réanimation en cours', @@ -24,7 +48,7 @@ Locales['fr'] = { ['boss_actions'] = 'action Patron', -- Misc ['invalid_amount'] = '~r~montant invalide', - ['open_menu'] = 'appuyez sur ~INPUT_CONTEXT~ pour ouvrir le menu', + ['actions_prompt'] = 'press ~INPUT_CONTEXT~ access the ~y~Ambulance Actions~s~.', ['deposit_amount'] = 'montant du dépôt', ['money_withdraw'] = 'montant du retrait', ['fast_travel'] = 'appuyez sur ~INPUT_CONTEXT~ pour vous déplacer rapidement.', diff --git a/locales/pl.lua b/locales/pl.lua index cbe9d438..4e9b36ce 100644 --- a/locales/pl.lua +++ b/locales/pl.lua @@ -4,11 +4,35 @@ Locales['pl'] = { ['ems_clothes_civil'] = 'ubrania cywilne', ['ems_clothes_ems'] = 'ubrania EMS', -- Vehicles - ['veh_menu'] = 'pojazdy', - ['veh_spawn'] = 'naciśnij ~INPUT_CONTEXT~ żeby wziąść Pojazd lub Helikopter', - ['store_veh'] = 'naciśnij ~INPUT_CONTEXT~ żeby przechować pojazd', - ['ambulance'] = 'ambulans', - ['helicopter'] = 'helikopter', + ['store_veh'] = 'press ~INPUT_CONTEXT~ to store the vehicle', + ['ambulance'] = 'ambulance', + ['helicopter_prompt'] = 'press ~INPUT_CONTEXT~ to access the ~y~Helicopter Actions~s~.', + ['helicopter_buy'] = 'helicopter shop', + ['helicopter_garage'] = 'open garage', + ['helicopter_store'] = 'store helicopter in garage', + ['helicopter_garage_title'] = 'helicopter Garage', + ['helicopter_title'] = 'helicopter Actions', + ['helicopter_notauthorized'] = 'you\'re not authorized to buy helicopters.', + ['garage_prompt'] = 'press ~INPUT_CONTEXT~ to access the ~y~Vehicle Actions~s~.', + ['garage_title'] = 'vehicle Actions', + ['garage_stored'] = 'stored', + ['garage_notstored'] = 'not in garage', + ['garage_storing'] = 'we\'re attempting to remove the vehicle, make sure no players are around it.', + ['garage_has_stored'] = 'the vehicle has been stored in your garage', + ['garage_has_notstored'] = 'no nearby owned vehicles were found', + ['garage_notavailable'] = 'your vehicle is not stored in the garage.', + ['garage_blocked'] = 'there\'s no available spawn points!', + ['garage_empty'] = 'you dont have any vehicles in your garage.', + ['garage_released'] = 'your vehicle has been released from the garage.', + ['garage_store_nearby'] = 'there is no nearby vehicles.', + ['shop_item'] = '$%s', + ['vehicleshop_title'] = 'vehicle Shop', + ['vehicleshop_confirm'] = 'do you want to buy this vehicle?', + ['vehicleshop_bought'] = 'you have bought ~y~%s~s~ for ~r~$%s~s~', + ['vehicleshop_money'] = 'you cannot afford that vehicle', + ['vehicleshop_awaiting_model'] = 'the vehicle is currently ~g~DOWNLOADING & LOADING~s~ please wait', + ['confirm_no'] = 'no', + ['confirm_yes'] = 'yes', -- Action Menu ['hospital'] = 'szpital', ['revive_inprogress'] = 'trwa wskrzeszenie', @@ -24,7 +48,7 @@ Locales['pl'] = { ['boss_actions'] = 'akcje szefa', -- Misc ['invalid_amount'] = '~r~Nieprawidłowa kwota', - ['open_menu'] = 'naciśnij ~INPUT_CONTEXT~ aby otworzyc menu', + ['actions_prompt'] = 'press ~INPUT_CONTEXT~ access the ~y~Ambulance Actions~s~.', ['deposit_amount'] = 'kwota depozytu', ['money_withdraw'] = 'wycofana kwota', ['fast_travel'] = 'naciśnij na ~INPUT_CONTEXT~ do szybkiej podróży.', diff --git a/locales/sv.lua b/locales/sv.lua index ea7abf73..851a8ccf 100644 --- a/locales/sv.lua +++ b/locales/sv.lua @@ -4,11 +4,35 @@ Locales['sv'] = { ['ems_clothes_civil'] = 'civilkläder', ['ems_clothes_ems'] = 'ambulanskläder', -- Vehicles - ['veh_menu'] = 'fordon', - ['veh_spawn'] = 'tryck ~INPUT_CONTEXT~ för att öppna garaget.', - ['store_veh'] = 'tryck ~INPUT_CONTEXT~ för att lagra fordonet.', - ['ambulance'] = 'ambulans', - ['helicopter'] = 'helikopter', + ['store_veh'] = 'press ~INPUT_CONTEXT~ to store the vehicle', + ['ambulance'] = 'ambulance', + ['helicopter_prompt'] = 'press ~INPUT_CONTEXT~ to access the ~y~Helicopter Actions~s~.', + ['helicopter_buy'] = 'helicopter shop', + ['helicopter_garage'] = 'open garage', + ['helicopter_store'] = 'store helicopter in garage', + ['helicopter_garage_title'] = 'helicopter Garage', + ['helicopter_title'] = 'helicopter Actions', + ['helicopter_notauthorized'] = 'you\'re not authorized to buy helicopters.', + ['garage_prompt'] = 'press ~INPUT_CONTEXT~ to access the ~y~Vehicle Actions~s~.', + ['garage_title'] = 'vehicle Actions', + ['garage_stored'] = 'stored', + ['garage_notstored'] = 'not in garage', + ['garage_storing'] = 'we\'re attempting to remove the vehicle, make sure no players are around it.', + ['garage_has_stored'] = 'the vehicle has been stored in your garage', + ['garage_has_notstored'] = 'no nearby owned vehicles were found', + ['garage_notavailable'] = 'your vehicle is not stored in the garage.', + ['garage_blocked'] = 'there\'s no available spawn points!', + ['garage_empty'] = 'you dont have any vehicles in your garage.', + ['garage_released'] = 'your vehicle has been released from the garage.', + ['garage_store_nearby'] = 'there is no nearby vehicles.', + ['shop_item'] = '%s SEK', + ['vehicleshop_title'] = 'vehicle Shop', + ['vehicleshop_confirm'] = 'do you want to buy this vehicle?', + ['vehicleshop_bought'] = 'you have bought ~y~%s~s~ for ~r~$%s~s~', + ['vehicleshop_money'] = 'you cannot afford that vehicle', + ['vehicleshop_awaiting_model'] = 'the vehicle is currently ~g~DOWNLOADING & LOADING~s~ please wait', + ['confirm_no'] = 'no', + ['confirm_yes'] = 'yes', -- Action Menu ['hospital'] = 'sjukhus', ['revive_inprogress'] = 'en återupplivning har börjats', @@ -24,7 +48,7 @@ Locales['sv'] = { ['boss_actions'] = 'chef meny', -- Misc ['invalid_amount'] = '~r~Ogiltig mängd', - ['open_menu'] = 'tryck ~INPUT_CONTEXT~ för att öppna menyn.', + ['actions_prompt'] = 'tryck ~INPUT_CONTEXT~ för att öppna menyn.', ['deposit_amount'] = 'mängd att sätta in', ['money_withdraw'] = 'mängd att ta ut', ['fast_travel'] = 'tryck på ~INPUT_CONTEXT~ för att snabbresa.', diff --git a/server/main.lua b/server/main.lua index e2f86711..172b61dc 100644 --- a/server/main.lua +++ b/server/main.lua @@ -110,6 +110,84 @@ ESX.RegisterServerCallback('esx_ambulancejob:getItemAmount', function(source, cb cb(quantity) end) +ESX.RegisterServerCallback('esx_ambulancejob:buyJobVehicle', function(source, cb, vehicleProps) + local xPlayer = ESX.GetPlayerFromId(source) + local price = getPriceFromHash(vehicleProps.model, xPlayer.job.grade_name, 'heli') + + -- vehicle model not found + if price == 0 then + print(('esx_ambulancejob: %s attempted to exploit the shop! (invalid vehicle model)'):format(xPlayer.identifier)) + cb(false) + end + + if xPlayer.getMoney() >= price then + xPlayer.removeMoney(price) + + MySQL.Async.execute('INSERT INTO owned_vehicles (owner, vehicle, plate, type, job, stored) VALUES (@owner, @vehicle, @plate, @type, @job, @stored)', { + ['@owner'] = xPlayer.identifier, + ['@vehicle'] = json.encode(vehicleProps), + ['@plate'] = vehicleProps.plate, + ['@type'] = 'helicopter', + ['@job'] = xPlayer.job.name, + ['@stored'] = true + }, function (rowsChanged) + cb(true) + end) + else + cb(false) + end +end) + +ESX.RegisterServerCallback('esx_ambulancejob:storeNearbyVehicle', function(source, cb, nearbyVehicles) + local xPlayer = ESX.GetPlayerFromId(source) + local foundPlate, foundNum + + for k,v in ipairs(nearbyVehicles) do + local result = MySQL.Sync.fetchAll('SELECT plate FROM owned_vehicles WHERE owner = @owner AND plate = @plate AND job = @job', { + ['@owner'] = xPlayer.identifier, + ['@plate'] = v.plate, + ['@job'] = xPlayer.job.name + }) + + if result[1] then + foundPlate, foundNum = result[1].plate, k + break + end + end + + if not foundPlate then + cb(false) + else + MySQL.Async.execute('UPDATE owned_vehicles SET stored = true WHERE owner = @owner AND plate = @plate AND job = @job', { + ['@owner'] = xPlayer.identifier, + ['@plate'] = foundPlate, + ['@job'] = xPlayer.job.name + }, function (rowsChanged) + if rowsChanged == 0 then + print(('esx_ambulancejob: %s has exploited the garage!'):format(xPlayer.identifier)) + cb(false) + else + cb(true, foundNum) + end + end) + end + +end) + +function getPriceFromHash(hashKey, jobGrade, type) + if type == 'heli' then + local vehicles = Config.AuthorizedHelicopters[jobGrade] + + for k,v in ipairs(vehicles) do + if GetHashKey(v.model) == hashKey then + return v.price + end + end + end + + return 0 +end + RegisterServerEvent('esx_ambulancejob:removeItem') AddEventHandler('esx_ambulancejob:removeItem', function(item) local _source = source From 904774b6a849cef29d8452b6b51af976cb16eff8 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Sun, 30 Dec 2018 23:29:04 +0100 Subject: [PATCH 111/177] Implemented new vehicle garage, final commit v1.2.0 --- __resource.lua | 2 +- client/job.lua | 248 ++++++++++++++++++++++++++++++------------------ config.lua | 50 +++++++--- locales/br.lua | 4 +- locales/cs.lua | 4 +- locales/en.lua | 4 +- locales/es.lua | 4 +- locales/fi.lua | 4 +- locales/fr.lua | 4 +- locales/pl.lua | 4 +- locales/sv.lua | 4 +- server/main.lua | 16 +++- 12 files changed, 229 insertions(+), 119 deletions(-) diff --git a/__resource.lua b/__resource.lua index 5033c6cd..5c55606b 100644 --- a/__resource.lua +++ b/__resource.lua @@ -2,7 +2,7 @@ resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937' description 'ESX Ambulance Job' -version '1.1.1' +version '1.2.0' server_scripts { '@mysql-async/lib/MySQL.lua', diff --git a/client/job.lua b/client/job.lua index ba29aabd..62ab2a94 100644 --- a/client/job.lua +++ b/client/job.lua @@ -265,20 +265,6 @@ Citizen.CreateThread(function() end end - -- Vehicle Deleters - for k,v in ipairs(hospital.VehicleDeleters) do - local distance = GetDistanceBetweenCoords(playerCoords, v, true) - - if distance < Config.DrawDistance then - DrawMarker(Config.Marker.type, v, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Config.Marker.x, Config.Marker.y, Config.Marker.z, Config.Marker.r, Config.Marker.g, Config.Marker.b, Config.Marker.a, false, false, 2, Config.Marker.rotate, nil, nil, false) - canSleep = false - end - - if distance < Config.Marker.x then - isInMarker, currentHospital, currentPart, currentPartNum = true, hospitalNum, 'VehicleDeleter', k - end - end - -- Fast Travels for k,v in ipairs(hospital.FastTravels) do local distance = GetDistanceBetweenCoords(playerCoords, v.From, true) @@ -446,7 +432,6 @@ AddEventHandler('esx_ambulancejob:putInVehicle', function() end end) - function OpenCloakroomMenu() ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'cloakroom', { @@ -478,28 +463,164 @@ function OpenCloakroomMenu() end function OpenVehicleSpawnerMenu(hospital, partNum) + local playerCoords = GetEntityCoords(PlayerPedId()) + local elements = { + {label = _U('garage_storeditem'), action = 'garage'}, + {label = _U('garage_storeitem'), action = 'store_garage'}, + {label = _U('garage_buyitem'), action = 'buy_vehicle'} + } - ESX.UI.Menu.CloseAll() + ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'vehicle', { + title = _U('garage_title'), + align = 'top-left', + elements = elements + }, function(data, menu) - ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'vehicle_spawner', - { - title = _U('garage_title'), - align = 'top-left', - elements = Config.AuthorizedVehicles - }, function(data, menu) - menu.close() + if data.current.action == 'buy_vehicle' then + local shopCoords = Config.Hospitals[hospital].Vehicles[partNum].InsideShop + local shopElements = {} - local foundSpawn, spawnPoint = GetAvailableVehicleSpawnPoint(hospital, 'Vehicles', partNum) + local authorizedVehicles = Config.AuthorizedVehicles[ESX.PlayerData.job.grade_name] - if foundSpawn then - ESX.Game.SpawnVehicle(data.current.model, spawnPoint.coords, spawnPoint.heading, function(vehicle) - local playerPed = PlayerPedId() - TaskWarpPedIntoVehicle(playerPed, vehicle, -1) - end) + if #authorizedVehicles > 0 then + for k,vehicle in ipairs(authorizedVehicles) do + table.insert(shopElements, { + label = ('%s - %s'):format(vehicle.label, _U('shop_item', ESX.Math.GroupDigits(vehicle.price))), + name = vehicle.label, + model = vehicle.model, + price = vehicle.price, + type = 'car' + }) + end + else + return end - end, function(data, menu) - menu.close() - end) + + OpenShopMenu(shopElements, playerCoords, shopCoords) + elseif data.current.action == 'garage' then + local garage = {} + + ESX.TriggerServerCallback('esx_vehicleshop:retrieveJobVehicles', function(jobVehicles) + if #jobVehicles > 0 then + for k,v in ipairs(jobVehicles) do + local props = json.decode(v.vehicle) + local vehicleName = GetLabelText(GetDisplayNameFromVehicleModel(props.model)) + local label = ('%s - %s: '):format(vehicleName, props.plate) + + if v.stored then + label = label .. ('%s'):format(_U('garage_stored')) + else + label = label .. ('%s'):format(_U('garage_notstored')) + end + + table.insert(garage, { + label = label, + stored = v.stored, + model = props.model, + vehicleProps = props + }) + end + + ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'vehicle_garage', { + title = _U('garage_title'), + align = 'top-left', + elements = garage + }, function(data2, menu2) + if data2.current.stored then + local foundSpawn, spawnPoint = GetAvailableVehicleSpawnPoint(hospital, 'Vehicles', partNum) + + if foundSpawn then + menu2.close() + + ESX.Game.SpawnVehicle(data2.current.model, spawnPoint.coords, spawnPoint.heading, function(vehicle) + ESX.Game.SetVehicleProperties(vehicle, data2.current.vehicleProps) + + TriggerServerEvent('esx_vehicleshop:setJobVehicleState', data2.current.vehicleProps.plate, false) + ESX.ShowNotification(_U('garage_released')) + end) + end + else + ESX.ShowNotification(_U('garage_notavailable')) + end + end, function(data2, menu2) + menu2.close() + end) + + else + ESX.ShowNotification(_U('garage_empty')) + end + end, 'car') + + elseif data.current.action == 'store_garage' then + StoreNearbyVehicle(playerCoords) + end + + end, function(data, menu) + menu.close() + end) + +end + +function StoreNearbyVehicle(playerCoords) + local vehicles, vehiclePlates = ESX.Game.GetVehiclesInArea(playerCoords, 30.0), {} + + if #vehicles > 0 then + for k,v in ipairs(vehicles) do + + -- Make sure the vehicle we're saving is empty, or else it wont be deleted + if GetVehicleNumberOfPassengers(v) == 0 and IsVehicleSeatFree(v, -1) then + table.insert(vehiclePlates, { + vehicle = v, + plate = ESX.Math.Trim(GetVehicleNumberPlateText(v)) + }) + end + end + else + ESX.ShowNotification(_U('garage_store_nearby')) + return + end + + ESX.TriggerServerCallback('esx_ambulancejob:storeNearbyVehicle', function(storeSuccess, foundNum) + if storeSuccess then + local vehicleId = vehiclePlates[foundNum] + local attempts = 0 + ESX.Game.DeleteVehicle(vehicleId.vehicle) + IsBusy = true + + Citizen.CreateThread(function() + while IsBusy do + Citizen.Wait(0) + drawLoadingText(_U('garage_storing'), 255, 255, 255, 255) + end + end) + + -- Workaround for vehicle not deleting when other players are near it. + while DoesEntityExist(vehicleId.vehicle) do + Citizen.Wait(500) + attempts = attempts + 1 + + -- Give up + if attempts > 30 then + break + end + + vehicles = ESX.Game.GetVehiclesInArea(playerCoords, 30.0) + if #vehicles > 0 then + for k,v in ipairs(vehicles) do + if ESX.Math.Trim(GetVehicleNumberPlateText(v)) == vehicleId.plate then + ESX.Game.DeleteVehicle(v) + break + end + end + end + end + + IsBusy = false + ESX.ShowNotification(_U('garage_has_stored')) + else + ESX.ShowNotification(_U('garage_has_notstored')) + end + end, vehiclePlates) end function GetAvailableVehicleSpawnPoint(hospital, part, partNum) @@ -612,66 +733,7 @@ function OpenHelicopterSpawnerMenu(hospital, partNum) end, 'helicopter') elseif data.current.action == 'store_garage' then - local vehicles, vehiclePlates = ESX.Game.GetVehiclesInArea(playerCoords, 30.0), {} - - if #vehicles > 0 then - for k,v in ipairs(vehicles) do - - -- Make sure the vehicle we're saving is empty, or else it wont be deleted - if GetVehicleNumberOfPassengers(v) == 0 and IsVehicleSeatFree(v, -1) then - table.insert(vehiclePlates, { - vehicle = v, - plate = ESX.Math.Trim(GetVehicleNumberPlateText(v)) - }) - end - end - else - ESX.ShowNotification(_U('garage_store_nearby')) - return - end - - ESX.TriggerServerCallback('esx_ambulancejob:storeNearbyVehicle', function(storeSuccess, foundNum) - if storeSuccess then - local vehicleId = vehiclePlates[foundNum] - local attempts = 0 - ESX.Game.DeleteVehicle(vehicleId.vehicle) - IsBusy = true - - Citizen.CreateThread(function() - while IsBusy do - Citizen.Wait(0) - drawLoadingText(_U('garage_storing'), 255, 255, 255, 255) - end - end) - - -- Workaround for vehicle not deleting when other players are near it. - while DoesEntityExist(vehicleId.vehicle) do - Citizen.Wait(500) - attempts = attempts + 1 - - -- Give up - if attempts > 30 then - break - end - - vehicles = ESX.Game.GetVehiclesInArea(playerCoords, 30.0) - if #vehicles > 0 then - for k,v in ipairs(vehicles) do - if ESX.Math.Trim(GetVehicleNumberPlateText(v)) == vehicleId.plate then - ESX.Game.DeleteVehicle(v) - break - end - end - end - end - - IsBusy = false - ESX.ShowNotification(_U('garage_has_stored')) - else - ESX.ShowNotification(_U('garage_has_notstored')) - end - end, vehiclePlates) - + StoreNearbyVehicle(playerCoords) end end, function(data, menu) @@ -722,7 +784,7 @@ function OpenShopMenu(elements, restoreCoords, shopCoords) ESX.ShowNotification(_U('vehicleshop_money')) menu2.close() end - end, props) + end, props, data.current.type) else menu2.close() end diff --git a/config.lua b/config.lua index 9ace4628..59930ec6 100644 --- a/config.lua +++ b/config.lua @@ -49,6 +49,7 @@ Config.Hospitals = { Vehicles = { { Spawner = vector3(307.7, -1433.4, 30.0), + InsideShop = vector3(446.7, -1355.6, 43.5), Marker = { type = 36, x = 1.0, y = 1.0, z = 1.0, r = 100, g = 50, b = 200, a = 100, rotate = true }, SpawnPoints = { { coords = vector3(297.2, -1429.5, 29.8), heading = 227.6, radius = 4.0 }, @@ -70,10 +71,6 @@ Config.Hospitals = { } }, - VehicleDeleters = { - vector3(327.6, -1481.1, 28.8) - }, - FastTravels = { { From = vector3(294.7, -1448.1, 29.0), @@ -131,6 +128,42 @@ Config.Hospitals = { } } +Config.AuthorizedVehicles = { + + ambulance = { + { + model = 'ambulance', + label = 'Ambulance Van', + price = 5000 + } + }, + + doctor = { + { + model = 'ambulance', + label = 'Ambulance Van', + price = 4500 + } + }, + + chief_doctor = { + { + model = 'ambulance', + label = 'Ambulance Van', + price = 3000 + } + }, + + boss = { + { + model = 'ambulance', + label = 'Ambulance Van', + price = 2000 + } + } + +} + Config.AuthorizedHelicopters = { ambulance = {}, @@ -172,12 +205,3 @@ Config.AuthorizedHelicopters = { } } - -Config.AuthorizedVehicles = { - - { - model = 'ambulance', - label = 'Ambulance' - } - -} diff --git a/locales/br.lua b/locales/br.lua index 8e242216..be0dbc50 100644 --- a/locales/br.lua +++ b/locales/br.lua @@ -4,7 +4,6 @@ Locales['br'] = { ['ems_clothes_civil'] = 'Roupa Normal', ['ems_clothes_ems'] = 'Entrar como Socorrista', -- Vehicles - ['store_veh'] = 'press ~INPUT_CONTEXT~ to store the vehicle', ['ambulance'] = 'ambulance', ['helicopter_prompt'] = 'press ~INPUT_CONTEXT~ to access the ~y~Helicopter Actions~s~.', ['helicopter_buy'] = 'helicopter shop', @@ -25,6 +24,9 @@ Locales['br'] = { ['garage_empty'] = 'you dont have any vehicles in your garage.', ['garage_released'] = 'your vehicle has been released from the garage.', ['garage_store_nearby'] = 'there is no nearby vehicles.', + ['garage_storeditem'] = 'open garage', + ['garage_storeitem'] = 'store vehicle in garage', + ['garage_buyitem'] = 'vehicle shop', ['shop_item'] = '$%s', ['vehicleshop_title'] = 'vehicle Shop', ['vehicleshop_confirm'] = 'do you want to buy this vehicle?', diff --git a/locales/cs.lua b/locales/cs.lua index 97830152..48dc7cc2 100644 --- a/locales/cs.lua +++ b/locales/cs.lua @@ -4,7 +4,6 @@ Locales['cs'] = { ['ems_clothes_civil'] = 'civilní oblečení', ['ems_clothes_ems'] = 'zdravotnické oblečení', -- Vehicles - ['store_veh'] = 'press ~INPUT_CONTEXT~ to store the vehicle', ['ambulance'] = 'ambulance', ['helicopter_prompt'] = 'press ~INPUT_CONTEXT~ to access the ~y~Helicopter Actions~s~.', ['helicopter_buy'] = 'helicopter shop', @@ -25,6 +24,9 @@ Locales['cs'] = { ['garage_empty'] = 'you dont have any vehicles in your garage.', ['garage_released'] = 'your vehicle has been released from the garage.', ['garage_store_nearby'] = 'there is no nearby vehicles.', + ['garage_storeditem'] = 'open garage', + ['garage_storeitem'] = 'store vehicle in garage', + ['garage_buyitem'] = 'vehicle shop', ['shop_item'] = '$%s', ['vehicleshop_title'] = 'vehicle Shop', ['vehicleshop_confirm'] = 'do you want to buy this vehicle?', diff --git a/locales/en.lua b/locales/en.lua index 6630b045..b13f48fe 100644 --- a/locales/en.lua +++ b/locales/en.lua @@ -4,7 +4,6 @@ Locales['en'] = { ['ems_clothes_civil'] = 'civilian Clothes', ['ems_clothes_ems'] = 'EMS Clothes', -- Vehicles - ['store_veh'] = 'press ~INPUT_CONTEXT~ to store the vehicle', ['ambulance'] = 'ambulance', ['helicopter_prompt'] = 'press ~INPUT_CONTEXT~ to access the ~y~Helicopter Actions~s~.', ['helicopter_buy'] = 'helicopter shop', @@ -25,6 +24,9 @@ Locales['en'] = { ['garage_empty'] = 'you dont have any vehicles in your garage.', ['garage_released'] = 'your vehicle has been released from the garage.', ['garage_store_nearby'] = 'there is no nearby vehicles.', + ['garage_storeditem'] = 'open garage', + ['garage_storeitem'] = 'store vehicle in garage', + ['garage_buyitem'] = 'vehicle shop', ['shop_item'] = '$%s', ['vehicleshop_title'] = 'vehicle Shop', ['vehicleshop_confirm'] = 'do you want to buy this vehicle?', diff --git a/locales/es.lua b/locales/es.lua index d5632333..5b1e4ecb 100644 --- a/locales/es.lua +++ b/locales/es.lua @@ -4,7 +4,6 @@ Locales['es'] = { ['ems_clothes_civil'] = 'Camiseta', ['ems_clothes_ems'] = 'Equipo de ambulancia', -- Vehicles - ['store_veh'] = 'press ~INPUT_CONTEXT~ to store the vehicle', ['ambulance'] = 'ambulance', ['helicopter_prompt'] = 'press ~INPUT_CONTEXT~ to access the ~y~Helicopter Actions~s~.', ['helicopter_buy'] = 'helicopter shop', @@ -25,6 +24,9 @@ Locales['es'] = { ['garage_empty'] = 'you dont have any vehicles in your garage.', ['garage_released'] = 'your vehicle has been released from the garage.', ['garage_store_nearby'] = 'there is no nearby vehicles.', + ['garage_storeditem'] = 'open garage', + ['garage_storeitem'] = 'store vehicle in garage', + ['garage_buyitem'] = 'vehicle shop', ['shop_item'] = '$%s', ['vehicleshop_title'] = 'vehicle Shop', ['vehicleshop_confirm'] = 'do you want to buy this vehicle?', diff --git a/locales/fi.lua b/locales/fi.lua index 0d0d8e21..ac99fc65 100644 --- a/locales/fi.lua +++ b/locales/fi.lua @@ -4,7 +4,6 @@ Locales['fi'] = { ['ems_clothes_civil'] = 'Siviilikamppeet', ['ems_clothes_ems'] = 'Työkamppeet', -- Vehicles - ['store_veh'] = 'press ~INPUT_CONTEXT~ to store the vehicle', ['ambulance'] = 'ambulance', ['helicopter_prompt'] = 'press ~INPUT_CONTEXT~ to access the ~y~Helicopter Actions~s~.', ['helicopter_buy'] = 'helicopter shop', @@ -25,6 +24,9 @@ Locales['fi'] = { ['garage_empty'] = 'you dont have any vehicles in your garage.', ['garage_released'] = 'your vehicle has been released from the garage.', ['garage_store_nearby'] = 'there is no nearby vehicles.', + ['garage_storeditem'] = 'open garage', + ['garage_storeitem'] = 'store vehicle in garage', + ['garage_buyitem'] = 'vehicle shop', ['shop_item'] = '$%s', ['vehicleshop_title'] = 'vehicle Shop', ['vehicleshop_confirm'] = 'do you want to buy this vehicle?', diff --git a/locales/fr.lua b/locales/fr.lua index 7e3615e6..5e4bf47e 100644 --- a/locales/fr.lua +++ b/locales/fr.lua @@ -4,7 +4,6 @@ Locales['fr'] = { ['ems_clothes_civil'] = 'Tenue Civil', ['ems_clothes_ems'] = 'Tenue Ambulancier', -- Vehicles - ['store_veh'] = 'press ~INPUT_CONTEXT~ to store the vehicle', ['ambulance'] = 'ambulance', ['helicopter_prompt'] = 'press ~INPUT_CONTEXT~ to access the ~y~Helicopter Actions~s~.', ['helicopter_buy'] = 'helicopter shop', @@ -25,6 +24,9 @@ Locales['fr'] = { ['garage_empty'] = 'you dont have any vehicles in your garage.', ['garage_released'] = 'your vehicle has been released from the garage.', ['garage_store_nearby'] = 'there is no nearby vehicles.', + ['garage_storeditem'] = 'open garage', + ['garage_storeitem'] = 'store vehicle in garage', + ['garage_buyitem'] = 'vehicle shop', ['shop_item'] = '$%s', ['vehicleshop_title'] = 'vehicle Shop', ['vehicleshop_confirm'] = 'do you want to buy this vehicle?', diff --git a/locales/pl.lua b/locales/pl.lua index 4e9b36ce..61778ccc 100644 --- a/locales/pl.lua +++ b/locales/pl.lua @@ -4,7 +4,6 @@ Locales['pl'] = { ['ems_clothes_civil'] = 'ubrania cywilne', ['ems_clothes_ems'] = 'ubrania EMS', -- Vehicles - ['store_veh'] = 'press ~INPUT_CONTEXT~ to store the vehicle', ['ambulance'] = 'ambulance', ['helicopter_prompt'] = 'press ~INPUT_CONTEXT~ to access the ~y~Helicopter Actions~s~.', ['helicopter_buy'] = 'helicopter shop', @@ -25,6 +24,9 @@ Locales['pl'] = { ['garage_empty'] = 'you dont have any vehicles in your garage.', ['garage_released'] = 'your vehicle has been released from the garage.', ['garage_store_nearby'] = 'there is no nearby vehicles.', + ['garage_storeditem'] = 'open garage', + ['garage_storeitem'] = 'store vehicle in garage', + ['garage_buyitem'] = 'vehicle shop', ['shop_item'] = '$%s', ['vehicleshop_title'] = 'vehicle Shop', ['vehicleshop_confirm'] = 'do you want to buy this vehicle?', diff --git a/locales/sv.lua b/locales/sv.lua index 851a8ccf..0693cfd1 100644 --- a/locales/sv.lua +++ b/locales/sv.lua @@ -4,7 +4,6 @@ Locales['sv'] = { ['ems_clothes_civil'] = 'civilkläder', ['ems_clothes_ems'] = 'ambulanskläder', -- Vehicles - ['store_veh'] = 'press ~INPUT_CONTEXT~ to store the vehicle', ['ambulance'] = 'ambulance', ['helicopter_prompt'] = 'press ~INPUT_CONTEXT~ to access the ~y~Helicopter Actions~s~.', ['helicopter_buy'] = 'helicopter shop', @@ -25,6 +24,9 @@ Locales['sv'] = { ['garage_empty'] = 'you dont have any vehicles in your garage.', ['garage_released'] = 'your vehicle has been released from the garage.', ['garage_store_nearby'] = 'there is no nearby vehicles.', + ['garage_storeditem'] = 'open garage', + ['garage_storeitem'] = 'store vehicle in garage', + ['garage_buyitem'] = 'vehicle shop', ['shop_item'] = '%s SEK', ['vehicleshop_title'] = 'vehicle Shop', ['vehicleshop_confirm'] = 'do you want to buy this vehicle?', diff --git a/server/main.lua b/server/main.lua index 172b61dc..9dfa4d69 100644 --- a/server/main.lua +++ b/server/main.lua @@ -110,9 +110,9 @@ ESX.RegisterServerCallback('esx_ambulancejob:getItemAmount', function(source, cb cb(quantity) end) -ESX.RegisterServerCallback('esx_ambulancejob:buyJobVehicle', function(source, cb, vehicleProps) +ESX.RegisterServerCallback('esx_ambulancejob:buyJobVehicle', function(source, cb, vehicleProps, type) local xPlayer = ESX.GetPlayerFromId(source) - local price = getPriceFromHash(vehicleProps.model, xPlayer.job.grade_name, 'heli') + local price = getPriceFromHash(vehicleProps.model, xPlayer.job.grade_name, type) -- vehicle model not found if price == 0 then @@ -127,7 +127,7 @@ ESX.RegisterServerCallback('esx_ambulancejob:buyJobVehicle', function(source, cb ['@owner'] = xPlayer.identifier, ['@vehicle'] = json.encode(vehicleProps), ['@plate'] = vehicleProps.plate, - ['@type'] = 'helicopter', + ['@type'] = type, ['@job'] = xPlayer.job.name, ['@stored'] = true }, function (rowsChanged) @@ -175,9 +175,17 @@ ESX.RegisterServerCallback('esx_ambulancejob:storeNearbyVehicle', function(sourc end) function getPriceFromHash(hashKey, jobGrade, type) - if type == 'heli' then + if type == 'helicopter' then local vehicles = Config.AuthorizedHelicopters[jobGrade] + for k,v in ipairs(vehicles) do + if GetHashKey(v.model) == hashKey then + return v.price + end + end + elseif type == 'car' then + local vehicles = Config.AuthorizedVehicles[jobGrade] + for k,v in ipairs(vehicles) do if GetHashKey(v.model) == hashKey then return v.price From 439927f28afb3473ec4615cf00c0e284296c0b05 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Sun, 30 Dec 2018 23:34:24 +0100 Subject: [PATCH 112/177] Added respawn to config, very final commit v1.2.0 --- client/main.lua | 15 ++++++++------- config.lua | 2 ++ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/client/main.lua b/client/main.lua index 623e73b4..e8dfb2be 100644 --- a/client/main.lua +++ b/client/main.lua @@ -275,11 +275,11 @@ function RemoveItemsAfterRPDeath() end ESX.TriggerServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function() - ESX.SetPlayerData('lastPosition', Config.Zones.HospitalInteriorInside1.Pos) + ESX.SetPlayerData('lastPosition', Config.RespawnPoint.coords) ESX.SetPlayerData('loadout', {}) - TriggerServerEvent('esx:updateLastPosition', Config.Zones.HospitalInteriorInside1.Pos) - RespawnPed(PlayerPedId(), Config.Zones.HospitalInteriorInside1.Pos) + TriggerServerEvent('esx:updateLastPosition', Config.RespawnPoint.coords) + RespawnPed(PlayerPedId(), Config.RespawnPoint.coords, Config.RespawnPoint.heading) StopScreenEffect('DeathFailOut') DoScreenFadeIn(800) @@ -287,11 +287,11 @@ function RemoveItemsAfterRPDeath() end) end -function RespawnPed(ped, coords) +function RespawnPed(ped, coords, heading) SetEntityCoordsNoOffset(ped, coords.x, coords.y, coords.z, false, false, false, true) - NetworkResurrectLocalPlayer(coords.x, coords.y, coords.z, coords.heading, true, false) + NetworkResurrectLocalPlayer(coords.x, coords.y, coords.z, heading, true, false) SetPlayerInvincible(ped, false) - TriggerEvent('playerSpawned', coords.x, coords.y, coords.z, coords.heading) + TriggerEvent('playerSpawned', coords.x, coords.y, coords.z) ClearPedBloodDamage(ped) ESX.UI.Menu.CloseAll() @@ -340,7 +340,8 @@ AddEventHandler('esx_ambulancejob:revive', function() RespawnPed(playerPed, { x = coords.x, y = coords.y, - z = coords.z + z = coords.z, + heading = 0.0 }) StopScreenEffect('DeathFailOut') diff --git a/config.lua b/config.lua index 59930ec6..db11d078 100644 --- a/config.lua +++ b/config.lua @@ -27,6 +27,8 @@ Config.RemoveItemsAfterRPDeath = true Config.EarlyRespawnFine = false Config.EarlyRespawnFineAmount = 5000 +Config.RespawnPoint = { coords = vector3(341.07, -1397.31, 32.51), heading = 48.5} + Config.Hospitals = { CentralLosSantos = { From 3e556977edc05f057b040802deff82577e7e8898 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Sun, 30 Dec 2018 23:41:05 +0100 Subject: [PATCH 113/177] Very very final commit v1.2.0 --- client/job.lua | 59 +++++++++++++++++++------------------------------- 1 file changed, 22 insertions(+), 37 deletions(-) diff --git a/client/job.lua b/client/job.lua index 62ab2a94..b3ac5884 100644 --- a/client/job.lua +++ b/client/job.lua @@ -321,43 +321,30 @@ Citizen.CreateThread(function() end) AddEventHandler('esx_ambulancejob:hasEnteredMarker', function(hospital, part, partNum) - if part == 'AmbulanceActions' then - CurrentAction = part - CurrentActionMsg = _U('actions_prompt') - CurrentActionData = {} - elseif part == 'Pharmacy' then - CurrentAction = part - CurrentActionMsg = _U('open_pharmacy') - CurrentActionData = {} - elseif part == 'Vehicles' then - CurrentAction = part - CurrentActionMsg = _U('garage_prompt') - CurrentActionData = {hospital = hospital, partNum = partNum} - elseif part == 'Helicopters' then - CurrentAction = part - CurrentActionMsg = _U('helicopter_prompt') - CurrentActionData = {hospital = hospital, partNum = partNum} - elseif part == 'VehicleDeleter' then + if ESX.PlayerData.job and ESX.PlayerData.job.name == 'ambulance' then + if part == 'AmbulanceActions' then + CurrentAction = part + CurrentActionMsg = _U('actions_prompt') + CurrentActionData = {} + elseif part == 'Pharmacy' then + CurrentAction = part + CurrentActionMsg = _U('open_pharmacy') + CurrentActionData = {} + elseif part == 'Vehicles' then + CurrentAction = part + CurrentActionMsg = _U('garage_prompt') + CurrentActionData = {hospital = hospital, partNum = partNum} + elseif part == 'Helicopters' then + CurrentAction = part + CurrentActionMsg = _U('helicopter_prompt') + CurrentActionData = {hospital = hospital, partNum = partNum} + elseif part == 'FastTravelsPrompt' then + local travelItem = Config.Hospitals[hospital][part][partNum] - local playerPed = PlayerPedId() - local coords = GetEntityCoords(playerPed) - - if IsPedInAnyVehicle(playerPed, false) then - local vehicle, distance = ESX.Game.GetClosestVehicle(coords) - - if distance ~= -1 and distance <= 1.0 then - CurrentAction = part - CurrentActionMsg = _U('store_veh') - CurrentActionData = {vehicle = vehicle} - end + CurrentAction = part + CurrentActionMsg = travelItem.Prompt + CurrentActionData = {to = travelItem.To.coords, heading = travelItem.To.heading} end - - elseif part == 'FastTravelsPrompt' then - local travelItem = Config.Hospitals[hospital][part][partNum] - - CurrentAction = part - CurrentActionMsg = travelItem.Prompt - CurrentActionData = {to = travelItem.To.coords, heading = travelItem.To.heading} end end) @@ -387,8 +374,6 @@ Citizen.CreateThread(function() OpenVehicleSpawnerMenu(CurrentActionData.hospital, CurrentActionData.partNum) elseif CurrentAction == 'Helicopters' then OpenHelicopterSpawnerMenu(CurrentActionData.hospital, CurrentActionData.partNum) - elseif CurrentAction == 'VehicleDeleter' then - ESX.Game.DeleteVehicle(CurrentActionData.vehicle) elseif CurrentAction == 'FastTravelsPrompt' then FastTravel(CurrentActionData.to, CurrentActionData.heading) end From bdef54f945c63d68489e63eae08e8edb702cee73 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Tue, 1 Jan 2019 11:53:46 +0100 Subject: [PATCH 114/177] Fixed missing alpha --- config.lua | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/config.lua b/config.lua index db11d078..a9bd281e 100644 --- a/config.lua +++ b/config.lua @@ -2,7 +2,7 @@ Config = {} Config.DrawDistance = 100.0 -Config.Marker = { type = 1, x = 1.5, y = 1.5, z = 1.0, r = 102, g = 0, b = 102, rotate = false } +Config.Marker = { type = 1, x = 1.5, y = 1.5, z = 0.5, r = 102, g = 0, b = 102, a = 100, rotate = false } Config.ReviveReward = 700 -- revive reward, set to 0 if you don't want it enabled Config.AntiCombatLog = true -- enable anti-combat logging? @@ -27,7 +27,7 @@ Config.RemoveItemsAfterRPDeath = true Config.EarlyRespawnFine = false Config.EarlyRespawnFineAmount = 5000 -Config.RespawnPoint = { coords = vector3(341.07, -1397.31, 32.51), heading = 48.5} +Config.RespawnPoint = { coords = vector3(341.07, -1397.31, 32.51), heading = 48.5 } Config.Hospitals = { @@ -41,7 +41,7 @@ Config.Hospitals = { }, AmbulanceActions = { - vector3(268.4, -1363.3, 23.5) + vector3(270.5, -1363.0, 23.5) }, Pharmacies = { @@ -77,37 +77,37 @@ Config.Hospitals = { { From = vector3(294.7, -1448.1, 29.0), To = { coords = vector3(272.8, -1358.8, 23.5), heading = 0.0 }, - Marker = { type = 1, x = 2.0, y = 2.0, z = 0.5, r = 102, g = 0, b = 102, rotate = false } + Marker = { type = 1, x = 2.0, y = 2.0, z = 0.5, r = 102, g = 0, b = 102, a = 100, rotate = false } }, { From = vector3(275.3, -1361, 23.5), To = { coords = vector3(295.8, -1446.5, 28.9), heading = 0.0 }, - Marker = { type = 1, x = 2.0, y = 2.0, z = 0.5, r = 102, g = 0, b = 102, rotate = false } + Marker = { type = 1, x = 2.0, y = 2.0, z = 0.5, r = 102, g = 0, b = 102, a = 100, rotate = false } }, { From = vector3(247.3, -1371.5, 23.5), To = { coords = vector3(333.1, -1434.9, 45.5), heading = 138.6 }, - Marker = { type = 1, x = 1.5, y = 1.5, z = 0.5, r = 102, g = 0, b = 102, rotate = false } + Marker = { type = 1, x = 1.5, y = 1.5, z = 0.5, r = 102, g = 0, b = 102, a = 100, rotate = false } }, { From = vector3(335.5, -1432.0, 45.50), To = { coords = vector3(249.1, -1369.6, 23.5), heading = 0.0 }, - Marker = { type = 1, x = 2.0, y = 2.0, z = 0.5, r = 102, g = 0, b = 102, rotate = false } + Marker = { type = 1, x = 2.0, y = 2.0, z = 0.5, r = 102, g = 0, b = 102, a = 100, rotate = false } }, { From = vector3(234.5, -1373.7, 20.9), To = { coords = vector3(320.9, -1478.6, 28.8), heading = 0.0 }, - Marker = { type = 1, x = 1.5, y = 1.5, z = 1.0, r = 102, g = 0, b = 102, rotate = false } + Marker = { type = 1, x = 1.5, y = 1.5, z = 1.0, r = 102, g = 0, b = 102, a = 100, rotate = false } }, { From = vector3(317.9, -1476.1, 28.9), To = { coords = vector3(238.6, -1368.4, 23.5), heading = 0.0 }, - Marker = { type = 1, x = 1.5, y = 1.5, z = 1.0, r = 102, g = 0, b = 102, rotate = false } + Marker = { type = 1, x = 1.5, y = 1.5, z = 1.0, r = 102, g = 0, b = 102, a = 100, rotate = false } } }, @@ -115,14 +115,14 @@ Config.Hospitals = { { From = vector3(237.4, -1373.8, 26.0), To = { coords = vector3(251.9, -1363.3, 38.5), heading = 0.0 }, - Marker = { type = 1, x = 1.5, y = 1.5, z = 0.5, r = 102, g = 0, b = 102, rotate = false }, + Marker = { type = 1, x = 1.5, y = 1.5, z = 0.5, r = 102, g = 0, b = 102, a = 100, rotate = false }, Prompt = _U('fast_travel') }, { From = vector3(256.5, -1357.7, 36.0), To = { coords = vector3(235.4, -1372.8, 26.3), heading = 0.0 }, - Marker = { type = 1, x = 1.5, y = 1.5, z = 0.5, r = 102, g = 0, b = 102, rotate = false }, + Marker = { type = 1, x = 1.5, y = 1.5, z = 0.5, r = 102, g = 0, b = 102, a = 100, rotate = false }, Prompt = _U('fast_travel') } } From 37aed83ee5095b3c518c4a462c4b4dbc3b272994 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Fri, 4 Jan 2019 13:01:10 +0100 Subject: [PATCH 115/177] Fixed playerdata not updating, proper mysql insert --- client/job.lua | 1 + server/main.lua | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/client/job.lua b/client/job.lua index b3ac5884..d72c4670 100644 --- a/client/job.lua +++ b/client/job.lua @@ -629,6 +629,7 @@ end function OpenHelicopterSpawnerMenu(hospital, partNum) local playerCoords = GetEntityCoords(PlayerPedId()) + ESX.PlayerData = ESX.GetPlayerData() local elements = { {label = _U('helicopter_garage'), action = 'garage'}, {label = _U('helicopter_store'), action = 'store_garage'}, diff --git a/server/main.lua b/server/main.lua index 9dfa4d69..add47594 100644 --- a/server/main.lua +++ b/server/main.lua @@ -123,7 +123,7 @@ ESX.RegisterServerCallback('esx_ambulancejob:buyJobVehicle', function(source, cb if xPlayer.getMoney() >= price then xPlayer.removeMoney(price) - MySQL.Async.execute('INSERT INTO owned_vehicles (owner, vehicle, plate, type, job, stored) VALUES (@owner, @vehicle, @plate, @type, @job, @stored)', { + MySQL.Async.execute('INSERT INTO owned_vehicles (`owner`, `vehicle`, `plate`, `type`, `job`, `stored`) VALUES (@owner, @vehicle, @plate, @type, @job, @stored)', { ['@owner'] = xPlayer.identifier, ['@vehicle'] = json.encode(vehicleProps), ['@plate'] = vehicleProps.plate, From 5d4f86b5b5e4a154649af7f58d556afd68a16cb4 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Fri, 4 Jan 2019 13:24:50 +0100 Subject: [PATCH 116/177] Only sorround reserved word with backticks --- server/main.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/main.lua b/server/main.lua index add47594..423589ce 100644 --- a/server/main.lua +++ b/server/main.lua @@ -123,7 +123,7 @@ ESX.RegisterServerCallback('esx_ambulancejob:buyJobVehicle', function(source, cb if xPlayer.getMoney() >= price then xPlayer.removeMoney(price) - MySQL.Async.execute('INSERT INTO owned_vehicles (`owner`, `vehicle`, `plate`, `type`, `job`, `stored`) VALUES (@owner, @vehicle, @plate, @type, @job, @stored)', { + MySQL.Async.execute('INSERT INTO owned_vehicles (owner, vehicle, plate, type, job, `stored`) VALUES (@owner, @vehicle, @plate, @type, @job, @stored)', { ['@owner'] = xPlayer.identifier, ['@vehicle'] = json.encode(vehicleProps), ['@plate'] = vehicleProps.plate, @@ -158,7 +158,7 @@ ESX.RegisterServerCallback('esx_ambulancejob:storeNearbyVehicle', function(sourc if not foundPlate then cb(false) else - MySQL.Async.execute('UPDATE owned_vehicles SET stored = true WHERE owner = @owner AND plate = @plate AND job = @job', { + MySQL.Async.execute('UPDATE owned_vehicles SET `stored` = true WHERE owner = @owner AND plate = @plate AND job = @job', { ['@owner'] = xPlayer.identifier, ['@plate'] = foundPlate, ['@job'] = xPlayer.job.name From e1056d517037ea7b3dc6d52ff0ea29ff5f4c4ec8 Mon Sep 17 00:00:00 2001 From: Oldarorn <36448848+Oldarorn@users.noreply.github.com> Date: Sun, 27 Jan 2019 11:42:43 +0100 Subject: [PATCH 117/177] Update fr.lua --- locales/fr.lua | 78 +++++++++++++++++++++++++------------------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/locales/fr.lua b/locales/fr.lua index 5e4bf47e..b56c17f7 100644 --- a/locales/fr.lua +++ b/locales/fr.lua @@ -5,42 +5,42 @@ Locales['fr'] = { ['ems_clothes_ems'] = 'Tenue Ambulancier', -- Vehicles ['ambulance'] = 'ambulance', - ['helicopter_prompt'] = 'press ~INPUT_CONTEXT~ to access the ~y~Helicopter Actions~s~.', - ['helicopter_buy'] = 'helicopter shop', - ['helicopter_garage'] = 'open garage', - ['helicopter_store'] = 'store helicopter in garage', - ['helicopter_garage_title'] = 'helicopter Garage', - ['helicopter_title'] = 'helicopter Actions', - ['helicopter_notauthorized'] = 'you\'re not authorized to buy helicopters.', - ['garage_prompt'] = 'press ~INPUT_CONTEXT~ to access the ~y~Vehicle Actions~s~.', - ['garage_title'] = 'vehicle Actions', - ['garage_stored'] = 'stored', - ['garage_notstored'] = 'not in garage', - ['garage_storing'] = 'we\'re attempting to remove the vehicle, make sure no players are around it.', - ['garage_has_stored'] = 'the vehicle has been stored in your garage', - ['garage_has_notstored'] = 'no nearby owned vehicles were found', - ['garage_notavailable'] = 'your vehicle is not stored in the garage.', - ['garage_blocked'] = 'there\'s no available spawn points!', - ['garage_empty'] = 'you dont have any vehicles in your garage.', - ['garage_released'] = 'your vehicle has been released from the garage.', - ['garage_store_nearby'] = 'there is no nearby vehicles.', - ['garage_storeditem'] = 'open garage', - ['garage_storeitem'] = 'store vehicle in garage', - ['garage_buyitem'] = 'vehicle shop', + ['helicopter_prompt'] = 'appuyez sur ~INPUT_CONTEXT~ pour accéder aux ~y~Actions de l\'hélicoptère~s~.', + ['helicopter_buy'] = 'magasin hélicoptère', + ['helicopter_garage'] = 'ouvrir le garage', + ['helicopter_store'] = 'garer l\'hélicoptère dans le garage', + ['helicopter_garage_title'] = 'garage hélicoptère', + ['helicopter_title'] = 'actions hélicoptère', + ['helicopter_notauthorized'] = 'vous n\'êtes pas autorisé à acheter un hélicoptère.', + ['garage_prompt'] = 'appuyez sur ~INPUT_CONTEXT~ pour accéder aux ~y~Actions des véhciules~s~.', + ['garage_title'] = 'actions véhicules', + ['garage_stored'] = 'rangé', + ['garage_notstored'] = 'en dehors du garage', + ['garage_storing'] = 'tentative de suppression du véhicule, assurez-vous que personne ne soit autour.', + ['garage_has_stored'] = 'le véhicule a bien été rangé dans le garage', + ['garage_has_notstored'] = 'aucun véhicule dans le garage', + ['garage_notavailable'] = 'votre véhicule n\'est pas rangé dans le garage.', + ['garage_blocked'] = 'la sortie du garage est obstruée!', + ['garage_empty'] = 'vous n\'avez aucun véhicule dans le garage.', + ['garage_released'] = 'votre véhicule a été sorti.', + ['garage_store_nearby'] = 'aucun véhicule a proximité.', + ['garage_storeditem'] = 'ouvrir le garage', + ['garage_storeitem'] = 'ranger le véhicule', + ['garage_buyitem'] = 'magasin véhicule', ['shop_item'] = '$%s', - ['vehicleshop_title'] = 'vehicle Shop', - ['vehicleshop_confirm'] = 'do you want to buy this vehicle?', - ['vehicleshop_bought'] = 'you have bought ~y~%s~s~ for ~r~$%s~s~', - ['vehicleshop_money'] = 'you cannot afford that vehicle', - ['vehicleshop_awaiting_model'] = 'the vehicle is currently ~g~DOWNLOADING & LOADING~s~ please wait', - ['confirm_no'] = 'no', - ['confirm_yes'] = 'yes', + ['vehicleshop_title'] = 'magasin véhicule', + ['vehicleshop_confirm'] = 'voulez-vous acheter ce véhicule?', + ['vehicleshop_bought'] = 'vous avez acheté ~y~%s~s~ pour ~r~$%s~s~', + ['vehicleshop_money'] = 'vous ne pouvez pas acheter ce véhicule', + ['vehicleshop_awaiting_model'] = 'le véhicule est actuellement en ~g~PRÉPARATION~s~ veuillez patienter', + ['confirm_no'] = 'non', + ['confirm_yes'] = 'oui', -- Action Menu ['hospital'] = 'hôpital', ['revive_inprogress'] = 'réanimation en cours', ['revive_complete'] = 'vous avez réanimé ~y~%s~s~', ['revive_complete_award'] = 'vous avez réanimé ~y~%s~s~, ~g~$%s~s~', - ['heal_inprogress'] = 'you are healing!', + ['heal_inprogress'] = 'vous soignez...', ['heal_complete'] = 'vous avez soigné ~y~%s~s~', ['no_players'] = 'aucun joueur à proximité', ['no_vehicles'] = 'aucun véhicule à proximité', @@ -70,15 +70,15 @@ Locales['fr'] = { -- Phone ['alert_ambulance'] = 'alerte Ambulance', -- Death - ['respawn_available_in'] = 'respawn available in ~b~%s minutes %s seconds~s~', - ['respawn_bleedout_in'] = 'you will bleed out in ~b~%s minutes %s seconds~s~\n', - ['respawn_bleedout_prompt'] = 'hold [~b~E~s~] to respawn', - ['respawn_bleedout_fine'] = 'hold [~b~E~s~] to respawn for ~g~$%s~s~', - ['respawn_bleedout_fine_msg'] = 'you paid ~r~$%s~s~ to respawn.', - ['distress_send'] = 'press [~b~G~s~] to send distress signal', - ['distress_sent'] = 'distress signal has been sent to available units!', - ['distress_message'] = 'medical attention required: unconscious citizen!', - ['combatlog_message'] = 'you have been force-respawned because you\'ve previously left the server when dead.', + ['respawn_available_in'] = 'réanimation possible dans ~b~%s minutes %s secondes~s~', + ['respawn_bleedout_in'] = 'vous allez souffrir d\'une hémorragie dans ~b~%s minutes %s secondes~s~\n', + ['respawn_bleedout_prompt'] = 'maintenez [~b~E~s~] pour être réanimé', + ['respawn_bleedout_fine'] = 'maintenez [~b~E~s~] pour être réanimé pour ~g~$%s~s~', + ['respawn_bleedout_fine_msg'] = 'vous avez payé ~r~$%s~s~ pour être réanimer.', + ['distress_send'] = 'appuyez sur [~b~G~s~] pour envoyer un signal de détresse', + ['distress_sent'] = 'un signal a été envoyé à toutes les unités disponibles!', + ['distress_message'] = 'interventtion requise: citoyen inconscient!', + ['combatlog_message'] = 'vous avez été réanimé de force car vous avez quitté le serveur.', -- Revive ['revive_help'] = 'relancer un joueur', -- Item From 630d52c489dd5201d644bc785e45b9efa2bce800 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Thu, 21 Feb 2019 12:16:40 +0100 Subject: [PATCH 118/177] Simplified config --- config.lua | 56 +++++++++--------------------------------------------- 1 file changed, 9 insertions(+), 47 deletions(-) diff --git a/config.lua b/config.lua index a9bd281e..055240e3 100644 --- a/config.lua +++ b/config.lua @@ -133,35 +133,19 @@ Config.Hospitals = { Config.AuthorizedVehicles = { ambulance = { - { - model = 'ambulance', - label = 'Ambulance Van', - price = 5000 - } + { model = 'ambulance', label = 'Ambulance Van', price = 5000} }, doctor = { - { - model = 'ambulance', - label = 'Ambulance Van', - price = 4500 - } + { model = 'ambulance', label = 'Ambulance Van', price = 4500} }, chief_doctor = { - { - model = 'ambulance', - label = 'Ambulance Van', - price = 3000 - } + { model = 'ambulance', label = 'Ambulance Van', price = 3000} }, boss = { - { - model = 'ambulance', - label = 'Ambulance Van', - price = 2000 - } + { model = 'ambulance', label = 'Ambulance Van', price = 2000} } } @@ -171,39 +155,17 @@ Config.AuthorizedHelicopters = { ambulance = {}, doctor = { - { - model = 'buzzard2', - label = 'Nagasaki Buzzard', - price = 150000 - } + { model = 'buzzard2', label = 'Nagasaki Buzzard', price = 150000 } }, chief_doctor = { - { - model = 'buzzard2', - label = 'Nagasaki Buzzard', - price = 150000 - }, - - { - model = 'seasparrow', - label = 'Sea Sparrow', - price = 300000 - } + { model = 'buzzard2', label = 'Nagasaki Buzzard', price = 150000 }, + { model = 'seasparrow', label = 'Sea Sparrow', price = 300000 } }, boss = { - { - model = 'buzzard2', - label = 'Nagasaki Buzzard', - price = 100000 - }, - - { - model = 'seasparrow', - label = 'Sea Sparrow', - price = 250000 - } + { model = 'buzzard2', label = 'Nagasaki Buzzard', price = 10000 }, + { model = 'seasparrow', label = 'Sea Sparrow', price = 250000 } } } From 0014a768848b25b0720152586e19406e4777dbe7 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Fri, 22 Feb 2019 18:35:18 +0100 Subject: [PATCH 119/177] Fixed security vulnerability --- server/main.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/server/main.lua b/server/main.lua index 423589ce..347f334d 100644 --- a/server/main.lua +++ b/server/main.lua @@ -285,8 +285,13 @@ RegisterServerEvent('esx_ambulancejob:setDeathStatus') AddEventHandler('esx_ambulancejob:setDeathStatus', function(isDead) local identifier = GetPlayerIdentifiers(source)[1] + if type(isDead) ~= 'boolean' then + print(('esx_ambulancejob: %s attempted to parse something else than a boolean to setDeathStatus!'):format(identifier)) + return + end + MySQL.Sync.execute('UPDATE users SET is_dead = @isDead WHERE identifier = @identifier', { ['@identifier'] = identifier, - ['@isDead'] = isDead + ['@isDead'] = isDead }) end) From 56159154fe044af88b62982ecb7129b4a6781bc8 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Fri, 22 Feb 2019 18:43:44 +0100 Subject: [PATCH 120/177] Don't parse vector3 since serializer doesn't support See https://github.com/ESX-Org/es_extended/issues/216 for more information --- client/main.lua | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/client/main.lua b/client/main.lua index e8dfb2be..3a51e192 100644 --- a/client/main.lua +++ b/client/main.lua @@ -275,11 +275,17 @@ function RemoveItemsAfterRPDeath() end ESX.TriggerServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function() - ESX.SetPlayerData('lastPosition', Config.RespawnPoint.coords) + local formattedCoords = { + x = Config.RespawnPoint.coords.x, + y = Config.RespawnPoint.coords.y, + z = Config.RespawnPoint.coords.z + } + + ESX.SetPlayerData('lastPosition', formattedCoords) ESX.SetPlayerData('loadout', {}) - TriggerServerEvent('esx:updateLastPosition', Config.RespawnPoint.coords) - RespawnPed(PlayerPedId(), Config.RespawnPoint.coords, Config.RespawnPoint.heading) + TriggerServerEvent('esx:updateLastPosition', formattedCoords) + RespawnPed(PlayerPedId(), formattedCoords, Config.RespawnPoint.heading) StopScreenEffect('DeathFailOut') DoScreenFadeIn(800) @@ -316,6 +322,7 @@ RegisterNetEvent('esx_ambulancejob:revive') AddEventHandler('esx_ambulancejob:revive', function() local playerPed = PlayerPedId() local coords = GetEntityCoords(playerPed) + TriggerServerEvent('esx_ambulancejob:setDeathStatus', false) Citizen.CreateThread(function() @@ -325,24 +332,17 @@ AddEventHandler('esx_ambulancejob:revive', function() Citizen.Wait(50) end - ESX.SetPlayerData('lastPosition', { - x = coords.x, - y = coords.y, - z = coords.z - }) + local formattedCoords = { + x = ESX.Math.Round(coords.x, 1), + y = ESX.Math.Round(coords.y, 1), + z = ESX.Math.Round(coords.z, 1) + } - TriggerServerEvent('esx:updateLastPosition', { - x = coords.x, - y = coords.y, - z = coords.z - }) + ESX.SetPlayerData('lastPosition', formattedCoords) - RespawnPed(playerPed, { - x = coords.x, - y = coords.y, - z = coords.z, - heading = 0.0 - }) + TriggerServerEvent('esx:updateLastPosition', formattedCoords) + + RespawnPed(playerPed, formattedCoords, 0.0) StopScreenEffect('DeathFailOut') DoScreenFadeIn(800) From 235e9fda2cba0a9fa9d51d69e69fd0de7dfcaf68 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Sun, 24 Feb 2019 11:09:02 +0100 Subject: [PATCH 121/177] Implemented letSleep --- client/job.lua | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/client/job.lua b/client/job.lua index d72c4670..62b56f2b 100644 --- a/client/job.lua +++ b/client/job.lua @@ -204,7 +204,7 @@ Citizen.CreateThread(function() while true do Citizen.Wait(0) local playerCoords = GetEntityCoords(PlayerPedId()) - local canSleep, isInMarker, hasExited = true, false, false + local letSleep, isInMarker, hasExited = true, false, false local currentHospital, currentPart, currentPartNum for hospitalNum,hospital in pairs(Config.Hospitals) do @@ -215,7 +215,7 @@ Citizen.CreateThread(function() if distance < Config.DrawDistance then DrawMarker(Config.Marker.type, v, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Config.Marker.x, Config.Marker.y, Config.Marker.z, Config.Marker.r, Config.Marker.g, Config.Marker.b, Config.Marker.a, false, false, 2, Config.Marker.rotate, nil, nil, false) - canSleep = false + letSleep = false end if distance < Config.Marker.x then @@ -229,7 +229,7 @@ Citizen.CreateThread(function() if distance < Config.DrawDistance then DrawMarker(Config.Marker.type, v, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Config.Marker.x, Config.Marker.y, Config.Marker.z, Config.Marker.r, Config.Marker.g, Config.Marker.b, Config.Marker.a, false, false, 2, Config.Marker.rotate, nil, nil, false) - canSleep = false + letSleep = false end if distance < Config.Marker.x then @@ -243,7 +243,7 @@ Citizen.CreateThread(function() if distance < Config.DrawDistance then DrawMarker(v.Marker.type, v.Spawner, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, v.Marker.x, v.Marker.y, v.Marker.z, v.Marker.r, v.Marker.g, v.Marker.b, v.Marker.a, false, false, 2, v.Marker.rotate, nil, nil, false) - canSleep = false + letSleep = false end if distance < v.Marker.x then @@ -257,7 +257,7 @@ Citizen.CreateThread(function() if distance < Config.DrawDistance then DrawMarker(v.Marker.type, v.Spawner, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, v.Marker.x, v.Marker.y, v.Marker.z, v.Marker.r, v.Marker.g, v.Marker.b, v.Marker.a, false, false, 2, v.Marker.rotate, nil, nil, false) - canSleep = false + letSleep = false end if distance < v.Marker.x then @@ -271,7 +271,7 @@ Citizen.CreateThread(function() if distance < Config.DrawDistance then DrawMarker(v.Marker.type, v.From, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, v.Marker.x, v.Marker.y, v.Marker.z, v.Marker.r, v.Marker.g, v.Marker.b, v.Marker.a, false, false, 2, v.Marker.rotate, nil, nil, false) - canSleep = false + letSleep = false end @@ -286,7 +286,7 @@ Citizen.CreateThread(function() if distance < Config.DrawDistance then DrawMarker(v.Marker.type, v.From, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, v.Marker.x, v.Marker.y, v.Marker.z, v.Marker.r, v.Marker.g, v.Marker.b, v.Marker.a, false, false, 2, v.Marker.rotate, nil, nil, false) - canSleep = false + letSleep = false end if distance < v.Marker.x then @@ -316,6 +316,10 @@ Citizen.CreateThread(function() TriggerEvent('esx_ambulancejob:hasExitedMarker', LastHospital, LastPart, LastPartNum) end + if letSleep then + Citizen.Wait(500) + end + end end end) From ea6c31f1d963c94d21bf64f2c8dca6bfea769c62 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Sun, 24 Feb 2019 11:21:49 +0100 Subject: [PATCH 122/177] Fixed fast travel performance, see #113 --- client/job.lua | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/client/job.lua b/client/job.lua index 62b56f2b..7da6270a 100644 --- a/client/job.lua +++ b/client/job.lua @@ -178,24 +178,20 @@ function OpenMobileAmbulanceActionsMenu() end function FastTravel(coords, heading) - TeleportFadeEffect(PlayerPedId(), coords, heading) -end + local playerPed = PlayerPedId() -function TeleportFadeEffect(entity, coords, heading) - Citizen.CreateThread(function() - DoScreenFadeOut(800) + DoScreenFadeOut(800) - while not IsScreenFadedOut() do - Citizen.Wait(0) + while not IsScreenFadedOut() do + Citizen.Wait(500) + end + + ESX.Game.Teleport(playerPed, coords, function() + DoScreenFadeIn(800) + + if heading then + SetEntityHeading(playerPed, heading) end - - ESX.Game.Teleport(entity, coords, function() - DoScreenFadeIn(800) - - if heading then - SetEntityHeading(entity, heading) - end - end) end) end From 7b614c3c7ba45e89f08544597e8c38da508a9f21 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Sun, 24 Feb 2019 12:44:06 +0100 Subject: [PATCH 123/177] Bandage & Medkit animations upon usage, closes #116 --- client/job.lua | 6 ++++-- client/main.lua | 36 ++++++++++++++++++++++++++++++++++++ server/main.lua | 29 +++++++++++++++++++---------- 3 files changed, 59 insertions(+), 12 deletions(-) diff --git a/client/job.lua b/client/job.lua index 7da6270a..e9407f23 100644 --- a/client/job.lua +++ b/client/job.lua @@ -907,7 +907,7 @@ function WarpPedInClosestVehicle(ped) end RegisterNetEvent('esx_ambulancejob:heal') -AddEventHandler('esx_ambulancejob:heal', function(healType) +AddEventHandler('esx_ambulancejob:heal', function(healType, quiet) local playerPed = PlayerPedId() local maxHealth = GetEntityMaxHealth(playerPed) @@ -919,5 +919,7 @@ AddEventHandler('esx_ambulancejob:heal', function(healType) SetEntityHealth(playerPed, maxHealth) end - ESX.ShowNotification(_U('healed')) + if not quiet then + ESX.ShowNotification(_U('healed')) + end end) diff --git a/client/main.lua b/client/main.lua index 3a51e192..d2cb053e 100644 --- a/client/main.lua +++ b/client/main.lua @@ -102,6 +102,42 @@ function OnPlayerDeath() StartScreenEffect('DeathFailOut', 0, false) end +RegisterNetEvent('esx_ambulancejob:useItem') +AddEventHandler('esx_ambulancejob:useItem', function(itemName) + if itemName == 'medikit' then + local lib, anim = 'anim@heists@narcotics@funding@gang_idle', 'gang_chatting_idle01' -- TODO better animations + local playerPed = PlayerPedId() + + ESX.Streaming.RequestAnimDict(lib, function() + TaskPlayAnim(playerPed, lib, anim, 8.0, -8.0, -1, 0, 0, false, false, false) + + Citizen.Wait(500) + while IsEntityPlayingAnim(playerPed, lib, anim, 3) do + Citizen.Wait(100) + end + + TriggerEvent('esx_ambulancejob:heal', 'big', true) + ESX.ShowNotification(_U('used_medikit')) + end) + + elseif itemName == 'bandage' then + local lib, anim = 'anim@heists@narcotics@funding@gang_idle', 'gang_chatting_idle01' -- TODO better animations + local playerPed = PlayerPedId() + + ESX.Streaming.RequestAnimDict(lib, function() + TaskPlayAnim(playerPed, lib, anim, 8.0, -8.0, -1, 0, 0, false, false, false) + + Citizen.Wait(500) + while IsEntityPlayingAnim(playerPed, lib, anim, 3) do + Citizen.Wait(100) + end + + TriggerEvent('esx_ambulancejob:heal', 'small', true) + ESX.ShowNotification(_U('used_bandage')) + end) + end +end) + function StartDistressSignal() Citizen.CreateThread(function() local timer = Config.BleedoutTimer diff --git a/server/main.lua b/server/main.lua index 347f334d..52c8e52a 100644 --- a/server/main.lua +++ b/server/main.lua @@ -1,4 +1,5 @@ ESX = nil +local playersHealing = {} TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) @@ -250,21 +251,29 @@ end, function(source, args, user) end, { help = _U('revive_help'), params = {{ name = 'id' }} }) ESX.RegisterUsableItem('medikit', function(source) - local _source = source - local xPlayer = ESX.GetPlayerFromId(_source) - xPlayer.removeInventoryItem('medikit', 1) + if not playersHealing[source] then + local xPlayer = ESX.GetPlayerFromId(source) + xPlayer.removeInventoryItem('medikit', 1) + + playersHealing[source] = true + TriggerClientEvent('esx_ambulancejob:useItem', source, 'medikit') - TriggerClientEvent('esx_ambulancejob:heal', _source, 'big') - TriggerClientEvent('esx:showNotification', _source, _U('used_medikit')) + Citizen.Wait(10000) + playersHealing[source] = nil + end end) ESX.RegisterUsableItem('bandage', function(source) - local _source = source - local xPlayer = ESX.GetPlayerFromId(_source) - xPlayer.removeInventoryItem('bandage', 1) + if not playersHealing[source] then + local xPlayer = ESX.GetPlayerFromId(source) + xPlayer.removeInventoryItem('bandage', 1) + + playersHealing[source] = true + TriggerClientEvent('esx_ambulancejob:useItem', source, 'bandage') - TriggerClientEvent('esx_ambulancejob:heal', _source, 'small') - TriggerClientEvent('esx:showNotification', _source, _U('used_bandage')) + Citizen.Wait(10000) + playersHealing[source] = nil + end end) ESX.RegisterServerCallback('esx_ambulancejob:getDeathStatus', function(source, cb) From 7da37f36fc53be2cc656037678df33c9c801286e Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Sun, 24 Feb 2019 12:48:03 +0100 Subject: [PATCH 124/177] Disable all actions when healing --- client/main.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/client/main.lua b/client/main.lua index d2cb053e..efa794a9 100644 --- a/client/main.lua +++ b/client/main.lua @@ -104,6 +104,8 @@ end RegisterNetEvent('esx_ambulancejob:useItem') AddEventHandler('esx_ambulancejob:useItem', function(itemName) + ESX.UI.Menu.CloseAll() + if itemName == 'medikit' then local lib, anim = 'anim@heists@narcotics@funding@gang_idle', 'gang_chatting_idle01' -- TODO better animations local playerPed = PlayerPedId() @@ -113,7 +115,8 @@ AddEventHandler('esx_ambulancejob:useItem', function(itemName) Citizen.Wait(500) while IsEntityPlayingAnim(playerPed, lib, anim, 3) do - Citizen.Wait(100) + Citizen.Wait(0) + DisableAllControlActions(0) end TriggerEvent('esx_ambulancejob:heal', 'big', true) @@ -129,7 +132,8 @@ AddEventHandler('esx_ambulancejob:useItem', function(itemName) Citizen.Wait(500) while IsEntityPlayingAnim(playerPed, lib, anim, 3) do - Citizen.Wait(100) + Citizen.Wait(0) + DisableAllControlActions(0) end TriggerEvent('esx_ambulancejob:heal', 'small', true) From 0bd3eff7ceb5e72c184a1977c80e015f70dba222 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Sun, 24 Feb 2019 12:48:21 +0100 Subject: [PATCH 125/177] One decimal in config enforced --- config.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.lua b/config.lua index 055240e3..12402226 100644 --- a/config.lua +++ b/config.lua @@ -27,7 +27,7 @@ Config.RemoveItemsAfterRPDeath = true Config.EarlyRespawnFine = false Config.EarlyRespawnFineAmount = 5000 -Config.RespawnPoint = { coords = vector3(341.07, -1397.31, 32.51), heading = 48.5 } +Config.RespawnPoint = { coords = vector3(341.0, -1397.3, 32.5), heading = 48.5 } Config.Hospitals = { From c116378a6bed23005e833963d531133411a764f5 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Sat, 9 Mar 2019 15:41:54 +0100 Subject: [PATCH 126/177] Close all esx menus upon death --- client/job.lua | 9 ++++----- client/main.lua | 11 +++++------ 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/client/job.lua b/client/job.lua index e9407f23..4df79cb0 100644 --- a/client/job.lua +++ b/client/job.lua @@ -36,11 +36,10 @@ function OpenMobileAmbulanceActionsMenu() ESX.UI.Menu.CloseAll() - ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'mobile_ambulance_actions', - { - title = _U('ambulance'), - align = 'top-left', - elements = { + ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'mobile_ambulance_actions', { + title = _U('ambulance'), + align = 'top-left', + elements = { {label = _U('ems_menu'), value = 'citizen_interaction'} } }, function(data, menu) diff --git a/client/main.lua b/client/main.lua index efa794a9..adefb232 100644 --- a/client/main.lua +++ b/client/main.lua @@ -94,6 +94,7 @@ end) function OnPlayerDeath() IsDead = true + ESX.UI.Menu.CloseAll() TriggerServerEvent('esx_ambulancejob:setDeathStatus', true) StartDeathTimer() @@ -346,15 +347,15 @@ end RegisterNetEvent('esx_phone:loaded') AddEventHandler('esx_phone:loaded', function(phoneNumber, contacts) local specialContact = { - name = 'Ambulance', - number = 'ambulance', - base64Icon = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEwAACxMBAJqcGAAABp5JREFUWIW1l21sFNcVhp/58npn195de23Ha4Mh2EASSvk0CPVHmmCEI0RCTQMBKVVooxYoalBVCVokICWFVFVEFeKoUdNECkZQIlAoFGMhIkrBQGxHwhAcChjbeLcsYHvNfsx+zNz+MBDWNrYhzSvdP+e+c973XM2cc0dihFi9Yo6vSzN/63dqcwPZcnEwS9PDmYoE4IxZIj+ciBb2mteLwlZdfji+dXtNU2AkeaXhCGteLZ/X/IS64/RoR5mh9tFVAaMiAldKQUGiRzFp1wXJPj/YkxblbfFLT/tjq9/f1XD0sQyse2li7pdP5tYeLXXMMGUojAiWKeOodE1gqpmNfN2PFeoF00T2uLGKfZzTwhzqbaEmeYWAQ0K1oKIlfPb7t+7M37aruXvEBlYvnV7xz2ec/2jNs9kKooKNjlksiXhJfLqf1PXOIU9M8fmw/XgRu523eTNyhhu6xLjbSeOFC6EX3t3V9PmwBla9Vv7K7u85d3bpqlwVcvHn7B8iVX+IFQoNKdwfstuFtWoFvwp9zj5XL7nRlPXyudjS9z+u35tmuH/lu6dl7+vSVXmDUcpbX+skP65BxOOPJA4gjDicOM2PciejeTwcsYek1hyl6me5nhNnmwPXBhjYuGC699OpzoaAO0PbYJSy5vgt4idOPrJwf6QuX2FO0oOtqIgj9pDU5dCWrMlyvXf86xsGgHyPeLos83Brns1WFXLxxgVBorHpW4vfQ6KhkbUtCot6srns1TLPjNVr7+1J0PepVc92H/Eagkb7IsTWd4ZMaN+yCXv5zLRY9GQ9xuYtQz4nfreWGdH9dNlkfnGq5/kdO88ekwGan1B3mDJsdMxCqv5w2Iq0khLs48vSllrsG/Y5pfojNugzScnQXKBVA8hrX51ddHq0o6wwIlgS8Y7obZdUZVjOYLC6e3glWkBBVHC2RJ+w/qezCuT/2sV6Q5VYpowjvnf/iBJJqvpYBgBS+w6wVB5DLEOiTZHWy36nNheg0jUBs3PoJnMfyuOdAECqrZ3K7KcACGQp89RAtlysCphqZhPtRzYlcPx+ExklJUiq0le5omCfOGFAYn3qFKS/fZAWS7a3Y2wa+GJOEy4US+B3aaPUYJamj4oI5LA/jWQBt5HIK5+JfXzZsJVpXi/ac8+mxWIXWzAG4Wb4g/jscNMp63I4U5FcKaVvsNyFALokSA47Kx8PVk83OabCHZsiqwAKEpjmfUJIkoh/R+L9oTpjluhRkGSPG4A7EkS+Y3HZk0OXYpIVNy01P5yItnptDsvtIwr0SunqoVP1GG1taTHn1CloXm9aLBEIEDl/IS2W6rg+qIFEYR7+OJTesqJqYa95/VKBNOHLjDBZ8sDS2998a0Bs/F//gvu5Z9NivadOc/U3676pEsizBIN1jCYlhClL+ELJDrkobNUBfBZqQfMN305HAgnIeYi4OnYMh7q/AsAXSdXK+eH41sykxd+TV/AsXvR/MeARAttD9pSqF9nDNfSEoDQsb5O31zQFprcaV244JPY7bqG6Xd9K3C3ALgbfk3NzqNE6CdplZrVFL27eWR+UASb6479ULfhD5AzOlSuGFTE6OohebElbcb8fhxA4xEPUgdTK19hiNKCZgknB+Ep44E44d82cxqPPOKctCGXzTmsBXbV1j1S5XQhyHq6NvnABPylu46A7QmVLpP7w9pNz4IEb0YyOrnmjb8bjB129fDBRkDVj2ojFbYBnCHHb7HL+OC7KQXeEsmAiNrnTqLy3d3+s/bvlVmxpgffM1fyM5cfsPZLuK+YHnvHELl8eUlwV4BXim0r6QV+4gD9Nlnjbfg1vJGktbI5UbN/TcGmAAYDG84Gry/MLLl/zKouO2Xukq/YkCyuWYV5owTIGjhVFCPL6J7kLOTcH89ereF1r4qOsm3gjSevl85El1Z98cfhB3qBN9+dLp1fUTco+0OrVMnNjFuv0chYbBYT2HcBoa+8TALyWQOt/ImPHoFS9SI3WyRajgdt2mbJgIlbREplfveuLf/XXemjXX7v46ZxzPlfd8YlZ01My5MUEVdIY5rueYopw4fQHkbv7/rZkTw6JwjyalBCHur9iD9cI2mU0UzD3P9H6yZ1G5dt7Gwe96w07dl5fXj7vYqH2XsNovdTI6KMrlsAXhRyz7/C7FBO/DubdVq4nBLPaohcnBeMr3/2k4fhQ+Uc8995YPq2wMzNjww2X+vwNt1p00ynrd2yKDJAVN628sBX1hZIdxXdStU9G5W2bd9YHR5L3f/CNmJeY9G8WAAAAAElFTkSuQmCC' + name = 'Ambulance', + number = 'ambulance', + base64Icon = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEwAACxMBAJqcGAAABp5JREFUWIW1l21sFNcVhp/58npn195de23Ha4Mh2EASSvk0CPVHmmCEI0RCTQMBKVVooxYoalBVCVokICWFVFVEFeKoUdNECkZQIlAoFGMhIkrBQGxHwhAcChjbeLcsYHvNfsx+zNz+MBDWNrYhzSvdP+e+c973XM2cc0dihFi9Yo6vSzN/63dqcwPZcnEwS9PDmYoE4IxZIj+ciBb2mteLwlZdfji+dXtNU2AkeaXhCGteLZ/X/IS64/RoR5mh9tFVAaMiAldKQUGiRzFp1wXJPj/YkxblbfFLT/tjq9/f1XD0sQyse2li7pdP5tYeLXXMMGUojAiWKeOodE1gqpmNfN2PFeoF00T2uLGKfZzTwhzqbaEmeYWAQ0K1oKIlfPb7t+7M37aruXvEBlYvnV7xz2ec/2jNs9kKooKNjlksiXhJfLqf1PXOIU9M8fmw/XgRu523eTNyhhu6xLjbSeOFC6EX3t3V9PmwBla9Vv7K7u85d3bpqlwVcvHn7B8iVX+IFQoNKdwfstuFtWoFvwp9zj5XL7nRlPXyudjS9z+u35tmuH/lu6dl7+vSVXmDUcpbX+skP65BxOOPJA4gjDicOM2PciejeTwcsYek1hyl6me5nhNnmwPXBhjYuGC699OpzoaAO0PbYJSy5vgt4idOPrJwf6QuX2FO0oOtqIgj9pDU5dCWrMlyvXf86xsGgHyPeLos83Brns1WFXLxxgVBorHpW4vfQ6KhkbUtCot6srns1TLPjNVr7+1J0PepVc92H/Eagkb7IsTWd4ZMaN+yCXv5zLRY9GQ9xuYtQz4nfreWGdH9dNlkfnGq5/kdO88ekwGan1B3mDJsdMxCqv5w2Iq0khLs48vSllrsG/Y5pfojNugzScnQXKBVA8hrX51ddHq0o6wwIlgS8Y7obZdUZVjOYLC6e3glWkBBVHC2RJ+w/qezCuT/2sV6Q5VYpowjvnf/iBJJqvpYBgBS+w6wVB5DLEOiTZHWy36nNheg0jUBs3PoJnMfyuOdAECqrZ3K7KcACGQp89RAtlysCphqZhPtRzYlcPx+ExklJUiq0le5omCfOGFAYn3qFKS/fZAWS7a3Y2wa+GJOEy4US+B3aaPUYJamj4oI5LA/jWQBt5HIK5+JfXzZsJVpXi/ac8+mxWIXWzAG4Wb4g/jscNMp63I4U5FcKaVvsNyFALokSA47Kx8PVk83OabCHZsiqwAKEpjmfUJIkoh/R+L9oTpjluhRkGSPG4A7EkS+Y3HZk0OXYpIVNy01P5yItnptDsvtIwr0SunqoVP1GG1taTHn1CloXm9aLBEIEDl/IS2W6rg+qIFEYR7+OJTesqJqYa95/VKBNOHLjDBZ8sDS2998a0Bs/F//gvu5Z9NivadOc/U3676pEsizBIN1jCYlhClL+ELJDrkobNUBfBZqQfMN305HAgnIeYi4OnYMh7q/AsAXSdXK+eH41sykxd+TV/AsXvR/MeARAttD9pSqF9nDNfSEoDQsb5O31zQFprcaV244JPY7bqG6Xd9K3C3ALgbfk3NzqNE6CdplZrVFL27eWR+UASb6479ULfhD5AzOlSuGFTE6OohebElbcb8fhxA4xEPUgdTK19hiNKCZgknB+Ep44E44d82cxqPPOKctCGXzTmsBXbV1j1S5XQhyHq6NvnABPylu46A7QmVLpP7w9pNz4IEb0YyOrnmjb8bjB129fDBRkDVj2ojFbYBnCHHb7HL+OC7KQXeEsmAiNrnTqLy3d3+s/bvlVmxpgffM1fyM5cfsPZLuK+YHnvHELl8eUlwV4BXim0r6QV+4gD9Nlnjbfg1vJGktbI5UbN/TcGmAAYDG84Gry/MLLl/zKouO2Xukq/YkCyuWYV5owTIGjhVFCPL6J7kLOTcH89ereF1r4qOsm3gjSevl85El1Z98cfhB3qBN9+dLp1fUTco+0OrVMnNjFuv0chYbBYT2HcBoa+8TALyWQOt/ImPHoFS9SI3WyRajgdt2mbJgIlbREplfveuLf/XXemjXX7v46ZxzPlfd8YlZ01My5MUEVdIY5rueYopw4fQHkbv7/rZkTw6JwjyalBCHur9iD9cI2mU0UzD3P9H6yZ1G5dt7Gwe96w07dl5fXj7vYqH2XsNovdTI6KMrlsAXhRyz7/C7FBO/DubdVq4nBLPaohcnBeMr3/2k4fhQ+Uc8995YPq2wMzNjww2X+vwNt1p00ynrd2yKDJAVN628sBX1hZIdxXdStU9G5W2bd9YHR5L3f/CNmJeY9G8WAAAAAElFTkSuQmCC' } TriggerEvent('esx_phone:addSpecialContact', specialContact.name, specialContact.number, specialContact.base64Icon) end) -AddEventHandler('esx:onPlayerDeath', function(reason) +AddEventHandler('esx:onPlayerDeath', function(data) OnPlayerDeath() end) @@ -392,8 +393,6 @@ end) -- Load unloaded IPLs if Config.LoadIpl then Citizen.CreateThread(function() - LoadMpDlcMaps() - EnableMpDlcMaps(true) RequestIpl('Coroner_Int_on') -- Morgue end) end From 9ab635c3004aad95e50510bd92ddc2a45dd0e808 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Sun, 17 Mar 2019 00:14:55 +0100 Subject: [PATCH 127/177] Removed unused config entry --- config.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/config.lua b/config.lua index 12402226..8a37c47c 100644 --- a/config.lua +++ b/config.lua @@ -17,7 +17,6 @@ Config.EarlyRespawnTimer = 2 * minute -- Time til respawn is available Config.BleedoutTimer = 10 * minute -- Time til the player bleeds out Config.EnablePlayerManagement = false -Config.EnableSocietyOwnedVehicles = false Config.RemoveWeaponsAfterRPDeath = true Config.RemoveCashAfterRPDeath = true From 3f513e2d1bb66aa631393b30c23a4f9811dae999 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Mon, 18 Mar 2019 12:04:08 +0100 Subject: [PATCH 128/177] Fixed multihospital thread --- client/job.lua | 37 ++++++++++++++++--------------------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/client/job.lua b/client/job.lua index 4df79cb0..12b706fc 100644 --- a/client/job.lua +++ b/client/job.lua @@ -14,11 +14,10 @@ function OpenAmbulanceActionsMenu() ESX.UI.Menu.CloseAll() - ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'ambulance_actions', - { - title = _U('ambulance'), - align = 'top-left', - elements = elements + ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'ambulance_actions', { + title = _U('ambulance'), + align = 'top-left', + elements = elements }, function(data, menu) if data.current.value == 'cloakroom' then OpenCloakroomMenu() @@ -44,11 +43,10 @@ function OpenMobileAmbulanceActionsMenu() } }, function(data, menu) if data.current.value == 'citizen_interaction' then - ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'citizen_interaction', - { - title = _U('ems_menu_title'), - align = 'top-left', - elements = { + ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'citizen_interaction', { + title = _U('ems_menu_title'), + align = 'top-left', + elements = { {label = _U('ems_menu_revive'), value = 'revive'}, {label = _U('ems_menu_small'), value = 'small'}, {label = _U('ems_menu_big'), value = 'big'}, @@ -311,10 +309,10 @@ Citizen.CreateThread(function() TriggerEvent('esx_ambulancejob:hasExitedMarker', LastHospital, LastPart, LastPartNum) end - if letSleep then - Citizen.Wait(500) - end + end + if letSleep then + Citizen.Wait(500) end end end) @@ -417,10 +415,9 @@ AddEventHandler('esx_ambulancejob:putInVehicle', function() end) function OpenCloakroomMenu() - ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'cloakroom', - { - title = _U('cloakroom'), - align = 'top-left', + ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'cloakroom', { + title = _U('cloakroom'), + align = 'top-left', elements = { {label = _U('ems_clothes_civil'), value = 'citizen_wear'}, {label = _U('ems_clothes_ems'), value = 'ambulance_wear'}, @@ -737,8 +734,7 @@ function OpenShopMenu(elements, restoreCoords, shopCoords) elements = elements }, function(data, menu) - ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'vehicle_shop_confirm', - { + ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'vehicle_shop_confirm', { title = _U('vehicleshop_confirm', data.current.name, data.current.price), align = 'top-left', elements = { @@ -867,8 +863,7 @@ end function OpenPharmacyMenu() ESX.UI.Menu.CloseAll() - ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'pharmacy', - { + ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'pharmacy', { title = _U('pharmacy_menu_title'), align = 'top-left', elements = { From 161ced8393036abb894283bf55378c11fee1bad3 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Mon, 18 Mar 2019 13:16:22 +0100 Subject: [PATCH 129/177] Fix multiple hospital thread attempt 2 --- client/job.lua | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/client/job.lua b/client/job.lua index 12b706fc..85be6428 100644 --- a/client/job.lua +++ b/client/job.lua @@ -287,28 +287,28 @@ Citizen.CreateThread(function() end end - -- Logic for exiting & entering markers - if isInMarker and not HasAlreadyEnteredMarker or (isInMarker and (LastHospital ~= currentHospital or LastPart ~= currentPart or LastPartNum ~= currentPartNum)) then + end - if - (LastHospital ~= nil and LastPart ~= nil and LastPartNum ~= nil) and - (LastHospital ~= currentHospital or LastPart ~= currentPart or LastPartNum ~= currentPartNum) - then - TriggerEvent('esx_ambulancejob:hasExitedMarker', LastHospital, LastPart, LastPartNum) - hasExited = true - end + -- Logic for exiting & entering markers + if isInMarker and not HasAlreadyEnteredMarker or (isInMarker and (LastHospital ~= currentHospital or LastPart ~= currentPart or LastPartNum ~= currentPartNum)) then - HasAlreadyEnteredMarker, LastHospital, LastPart, LastPartNum = true, currentHospital, currentPart, currentPartNum - - TriggerEvent('esx_ambulancejob:hasEnteredMarker', currentHospital, currentPart, currentPartNum) - - end - - if not hasExited and not isInMarker and HasAlreadyEnteredMarker then - HasAlreadyEnteredMarker = false + if + (LastHospital ~= nil and LastPart ~= nil and LastPartNum ~= nil) and + (LastHospital ~= currentHospital or LastPart ~= currentPart or LastPartNum ~= currentPartNum) + then TriggerEvent('esx_ambulancejob:hasExitedMarker', LastHospital, LastPart, LastPartNum) + hasExited = true end + HasAlreadyEnteredMarker, LastHospital, LastPart, LastPartNum = true, currentHospital, currentPart, currentPartNum + + TriggerEvent('esx_ambulancejob:hasEnteredMarker', currentHospital, currentPart, currentPartNum) + + end + + if not hasExited and not isInMarker and HasAlreadyEnteredMarker then + HasAlreadyEnteredMarker = false + TriggerEvent('esx_ambulancejob:hasExitedMarker', LastHospital, LastPart, LastPartNum) end if letSleep then From 181f060a18dfe24ea2a3ee795422680e3accd3d6 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Sun, 5 May 2019 10:01:03 +0200 Subject: [PATCH 130/177] Proper cb usage --- server/main.lua | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/server/main.lua b/server/main.lua index 52c8e52a..0f5b78d9 100644 --- a/server/main.lua +++ b/server/main.lua @@ -119,23 +119,23 @@ ESX.RegisterServerCallback('esx_ambulancejob:buyJobVehicle', function(source, cb if price == 0 then print(('esx_ambulancejob: %s attempted to exploit the shop! (invalid vehicle model)'):format(xPlayer.identifier)) cb(false) - end - - if xPlayer.getMoney() >= price then - xPlayer.removeMoney(price) - - MySQL.Async.execute('INSERT INTO owned_vehicles (owner, vehicle, plate, type, job, `stored`) VALUES (@owner, @vehicle, @plate, @type, @job, @stored)', { - ['@owner'] = xPlayer.identifier, - ['@vehicle'] = json.encode(vehicleProps), - ['@plate'] = vehicleProps.plate, - ['@type'] = type, - ['@job'] = xPlayer.job.name, - ['@stored'] = true - }, function (rowsChanged) - cb(true) - end) else - cb(false) + if xPlayer.getMoney() >= price then + xPlayer.removeMoney(price) + + MySQL.Async.execute('INSERT INTO owned_vehicles (owner, vehicle, plate, type, job, `stored`) VALUES (@owner, @vehicle, @plate, @type, @job, @stored)', { + ['@owner'] = xPlayer.identifier, + ['@vehicle'] = json.encode(vehicleProps), + ['@plate'] = vehicleProps.plate, + ['@type'] = type, + ['@job'] = xPlayer.job.name, + ['@stored'] = true + }, function (rowsChanged) + cb(true) + end) + else + cb(false) + end end end) From 19d6e032af1137e91197ae2577619a90bbe4ed20 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Mon, 20 May 2019 23:04:48 +0200 Subject: [PATCH 131/177] Proper hud natives --- client/job.lua | 3 +-- client/main.lua | 4 +--- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/client/job.lua b/client/job.lua index 85be6428..94e5a782 100644 --- a/client/job.lua +++ b/client/job.lua @@ -846,10 +846,9 @@ end function drawLoadingText(text, red, green, blue, alpha) SetTextFont(4) - SetTextProportional(0) SetTextScale(0.0, 0.5) SetTextColour(red, green, blue, alpha) - SetTextDropShadow(0, 0, 0, 0, 255) + SetTextDropshadow(0, 0, 0, 0, 255) SetTextEdge(1, 0, 0, 0, 255) SetTextDropShadow() SetTextOutline() diff --git a/client/main.lua b/client/main.lua index adefb232..3a8f2c36 100644 --- a/client/main.lua +++ b/client/main.lua @@ -152,10 +152,9 @@ function StartDistressSignal() timer = timer - 30 SetTextFont(4) - SetTextProportional(1) SetTextScale(0.45, 0.45) SetTextColour(185, 185, 185, 255) - SetTextDropShadow(0, 0, 0, 0, 255) + SetTextDropshadow(0, 0, 0, 0, 255) SetTextEdge(1, 0, 0, 0, 255) SetTextDropShadow() SetTextOutline() @@ -193,7 +192,6 @@ end function DrawGenericTextThisFrame() SetTextFont(4) - SetTextProportional(0) SetTextScale(0.0, 0.5) SetTextColour(255, 255, 255, 255) SetTextDropshadow(0, 0, 0, 0, 255) From 7ca8779b90c5afb31bfcb5c565e5f61e6660019b Mon Sep 17 00:00:00 2001 From: Poggu Date: Sun, 20 Oct 2019 11:00:06 +0200 Subject: [PATCH 132/177] Added weight support and amount sliders to pharmacy menu --- client/job.lua | 12 ++++++------ esx_ambulancejob.sql | 6 +++--- localization/cs_esx_ambulancejob.sql | 6 +++--- localization/de_esx_ambulancejob.sql | 6 +++--- localization/en_esx_ambulancejob.sql | 6 +++--- localization/fi_esx_ambulancejob.sql | 6 +++--- localization/pl_esx_ambulancejob.sql | 6 +++--- server/main.lua | 27 ++++++++++----------------- 8 files changed, 34 insertions(+), 41 deletions(-) diff --git a/client/job.lua b/client/job.lua index 94e5a782..d93a96aa 100644 --- a/client/job.lua +++ b/client/job.lua @@ -78,7 +78,7 @@ function OpenMobileAmbulanceActionsMenu() for i=1, 15, 1 do Citizen.Wait(900) - + ESX.Streaming.RequestAnimDict(lib, function() TaskPlayAnim(PlayerPedId(), lib, anim, 8.0, -8.0, -1, 0, 0, false, false, false) end) @@ -755,11 +755,11 @@ function OpenShopMenu(elements, restoreCoords, shopCoords) isInShopMenu = false ESX.UI.Menu.CloseAll() - + DeleteSpawnedVehicles() FreezeEntityPosition(playerPed, false) SetEntityVisible(playerPed, true) - + ESX.Game.Teleport(playerPed, restoreCoords) else ESX.ShowNotification(_U('vehicleshop_money')) @@ -866,11 +866,11 @@ function OpenPharmacyMenu() title = _U('pharmacy_menu_title'), align = 'top-left', elements = { - {label = _U('pharmacy_take', _U('medikit')), value = 'medikit'}, - {label = _U('pharmacy_take', _U('bandage')), value = 'bandage'} + {label = _U('pharmacy_take', _U('medikit')), item = 'medikit', type = 'slider', value = 1, min = 1, max = 100}, + {label = _U('pharmacy_take', _U('bandage')), item = 'bandage', type = 'slider', value = 1, min = 1, max = 100} } }, function(data, menu) - TriggerServerEvent('esx_ambulancejob:giveItem', data.current.value) + TriggerServerEvent('esx_ambulancejob:giveItem', data.current.item, data.current.value) end, function(data, menu) menu.close() end) diff --git a/esx_ambulancejob.sql b/esx_ambulancejob.sql index d88d5676..c7a4097e 100644 --- a/esx_ambulancejob.sql +++ b/esx_ambulancejob.sql @@ -23,9 +23,9 @@ INSERT INTO `jobs` (name, label) VALUES ('ambulance','Ambulance') ; -INSERT INTO `items` (name, label, `limit`) VALUES - ('bandage','Bandage', 20), - ('medikit','Medikit', 5) +INSERT INTO `items` (name, label, weight) VALUES + ('bandage','Bandage', 2), + ('medikit','Medikit', 2) ; ALTER TABLE `users` diff --git a/localization/cs_esx_ambulancejob.sql b/localization/cs_esx_ambulancejob.sql index a8af1939..b5264a06 100644 --- a/localization/cs_esx_ambulancejob.sql +++ b/localization/cs_esx_ambulancejob.sql @@ -23,9 +23,9 @@ INSERT INTO `jobs` (name, label) VALUES ('ambulance','Záchranka') ; -INSERT INTO `items` (name, label, `limit`) VALUES - ('bandage','Obvaz', 20), - ('medikit','Lékarnička', 5) +INSERT INTO `items` (name, label, weight) VALUES + ('bandage','Obvaz', 2), + ('medikit','Lékarnička', 2) ; ALTER TABLE `users` diff --git a/localization/de_esx_ambulancejob.sql b/localization/de_esx_ambulancejob.sql index 0ebf079d..bd1ff039 100644 --- a/localization/de_esx_ambulancejob.sql +++ b/localization/de_esx_ambulancejob.sql @@ -23,9 +23,9 @@ INSERT INTO `jobs` (name, label) VALUES ('ambulance','Notdienst') ; -INSERT INTO `items` (name, label, `limit`) VALUES - ('bandage','Bandage', 20), - ('medikit','Medikit', 5) +INSERT INTO `items` (name, label, weight) VALUES + ('bandage','Bandage', 2), + ('medikit','Medikit', 2) ; ALTER TABLE `users` diff --git a/localization/en_esx_ambulancejob.sql b/localization/en_esx_ambulancejob.sql index 6bb4ecf1..6ba8b1a6 100644 --- a/localization/en_esx_ambulancejob.sql +++ b/localization/en_esx_ambulancejob.sql @@ -23,9 +23,9 @@ INSERT INTO `jobs` (name, label) VALUES ('ambulance','EMS') ; -INSERT INTO `items` (name, label, `limit`) VALUES - ('bandage','Bandage', 20), - ('medikit','Medikit', 5) +INSERT INTO `items` (name, label, weight) VALUES + ('bandage','Bandage', 2), + ('medikit','Medikit', 2) ; ALTER TABLE `users` diff --git a/localization/fi_esx_ambulancejob.sql b/localization/fi_esx_ambulancejob.sql index 7c001e0d..1508ad3d 100644 --- a/localization/fi_esx_ambulancejob.sql +++ b/localization/fi_esx_ambulancejob.sql @@ -23,9 +23,9 @@ INSERT INTO `jobs` (name, label) VALUES ('ambulance','Ensihoito') ; -INSERT INTO `items` (name, label, `limit`) VALUES - ('bandage','Sideharso', 20), - ('medikit','Ensiapupakkaus', 5) +INSERT INTO `items` (name, label, weight) VALUES + ('bandage','Sideharso', 2), + ('medikit','Ensiapupakkaus', 2) ; ALTER TABLE `users` diff --git a/localization/pl_esx_ambulancejob.sql b/localization/pl_esx_ambulancejob.sql index c3715181..2f52bad6 100644 --- a/localization/pl_esx_ambulancejob.sql +++ b/localization/pl_esx_ambulancejob.sql @@ -23,9 +23,9 @@ INSERT INTO `jobs` (name, label) VALUES ('ambulance','Pogotowie ratunkowe') ; -INSERT INTO `items` (name, label, `limit`) VALUES - ('bandage','Bandaż', 20), - ('medikit','Defibrylator', 5) +INSERT INTO `items` (name, label, weight) VALUES + ('bandage','Bandaż', 2), + ('medikit','Defibrylator', 2) ; ALTER TABLE `users` diff --git a/server/main.lua b/server/main.lua index 0f5b78d9..2003be0d 100644 --- a/server/main.lua +++ b/server/main.lua @@ -99,7 +99,7 @@ if Config.EarlyRespawnFine then local xPlayer = ESX.GetPlayerFromId(source) local fineAmount = Config.EarlyRespawnFineAmount - TriggerClientEvent('esx:showNotification', xPlayer.source, _U('respawn_bleedout_fine_msg', ESX.Math.GroupDigits(fineAmount))) + xPlayer.showNotification(_U('respawn_bleedout_fine_msg', ESX.Math.GroupDigits(fineAmount))) xPlayer.removeAccountMoney('bank', fineAmount) end) end @@ -122,7 +122,7 @@ ESX.RegisterServerCallback('esx_ambulancejob:buyJobVehicle', function(source, cb else if xPlayer.getMoney() >= price then xPlayer.removeMoney(price) - + MySQL.Async.execute('INSERT INTO owned_vehicles (owner, vehicle, plate, type, job, `stored`) VALUES (@owner, @vehicle, @plate, @type, @job, @stored)', { ['@owner'] = xPlayer.identifier, ['@vehicle'] = json.encode(vehicleProps), @@ -205,14 +205,14 @@ AddEventHandler('esx_ambulancejob:removeItem', function(item) xPlayer.removeInventoryItem(item, 1) if item == 'bandage' then - TriggerClientEvent('esx:showNotification', _source, _U('used_bandage')) + xPlayer.showNotification(_U('used_bandage')) elseif item == 'medikit' then - TriggerClientEvent('esx:showNotification', _source, _U('used_medikit')) + xPlayer.showNotification(_U('used_medikit')) end end) RegisterServerEvent('esx_ambulancejob:giveItem') -AddEventHandler('esx_ambulancejob:giveItem', function(itemName) +AddEventHandler('esx_ambulancejob:giveItem', function(itemName, amount) local xPlayer = ESX.GetPlayerFromId(source) if xPlayer.job.name ~= 'ambulance' then @@ -223,17 +223,10 @@ AddEventHandler('esx_ambulancejob:giveItem', function(itemName) return end - local xItem = xPlayer.getInventoryItem(itemName) - local count = 1 - - if xItem.limit ~= -1 then - count = xItem.limit - xItem.count - end - - if xItem.count < xItem.limit then - xPlayer.addInventoryItem(itemName, count) + if xPlayer.canCarryItem(itemName, amount) then + xPlayer.addInventoryItem(itemName, amount) else - TriggerClientEvent('esx:showNotification', source, _U('max_item')) + xPlayer.showNotification(_U('max_item')) end end) @@ -254,7 +247,7 @@ ESX.RegisterUsableItem('medikit', function(source) if not playersHealing[source] then local xPlayer = ESX.GetPlayerFromId(source) xPlayer.removeInventoryItem('medikit', 1) - + playersHealing[source] = true TriggerClientEvent('esx_ambulancejob:useItem', source, 'medikit') @@ -267,7 +260,7 @@ ESX.RegisterUsableItem('bandage', function(source) if not playersHealing[source] then local xPlayer = ESX.GetPlayerFromId(source) xPlayer.removeInventoryItem('bandage', 1) - + playersHealing[source] = true TriggerClientEvent('esx_ambulancejob:useItem', source, 'bandage') From 88b284f925682b93b5e53078e8dae249468dcfb8 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Sun, 27 Oct 2019 00:12:36 +0200 Subject: [PATCH 133/177] Minor changes --- client/job.lua | 27 +++++++++++++-------------- client/main.lua | 38 +++++++++++++++++++------------------- locales/br.lua | 4 +++- locales/cs.lua | 4 +++- locales/en.lua | 4 +++- locales/es.lua | 4 +++- locales/fi.lua | 4 +++- locales/fr.lua | 6 ++++-- locales/pl.lua | 4 +++- locales/sv.lua | 4 +++- 10 files changed, 57 insertions(+), 42 deletions(-) diff --git a/client/job.lua b/client/job.lua index 94e5a782..961eba05 100644 --- a/client/job.lua +++ b/client/job.lua @@ -1,6 +1,6 @@ local CurrentAction, CurrentActionMsg, CurrentActionData = nil, '', {} local HasAlreadyEnteredMarker, LastHospital, LastPart, LastPartNum -local IsBusy = false +local isBusy = false local spawnedVehicles, isInShopMenu = {}, false function OpenAmbulanceActionsMenu() @@ -53,7 +53,7 @@ function OpenMobileAmbulanceActionsMenu() {label = _U('ems_menu_putincar'), value = 'put_in_vehicle'} } }, function(data, menu) - if IsBusy then return end + if isBusy then return end local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() @@ -63,7 +63,7 @@ function OpenMobileAmbulanceActionsMenu() if data.current.value == 'revive' then - IsBusy = true + isBusy = true ESX.TriggerServerCallback('esx_ambulancejob:getItemAmount', function(quantity) if quantity > 0 then @@ -100,7 +100,7 @@ function OpenMobileAmbulanceActionsMenu() ESX.ShowNotification(_U('not_enough_medikit')) end - IsBusy = false + isBusy = false end, 'medikit') @@ -114,7 +114,7 @@ function OpenMobileAmbulanceActionsMenu() if health > 0 then local playerPed = PlayerPedId() - IsBusy = true + isBusy = true ESX.ShowNotification(_U('heal_inprogress')) TaskStartScenarioInPlace(playerPed, 'CODE_HUMAN_MEDIC_TEND_TO_DEAD', 0, true) Citizen.Wait(10000) @@ -123,7 +123,7 @@ function OpenMobileAmbulanceActionsMenu() TriggerServerEvent('esx_ambulancejob:removeItem', 'bandage') TriggerServerEvent('esx_ambulancejob:heal', GetPlayerServerId(closestPlayer), 'small') ESX.ShowNotification(_U('heal_complete', GetPlayerName(closestPlayer))) - IsBusy = false + isBusy = false else ESX.ShowNotification(_U('player_not_conscious')) end @@ -142,7 +142,7 @@ function OpenMobileAmbulanceActionsMenu() if health > 0 then local playerPed = PlayerPedId() - IsBusy = true + isBusy = true ESX.ShowNotification(_U('heal_inprogress')) TaskStartScenarioInPlace(playerPed, 'CODE_HUMAN_MEDIC_TEND_TO_DEAD', 0, true) Citizen.Wait(10000) @@ -151,7 +151,7 @@ function OpenMobileAmbulanceActionsMenu() TriggerServerEvent('esx_ambulancejob:removeItem', 'medikit') TriggerServerEvent('esx_ambulancejob:heal', GetPlayerServerId(closestPlayer), 'big') ESX.ShowNotification(_U('heal_complete', GetPlayerName(closestPlayer))) - IsBusy = false + isBusy = false else ESX.ShowNotification(_U('player_not_conscious')) end @@ -379,7 +379,7 @@ Citizen.CreateThread(function() end - elseif ESX.PlayerData.job ~= nil and ESX.PlayerData.job.name == 'ambulance' and not IsDead then + elseif ESX.PlayerData.job ~= nil and ESX.PlayerData.job.name == 'ambulance' and not isDead then if IsControlJustReleased(0, Keys['F6']) then OpenMobileAmbulanceActionsMenu() end @@ -566,10 +566,10 @@ function StoreNearbyVehicle(playerCoords) local vehicleId = vehiclePlates[foundNum] local attempts = 0 ESX.Game.DeleteVehicle(vehicleId.vehicle) - IsBusy = true + isBusy = true Citizen.CreateThread(function() - while IsBusy do + while isBusy do Citizen.Wait(0) drawLoadingText(_U('garage_storing'), 255, 255, 255, 255) end @@ -596,7 +596,7 @@ function StoreNearbyVehicle(playerCoords) end end - IsBusy = false + isBusy = false ESX.ShowNotification(_U('garage_has_stored')) else ESX.ShowNotification(_U('garage_has_notstored')) @@ -774,7 +774,7 @@ function OpenShopMenu(elements, restoreCoords, shopCoords) menu2.close() end) - end, function(data, menu) + end, function(data, menu) isInShopMenu = false ESX.UI.Menu.CloseAll() @@ -849,7 +849,6 @@ function drawLoadingText(text, red, green, blue, alpha) SetTextScale(0.0, 0.5) SetTextColour(red, green, blue, alpha) SetTextDropshadow(0, 0, 0, 0, 255) - SetTextEdge(1, 0, 0, 0, 255) SetTextDropShadow() SetTextOutline() SetTextCentre(true) diff --git a/client/main.lua b/client/main.lua index 3a8f2c36..deb877e3 100644 --- a/client/main.lua +++ b/client/main.lua @@ -10,9 +10,9 @@ Keys = { ["NENTER"] = 201, ["N4"] = 108, ["N5"] = 60, ["N6"] = 107, ["N+"] = 96, ["N-"] = 97, ["N7"] = 117, ["N8"] = 61, ["N9"] = 118 } -local FirstSpawn, PlayerLoaded = true, false +local firstSpawn, PlayerLoaded = true, false -IsDead = false +isDead = false ESX = nil Citizen.CreateThread(function() @@ -41,14 +41,14 @@ AddEventHandler('esx:setJob', function(job) end) AddEventHandler('playerSpawned', function() - IsDead = false + isDead = false - if FirstSpawn then + if firstSpawn then exports.spawnmanager:setAutoSpawn(false) -- disable respawn - FirstSpawn = false + firstSpawn = false - ESX.TriggerServerCallback('esx_ambulancejob:getDeathStatus', function(isDead) - if isDead and Config.AntiCombatLog then + ESX.TriggerServerCallback('esx_ambulancejob:getDeathStatus', function(shouldDie) + if shouldDie and Config.AntiCombatLog then while not PlayerLoaded do Citizen.Wait(1000) end @@ -57,6 +57,8 @@ AddEventHandler('playerSpawned', function() RemoveItemsAfterRPDeath() end end) + else + TriggerServerEvent('esx_ambulancejob:onPlayerSpawn') end end) @@ -71,7 +73,7 @@ Citizen.CreateThread(function() SetBlipAsShortRange(blip, true) BeginTextCommandSetBlipName('STRING') - AddTextComponentSubstringPlayerName(_U('hospital')) + AddTextComponentSubstringPlayerName(_U('blip_hospital')) EndTextCommandSetBlipName(blip) end end) @@ -81,7 +83,7 @@ Citizen.CreateThread(function() while true do Citizen.Wait(0) - if IsDead then + if isDead then DisableAllControlActions(0) EnableControlAction(0, Keys['G'], true) EnableControlAction(0, Keys['T'], true) @@ -93,7 +95,7 @@ Citizen.CreateThread(function() end) function OnPlayerDeath() - IsDead = true + isDead = true ESX.UI.Menu.CloseAll() TriggerServerEvent('esx_ambulancejob:setDeathStatus', true) @@ -147,7 +149,7 @@ function StartDistressSignal() Citizen.CreateThread(function() local timer = Config.BleedoutTimer - while timer > 0 and IsDead do + while timer > 0 and isDead do Citizen.Wait(2) timer = timer - 30 @@ -155,7 +157,6 @@ function StartDistressSignal() SetTextScale(0.45, 0.45) SetTextColour(185, 185, 185, 255) SetTextDropshadow(0, 0, 0, 0, 255) - SetTextEdge(1, 0, 0, 0, 255) SetTextDropShadow() SetTextOutline() BeginTextCommandDisplayText('STRING') @@ -167,7 +168,7 @@ function StartDistressSignal() Citizen.CreateThread(function() Citizen.Wait(1000 * 60 * 5) - if IsDead then + if isDead then StartDistressSignal() end end) @@ -195,7 +196,6 @@ function DrawGenericTextThisFrame() SetTextScale(0.0, 0.5) SetTextColour(255, 255, 255, 255) SetTextDropshadow(0, 0, 0, 0, 255) - SetTextEdge(1, 0, 0, 0, 255) SetTextDropShadow() SetTextOutline() SetTextCentre(true) @@ -229,7 +229,7 @@ function StartDeathTimer() Citizen.CreateThread(function() -- early respawn timer - while earlySpawnTimer > 0 and IsDead do + while earlySpawnTimer > 0 and isDead do Citizen.Wait(1000) if earlySpawnTimer > 0 then @@ -238,7 +238,7 @@ function StartDeathTimer() end -- bleedout timer - while bleedoutTimer > 0 and IsDead do + while bleedoutTimer > 0 and isDead do Citizen.Wait(1000) if bleedoutTimer > 0 then @@ -251,7 +251,7 @@ function StartDeathTimer() local text, timeHeld -- early respawn timer - while earlySpawnTimer > 0 and IsDead do + while earlySpawnTimer > 0 and isDead do Citizen.Wait(0) text = _U('respawn_available_in', secondsToClock(earlySpawnTimer)) @@ -263,7 +263,7 @@ function StartDeathTimer() end -- bleedout timer - while bleedoutTimer > 0 and IsDead do + while bleedoutTimer > 0 and isDead do Citizen.Wait(0) text = _U('respawn_bleedout_in', secondsToClock(bleedoutTimer)) @@ -297,7 +297,7 @@ function StartDeathTimer() DrawText(0.5, 0.8) end - if bleedoutTimer < 1 and IsDead then + if bleedoutTimer < 1 and isDead then RemoveItemsAfterRPDeath() end end) diff --git a/locales/br.lua b/locales/br.lua index be0dbc50..1cd0b382 100644 --- a/locales/br.lua +++ b/locales/br.lua @@ -36,7 +36,6 @@ Locales['br'] = { ['confirm_no'] = 'no', ['confirm_yes'] = 'yes', -- Action Menu - ['hospital'] = 'Hôspital', ['revive_inprogress'] = 'Reanimação em andamento', ['revive_complete'] = 'você ressuscitou ~y~%s~s~', ['revive_complete_award'] = 'você ressuscitou ~y~%s~s~, ~g~$%s~s~', @@ -87,4 +86,7 @@ Locales['br'] = { ['not_enough_medikit'] = 'Você não tem ~b~Seringa~s~.', ['not_enough_bandage'] = 'Você não tem ~b~Vendagem~s~.', ['healed'] = 'Você foi tratado.', + -- Blips + ['blip_hospital'] = 'Hôspital', + ['blip_dead'] = 'unconscious player', } diff --git a/locales/cs.lua b/locales/cs.lua index 48dc7cc2..aa2f664f 100644 --- a/locales/cs.lua +++ b/locales/cs.lua @@ -36,7 +36,6 @@ Locales['cs'] = { ['confirm_no'] = 'no', ['confirm_yes'] = 'yes', -- Action Menu - ['hospital'] = 'nemocnice', ['revive_inprogress'] = 'probíhá oživení!', ['revive_complete'] = 'oživili jste ~y~%s~s~', ['revive_complete_award'] = 'oživili jste ~y~%s~s~ a dostali jste ~g~$%s~s~!', @@ -87,4 +86,7 @@ Locales['cs'] = { ['not_enough_medikit'] = 'nemáte ~b~medikit~s~.', ['not_enough_bandage'] = 'nemáte~b~bandage~s~.', ['healed'] = 'byli jste ošetřeni.', + -- Blips + ['blip_hospital'] = 'nemocnice', + ['blip_dead'] = 'unconscious player', } diff --git a/locales/en.lua b/locales/en.lua index b13f48fe..36848986 100644 --- a/locales/en.lua +++ b/locales/en.lua @@ -36,7 +36,6 @@ Locales['en'] = { ['confirm_no'] = 'no', ['confirm_yes'] = 'yes', -- Action Menu - ['hospital'] = 'hospital', ['revive_inprogress'] = 'a revive is in progress!', ['revive_complete'] = 'you have revived ~y~%s~s~', ['revive_complete_award'] = 'you have revived ~y~%s~s~ and earned ~g~$%s~s~!', @@ -87,4 +86,7 @@ Locales['en'] = { ['not_enough_medikit'] = 'You do not have ~b~medikit~s~.', ['not_enough_bandage'] = 'You do not have ~b~bandage~s~.', ['healed'] = 'you have been treated.', + -- Blips + ['blip_hospital'] = 'hospital', + ['blip_dead'] = 'unconscious player', } diff --git a/locales/es.lua b/locales/es.lua index 5b1e4ecb..a197d2ac 100644 --- a/locales/es.lua +++ b/locales/es.lua @@ -36,7 +36,6 @@ Locales['es'] = { ['confirm_no'] = 'no', ['confirm_yes'] = 'yes', -- Action Menu - ['hospital'] = 'hospital', ['revive_inprogress'] = 'reanimación en curso', ['revive_complete'] = 'has sido reanimado ~y~%s~s~', ['revive_complete_award'] = 'has sido reanimado ~y~%s~s~, ~g~$%s~s~', @@ -87,4 +86,7 @@ Locales['es'] = { ['not_enough_medikit'] = 'You do not have ~b~medikit~s~.', ['not_enough_bandage'] = 'You do not have ~b~bandage~s~.', ['healed'] = 'you have been treated.', + -- Blips + ['blip_hospital'] = 'hospital', + ['blip_dead'] = 'unconscious player', } diff --git a/locales/fi.lua b/locales/fi.lua index ac99fc65..2068b318 100644 --- a/locales/fi.lua +++ b/locales/fi.lua @@ -36,7 +36,6 @@ Locales['fi'] = { ['confirm_no'] = 'no', ['confirm_yes'] = 'yes', -- Action Menu - ['hospital'] = 'sairaala', ['revive_inprogress'] = 'elvytys on menossa!', ['revive_complete'] = 'sinä elvytit henkilön ~y~%s~s~', ['revive_complete_award'] = 'sinä elvytit henkilön ~y~%s~s~ ja tienasit ~g~$%s~s~!', @@ -87,4 +86,7 @@ Locales['fi'] = { ['not_enough_medikit'] = 'ei tarpeeksi ~b~ensiapupakkauksia~s~.', ['not_enough_bandage'] = 'ei tarpeeksi ~b~sideharsoja~s~.', ['healed'] = 'sinua parannettiin', + -- Blips + ['blip_hospital'] = 'sairaala', + ['blip_dead'] = 'unconscious player', } diff --git a/locales/fr.lua b/locales/fr.lua index b56c17f7..94f62665 100644 --- a/locales/fr.lua +++ b/locales/fr.lua @@ -36,7 +36,6 @@ Locales['fr'] = { ['confirm_no'] = 'non', ['confirm_yes'] = 'oui', -- Action Menu - ['hospital'] = 'hôpital', ['revive_inprogress'] = 'réanimation en cours', ['revive_complete'] = 'vous avez réanimé ~y~%s~s~', ['revive_complete_award'] = 'vous avez réanimé ~y~%s~s~, ~g~$%s~s~', @@ -49,7 +48,7 @@ Locales['fr'] = { -- Boss Menu ['boss_actions'] = 'action Patron', -- Misc - ['invalid_amount'] = '~r~montant invalide', + ['invalid_amount'] = '~r~montant invalide~s~', ['actions_prompt'] = 'press ~INPUT_CONTEXT~ access the ~y~Ambulance Actions~s~.', ['deposit_amount'] = 'montant du dépôt', ['money_withdraw'] = 'montant du retrait', @@ -87,4 +86,7 @@ Locales['fr'] = { ['not_enough_medikit'] = 'vous n\'avez pas de ~b~kit de soin~s~.', ['not_enough_bandage'] = 'vous n\'avez pas de ~b~bandage~s~.', ['healed'] = 'vous avez été soigné.', + -- Blips + ['blip_hospital'] = 'hôpital', + ['blip_dead'] = 'unconscious player', } diff --git a/locales/pl.lua b/locales/pl.lua index 61778ccc..ebf75ce1 100644 --- a/locales/pl.lua +++ b/locales/pl.lua @@ -36,7 +36,6 @@ Locales['pl'] = { ['confirm_no'] = 'no', ['confirm_yes'] = 'yes', -- Action Menu - ['hospital'] = 'szpital', ['revive_inprogress'] = 'trwa wskrzeszenie', ['revive_complete'] = 'zostałeś wskrzeszony ~y~%s~s~', ['revive_complete_award'] = 'zostałeś wskrzeszony ~y~%s~s~ i zarobiono ~g~$%s~s~!', @@ -87,4 +86,7 @@ Locales['pl'] = { ['not_enough_medikit'] = 'nie posiadasz ~b~apteczki~s~.', ['not_enough_bandage'] = 'nie posiadasz ~b~bandaża~s~.', ['healed'] = 'zostałeś potraktowany', + -- Blips + ['blip_hospital'] = 'szpital', + ['blip_dead'] = 'unconscious player', } diff --git a/locales/sv.lua b/locales/sv.lua index 0693cfd1..501e602c 100644 --- a/locales/sv.lua +++ b/locales/sv.lua @@ -36,7 +36,6 @@ Locales['sv'] = { ['confirm_no'] = 'no', ['confirm_yes'] = 'yes', -- Action Menu - ['hospital'] = 'sjukhus', ['revive_inprogress'] = 'en återupplivning har börjats', ['revive_complete'] = 'du har återupplivat ~y~%s~s~, bra jobbat!', ['revive_complete_award'] = 'du har återupplivat ~y~%s~s~ och tjärnat ~g~%s SEK~s~ för dina tjänster, bra jobbat!', @@ -87,4 +86,7 @@ Locales['sv'] = { ['not_enough_medikit'] = 'du har inget ~b~Medecinkit~s~.', ['not_enough_bandage'] = 'du har inget ~b~Bandage~s~.', ['healed'] = 'dina skador har blivit behandlade.', + -- Blips + ['blip_hospital'] = 'sjukhus', + ['blip_dead'] = 'medvetslös människa', } From dcc113ae062fb0b7496ef30d73a07266b5b171c5 Mon Sep 17 00:00:00 2001 From: rex2630 Date: Sat, 4 Jan 2020 11:17:55 +0100 Subject: [PATCH 134/177] Removed keys table (#172) * Removed keys table * Changed key values to numbers --- client/job.lua | 14 +++++++------- client/main.lua | 26 +++++++------------------- 2 files changed, 14 insertions(+), 26 deletions(-) diff --git a/client/job.lua b/client/job.lua index a13ec181..1021b88c 100644 --- a/client/job.lua +++ b/client/job.lua @@ -361,7 +361,7 @@ Citizen.CreateThread(function() if CurrentAction then ESX.ShowHelpNotification(CurrentActionMsg) - if IsControlJustReleased(0, Keys['E']) then + if IsControlJustReleased(0, 38) then if CurrentAction == 'AmbulanceActions' then OpenAmbulanceActionsMenu() @@ -380,7 +380,7 @@ Citizen.CreateThread(function() end elseif ESX.PlayerData.job ~= nil and ESX.PlayerData.job.name == 'ambulance' and not isDead then - if IsControlJustReleased(0, Keys['F6']) then + if IsControlJustReleased(0, 167) then OpenMobileAmbulanceActionsMenu() end else @@ -832,12 +832,12 @@ function WaitForVehicleToLoad(modelHash) while not HasModelLoaded(modelHash) do Citizen.Wait(0) - DisableControlAction(0, Keys['TOP'], true) - DisableControlAction(0, Keys['DOWN'], true) - DisableControlAction(0, Keys['LEFT'], true) - DisableControlAction(0, Keys['RIGHT'], true) + DisableControlAction(0, 27, true) + DisableControlAction(0, 173, true) + DisableControlAction(0, 174, true) + DisableControlAction(0, 175, true) DisableControlAction(0, 176, true) -- ENTER key - DisableControlAction(0, Keys['BACKSPACE'], true) + DisableControlAction(0, 177, true) drawLoadingText(_U('vehicleshop_awaiting_model'), 255, 255, 255, 255) end diff --git a/client/main.lua b/client/main.lua index deb877e3..f0375890 100644 --- a/client/main.lua +++ b/client/main.lua @@ -1,15 +1,3 @@ -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 -} - local firstSpawn, PlayerLoaded = true, false isDead = false @@ -85,9 +73,9 @@ Citizen.CreateThread(function() if isDead then DisableAllControlActions(0) - EnableControlAction(0, Keys['G'], true) - EnableControlAction(0, Keys['T'], true) - EnableControlAction(0, Keys['E'], true) + EnableControlAction(0, 47, true) + EnableControlAction(0, 245, true) + EnableControlAction(0, 38, true) else Citizen.Wait(500) end @@ -163,7 +151,7 @@ function StartDistressSignal() AddTextComponentSubstringPlayerName(_U('distress_send')) EndTextCommandDisplayText(0.175, 0.805) - if IsControlPressed(0, Keys['G']) then + if IsControlPressed(0, 47) then SendDistressSignal() Citizen.CreateThread(function() @@ -270,21 +258,21 @@ function StartDeathTimer() if not Config.EarlyRespawnFine then text = text .. _U('respawn_bleedout_prompt') - if IsControlPressed(0, Keys['E']) and timeHeld > 60 then + if IsControlPressed(0, 38) and timeHeld > 60 then RemoveItemsAfterRPDeath() break end elseif Config.EarlyRespawnFine and canPayFine then text = text .. _U('respawn_bleedout_fine', ESX.Math.GroupDigits(Config.EarlyRespawnFineAmount)) - if IsControlPressed(0, Keys['E']) and timeHeld > 60 then + if IsControlPressed(0, 38) and timeHeld > 60 then TriggerServerEvent('esx_ambulancejob:payFine') RemoveItemsAfterRPDeath() break end end - if IsControlPressed(0, Keys['E']) then + if IsControlPressed(0, 38) then timeHeld = timeHeld + 1 else timeHeld = 0 From 9247654252e0c7eac736763eb5d65e0859435818 Mon Sep 17 00:00:00 2001 From: Viktor <35453587+LifeGoal@users.noreply.github.com> Date: Sat, 4 Jan 2020 11:18:15 +0100 Subject: [PATCH 135/177] sv.lua completion (#151) * sv.lua completion * Update sv.lua --- locales/sv.lua | 60 +++++++++++++++++++++++++------------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/locales/sv.lua b/locales/sv.lua index 501e602c..64abd2cf 100644 --- a/locales/sv.lua +++ b/locales/sv.lua @@ -4,37 +4,37 @@ Locales['sv'] = { ['ems_clothes_civil'] = 'civilkläder', ['ems_clothes_ems'] = 'ambulanskläder', -- Vehicles - ['ambulance'] = 'ambulance', - ['helicopter_prompt'] = 'press ~INPUT_CONTEXT~ to access the ~y~Helicopter Actions~s~.', - ['helicopter_buy'] = 'helicopter shop', - ['helicopter_garage'] = 'open garage', - ['helicopter_store'] = 'store helicopter in garage', - ['helicopter_garage_title'] = 'helicopter Garage', - ['helicopter_title'] = 'helicopter Actions', - ['helicopter_notauthorized'] = 'you\'re not authorized to buy helicopters.', - ['garage_prompt'] = 'press ~INPUT_CONTEXT~ to access the ~y~Vehicle Actions~s~.', - ['garage_title'] = 'vehicle Actions', - ['garage_stored'] = 'stored', - ['garage_notstored'] = 'not in garage', - ['garage_storing'] = 'we\'re attempting to remove the vehicle, make sure no players are around it.', - ['garage_has_stored'] = 'the vehicle has been stored in your garage', - ['garage_has_notstored'] = 'no nearby owned vehicles were found', - ['garage_notavailable'] = 'your vehicle is not stored in the garage.', - ['garage_blocked'] = 'there\'s no available spawn points!', - ['garage_empty'] = 'you dont have any vehicles in your garage.', - ['garage_released'] = 'your vehicle has been released from the garage.', - ['garage_store_nearby'] = 'there is no nearby vehicles.', - ['garage_storeditem'] = 'open garage', - ['garage_storeitem'] = 'store vehicle in garage', - ['garage_buyitem'] = 'vehicle shop', + ['ambulance'] = 'ambulans', + ['helicopter_prompt'] = 'klicka på ~INPUT_CONTEXT~ för att komma åt ~y~garaget~s~.', + ['helicopter_buy'] = 'fordonshandel', + ['helicopter_garage'] = 'öppna garage', + ['helicopter_store'] = 'ställ in helikopter', + ['helicopter_garage_title'] = 'garage', + ['helicopter_title'] = 'garage', + ['helicopter_notauthorized'] = 'du har inte behörighet till att köpa en helikopter.', + ['garage_prompt'] = 'tryck ~INPUT_CONTEXT~ för att komma åt ~y~garaget~s~.', + ['garage_title'] = 'garage', + ['garage_stored'] = 'inställt', + ['garage_notstored'] = 'uttaget', + ['garage_storing'] = 'vi håller på att ställa in ditt fordon, se till att ingen är i närheten.', + ['garage_has_stored'] = 'fordonet har ställts in i garaget', + ['garage_has_notstored'] = 'inget ägt fordon finns i närheten', + ['garage_notavailable'] = 'ditt fordon är inte inställt i ditt garage.', + ['garage_blocked'] = 'det finns ingen tillgänglig plats att ställa ut fordonet på!', + ['garage_empty'] = 'du har inga fordon i ditt garage.', + ['garage_released'] = 'ditt fordon har tagits ut från garaget.', + ['garage_store_nearby'] = 'det finns inget fordon i närheten.', + ['garage_storeditem'] = 'öppna garage', + ['garage_storeitem'] = 'ställ in fordon', + ['garage_buyitem'] = 'fordonshandel', ['shop_item'] = '%s SEK', - ['vehicleshop_title'] = 'vehicle Shop', - ['vehicleshop_confirm'] = 'do you want to buy this vehicle?', - ['vehicleshop_bought'] = 'you have bought ~y~%s~s~ for ~r~$%s~s~', - ['vehicleshop_money'] = 'you cannot afford that vehicle', - ['vehicleshop_awaiting_model'] = 'the vehicle is currently ~g~DOWNLOADING & LOADING~s~ please wait', - ['confirm_no'] = 'no', - ['confirm_yes'] = 'yes', + ['vehicleshop_title'] = 'fordonshandel', + ['vehicleshop_confirm'] = 'vill du köpa detta fordon?', + ['vehicleshop_bought'] = 'du köpte ~y~%s~s~ för ~r~$%s~s~', + ['vehicleshop_money'] = 'du har inte råd med detta fordon', + ['vehicleshop_awaiting_model'] = 'fordonet ~g~LADDAS NED OCH LADDAS IN~s~ var god vänta', + ['confirm_no'] = 'nej', + ['confirm_yes'] = 'ja', -- Action Menu ['revive_inprogress'] = 'en återupplivning har börjats', ['revive_complete'] = 'du har återupplivat ~y~%s~s~, bra jobbat!', From 94ba42812a16ebfba7f510599ee1b5b659ece090 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Sat, 4 Jan 2020 11:35:42 +0100 Subject: [PATCH 136/177] Removed useless prints, minor repo updates --- README.md | 7 ++++++- __resource.lua | 1 + server/main.lua | 44 ++++++++++++++++---------------------------- 3 files changed, 23 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index f2c3b451..5476caee 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,10 @@ # esx_ambulancejob +ESX Ambulance Job is an plugin for ESX with features: + +- Adds death screen, with early respawn timer and bleed out timer +- Vehicle garages, revive menu and more for on duty EMS + ## Requirements * Auto mode @@ -39,7 +44,7 @@ start esx_ambulancejob ### License esx_ambulancejob - ambulance script for fivem -Copyright (C) 2015-2018 Jérémie N'gadi +Copyright (C) 2015-2020 Jérémie N'gadi 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. diff --git a/__resource.lua b/__resource.lua index 5c55606b..f5f45d38 100644 --- a/__resource.lua +++ b/__resource.lua @@ -36,5 +36,6 @@ client_scripts { dependencies { 'es_extended', + 'esx_skin', 'esx_vehicleshop' } \ No newline at end of file diff --git a/server/main.lua b/server/main.lua index 2003be0d..1f037c9e 100644 --- a/server/main.lua +++ b/server/main.lua @@ -10,8 +10,6 @@ AddEventHandler('esx_ambulancejob:revive', function(target) if xPlayer.job.name == 'ambulance' then xPlayer.addMoney(Config.ReviveReward) TriggerClientEvent('esx_ambulancejob:revive', target) - else - print(('esx_ambulancejob: %s attempted to revive!'):format(xPlayer.identifier)) end end) @@ -21,8 +19,6 @@ AddEventHandler('esx_ambulancejob:heal', function(target, type) if xPlayer.job.name == 'ambulance' then TriggerClientEvent('esx_ambulancejob:heal', target, type) - else - print(('esx_ambulancejob: %s attempted to heal!'):format(xPlayer.identifier)) end end) @@ -32,8 +28,6 @@ AddEventHandler('esx_ambulancejob:putInVehicle', function(target) if xPlayer.job.name == 'ambulance' then TriggerClientEvent('esx_ambulancejob:putInVehicle', target) - else - print(('esx_ambulancejob: %s attempted to put in vehicle!'):format(xPlayer.identifier)) end end) @@ -117,7 +111,6 @@ ESX.RegisterServerCallback('esx_ambulancejob:buyJobVehicle', function(source, cb -- vehicle model not found if price == 0 then - print(('esx_ambulancejob: %s attempted to exploit the shop! (invalid vehicle model)'):format(xPlayer.identifier)) cb(false) else if xPlayer.getMoney() >= price then @@ -165,14 +158,12 @@ ESX.RegisterServerCallback('esx_ambulancejob:storeNearbyVehicle', function(sourc ['@job'] = xPlayer.job.name }, function (rowsChanged) if rowsChanged == 0 then - print(('esx_ambulancejob: %s has exploited the garage!'):format(xPlayer.identifier)) cb(false) else cb(true, foundNum) end end) end - end) function getPriceFromHash(hashKey, jobGrade, type) @@ -199,9 +190,7 @@ end RegisterServerEvent('esx_ambulancejob:removeItem') AddEventHandler('esx_ambulancejob:removeItem', function(item) - local _source = source - local xPlayer = ESX.GetPlayerFromId(_source) - + local xPlayer = ESX.GetPlayerFromId(source) xPlayer.removeInventoryItem(item, 1) if item == 'bandage' then @@ -216,10 +205,10 @@ AddEventHandler('esx_ambulancejob:giveItem', function(itemName, amount) local xPlayer = ESX.GetPlayerFromId(source) if xPlayer.job.name ~= 'ambulance' then - print(('esx_ambulancejob: %s attempted to spawn in an item!'):format(xPlayer.identifier)) + print(('[esx_ambulancejob] [^2INFO^7] "%s" attempted to spawn in an item!'):format(xPlayer.identifier)) return elseif (itemName ~= 'medikit' and itemName ~= 'bandage') then - print(('esx_ambulancejob: %s attempted to spawn in an item!'):format(xPlayer.identifier)) + print(('[esx_ambulancejob] [^2INFO^7] "%s" attempted to spawn in an item!'):format(xPlayer.identifier)) return end @@ -231,17 +220,19 @@ AddEventHandler('esx_ambulancejob:giveItem', function(itemName, amount) end) TriggerEvent('es:addGroupCommand', 'revive', 'admin', function(source, args, user) - if args[1] ~= nil then - if GetPlayerName(tonumber(args[1])) ~= nil then - print(('esx_ambulancejob: %s used admin revive'):format(GetPlayerIdentifiers(source)[1])) - TriggerClientEvent('esx_ambulancejob:revive', tonumber(args[1])) + if args[1] then + local playerId = tonumber(args[1]) + if playerId and ESX.Players[playerId] then + TriggerClientEvent('esx_ambulancejob:revive', playerId) + else + TriggerClientEvent('chat:addMessage', source, { args = { '^1SYSTEM', 'Player not online.' } }) end else TriggerClientEvent('esx_ambulancejob:revive', source) end end, function(source, args, user) TriggerClientEvent('chat:addMessage', source, { args = { '^1SYSTEM', 'Insufficient Permissions.' } }) -end, { help = _U('revive_help'), params = {{ name = 'id' }} }) +end, { help = _U('revive_help'), params = {{ name = 'playerId' }} }) ESX.RegisterUsableItem('medikit', function(source) if not playersHealing[source] then @@ -276,7 +267,7 @@ ESX.RegisterServerCallback('esx_ambulancejob:getDeathStatus', function(source, c ['@identifier'] = identifier }, function(isDead) if isDead then - print(('esx_ambulancejob: %s attempted combat logging!'):format(identifier)) + print(('[esx_ambulancejob] [^2INFO^7] "%s" attempted combat logging'):format(identifier)) end cb(isDead) @@ -287,13 +278,10 @@ RegisterServerEvent('esx_ambulancejob:setDeathStatus') AddEventHandler('esx_ambulancejob:setDeathStatus', function(isDead) local identifier = GetPlayerIdentifiers(source)[1] - if type(isDead) ~= 'boolean' then - print(('esx_ambulancejob: %s attempted to parse something else than a boolean to setDeathStatus!'):format(identifier)) - return + if type(isDead) == 'boolean' then + MySQL.Sync.execute('UPDATE users SET is_dead = @isDead WHERE identifier = @identifier', { + ['@identifier'] = identifier, + ['@isDead'] = isDead + }) end - - MySQL.Sync.execute('UPDATE users SET is_dead = @isDead WHERE identifier = @identifier', { - ['@identifier'] = identifier, - ['@isDead'] = isDead - }) end) From c7dbd9361fae3262a672b6ffa7b1605842c3efc0 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Sat, 4 Jan 2020 11:45:00 +0100 Subject: [PATCH 137/177] Fixed player revive notification showing Steam name, and check if online --- client/job.lua | 75 ++++++++++++++++++++++--------------------------- locales/br.lua | 1 + locales/cs.lua | 1 + locales/en.lua | 1 + locales/es.lua | 1 + locales/fi.lua | 7 +++-- locales/fr.lua | 7 +++-- locales/pl.lua | 1 + locales/sv.lua | 1 + server/main.lua | 29 +++++++++++-------- 10 files changed, 65 insertions(+), 59 deletions(-) diff --git a/client/job.lua b/client/job.lua index 1021b88c..2434ca4f 100644 --- a/client/job.lua +++ b/client/job.lua @@ -62,48 +62,7 @@ function OpenMobileAmbulanceActionsMenu() else if data.current.value == 'revive' then - - isBusy = true - - ESX.TriggerServerCallback('esx_ambulancejob:getItemAmount', function(quantity) - if quantity > 0 then - local closestPlayerPed = GetPlayerPed(closestPlayer) - - if IsPedDeadOrDying(closestPlayerPed, 1) then - local playerPed = PlayerPedId() - - ESX.ShowNotification(_U('revive_inprogress')) - - local lib, anim = 'mini@cpr@char_a@cpr_str', 'cpr_pumpchest' - - for i=1, 15, 1 do - Citizen.Wait(900) - - ESX.Streaming.RequestAnimDict(lib, function() - TaskPlayAnim(PlayerPedId(), lib, anim, 8.0, -8.0, -1, 0, 0, false, false, false) - end) - end - - TriggerServerEvent('esx_ambulancejob:removeItem', 'medikit') - TriggerServerEvent('esx_ambulancejob:revive', GetPlayerServerId(closestPlayer)) - - -- Show revive award? - if Config.ReviveReward > 0 then - ESX.ShowNotification(_U('revive_complete_award', GetPlayerName(closestPlayer), Config.ReviveReward)) - else - ESX.ShowNotification(_U('revive_complete', GetPlayerName(closestPlayer))) - end - else - ESX.ShowNotification(_U('player_not_unconscious')) - end - else - ESX.ShowNotification(_U('not_enough_medikit')) - end - - isBusy = false - - end, 'medikit') - + revivePlayer(closestPlayer) elseif data.current.value == 'small' then ESX.TriggerServerCallback('esx_ambulancejob:getItemAmount', function(quantity) @@ -174,6 +133,38 @@ function OpenMobileAmbulanceActionsMenu() end) end +function revivePlayer(closestPlayer) + isBusy = true + + ESX.TriggerServerCallback('esx_ambulancejob:getItemAmount', function(quantity) + if quantity > 0 then + local closestPlayerPed = GetPlayerPed(closestPlayer) + + if IsPedDeadOrDying(closestPlayerPed, 1) then + local playerPed = PlayerPedId() + local lib, anim = 'mini@cpr@char_a@cpr_str', 'cpr_pumpchest' + ESX.ShowNotification(_U('revive_inprogress')) + + for i=1, 15 do + Citizen.Wait(900) + + ESX.Streaming.RequestAnimDict(lib, function() + TaskPlayAnim(playerPed, lib, anim, 8.0, -8.0, -1, 0, 0, false, false, false) + end) + end + + TriggerServerEvent('esx_ambulancejob:removeItem', 'medikit') + TriggerServerEvent('esx_ambulancejob:revive', GetPlayerServerId(closestPlayer)) + else + ESX.ShowNotification(_U('player_not_unconscious')) + end + else + ESX.ShowNotification(_U('not_enough_medikit')) + end + isBusy = false + end, 'medikit') +end + function FastTravel(coords, heading) local playerPed = PlayerPedId() diff --git a/locales/br.lua b/locales/br.lua index 1cd0b382..6d9551c2 100644 --- a/locales/br.lua +++ b/locales/br.lua @@ -39,6 +39,7 @@ Locales['br'] = { ['revive_inprogress'] = 'Reanimação em andamento', ['revive_complete'] = 'você ressuscitou ~y~%s~s~', ['revive_complete_award'] = 'você ressuscitou ~y~%s~s~, ~g~$%s~s~', + ['revive_fail_offline'] = 'that player is no longer online', ['heal_inprogress'] = 'you are healing!', ['heal_complete'] = 'you have healed ~y~%s~s~', ['no_players'] = 'Nenhum jogador nas proximidades', diff --git a/locales/cs.lua b/locales/cs.lua index aa2f664f..807ad4e2 100644 --- a/locales/cs.lua +++ b/locales/cs.lua @@ -39,6 +39,7 @@ Locales['cs'] = { ['revive_inprogress'] = 'probíhá oživení!', ['revive_complete'] = 'oživili jste ~y~%s~s~', ['revive_complete_award'] = 'oživili jste ~y~%s~s~ a dostali jste ~g~$%s~s~!', + ['revive_fail_offline'] = 'that player is no longer online', ['heal_inprogress'] = 'uzdravujete!', ['heal_complete'] = 'uzdravili jste ~y~%s~s~', ['no_players'] = 'v okolí není žádný hráč!', diff --git a/locales/en.lua b/locales/en.lua index 36848986..ab37f814 100644 --- a/locales/en.lua +++ b/locales/en.lua @@ -39,6 +39,7 @@ Locales['en'] = { ['revive_inprogress'] = 'a revive is in progress!', ['revive_complete'] = 'you have revived ~y~%s~s~', ['revive_complete_award'] = 'you have revived ~y~%s~s~ and earned ~g~$%s~s~!', + ['revive_fail_offline'] = 'that player is no longer online', ['heal_inprogress'] = 'you are healing!', ['heal_complete'] = 'you have healed ~y~%s~s~', ['no_players'] = 'no players nearby', diff --git a/locales/es.lua b/locales/es.lua index a197d2ac..caad1d52 100644 --- a/locales/es.lua +++ b/locales/es.lua @@ -39,6 +39,7 @@ Locales['es'] = { ['revive_inprogress'] = 'reanimación en curso', ['revive_complete'] = 'has sido reanimado ~y~%s~s~', ['revive_complete_award'] = 'has sido reanimado ~y~%s~s~, ~g~$%s~s~', + ['revive_fail_offline'] = 'that player is no longer online', ['heal_inprogress'] = 'you are healing!', ['heal_complete'] = 'you have healed ~y~%s~s~', ['no_players'] = 'ningún jugador cerca', diff --git a/locales/fi.lua b/locales/fi.lua index 2068b318..ecc1b36e 100644 --- a/locales/fi.lua +++ b/locales/fi.lua @@ -1,8 +1,8 @@ Locales['fi'] = { -- Cloakroom - ['cloakroom'] = 'Vaatelokero', - ['ems_clothes_civil'] = 'Siviilikamppeet', - ['ems_clothes_ems'] = 'Työkamppeet', + ['cloakroom'] = 'vaatelokero', + ['ems_clothes_civil'] = 'siviilikamppeet', + ['ems_clothes_ems'] = 'työkamppeet', -- Vehicles ['ambulance'] = 'ambulance', ['helicopter_prompt'] = 'press ~INPUT_CONTEXT~ to access the ~y~Helicopter Actions~s~.', @@ -39,6 +39,7 @@ Locales['fi'] = { ['revive_inprogress'] = 'elvytys on menossa!', ['revive_complete'] = 'sinä elvytit henkilön ~y~%s~s~', ['revive_complete_award'] = 'sinä elvytit henkilön ~y~%s~s~ ja tienasit ~g~$%s~s~!', + ['revive_fail_offline'] = 'that player is no longer online', ['heal_inprogress'] = 'sinä olet parantamassa!', ['heal_complete'] = 'sinä paransit henkilön ~y~%s~s~', ['no_players'] = 'ei pelaajia lähettyvillä', diff --git a/locales/fr.lua b/locales/fr.lua index 94f62665..24fb1a4c 100644 --- a/locales/fr.lua +++ b/locales/fr.lua @@ -1,8 +1,8 @@ Locales['fr'] = { -- Cloakroom - ['cloakroom'] = 'Vestiaire', - ['ems_clothes_civil'] = 'Tenue Civil', - ['ems_clothes_ems'] = 'Tenue Ambulancier', + ['cloakroom'] = 'vestiaire', + ['ems_clothes_civil'] = 'tenue Civil', + ['ems_clothes_ems'] = 'tenue Ambulancier', -- Vehicles ['ambulance'] = 'ambulance', ['helicopter_prompt'] = 'appuyez sur ~INPUT_CONTEXT~ pour accéder aux ~y~Actions de l\'hélicoptère~s~.', @@ -39,6 +39,7 @@ Locales['fr'] = { ['revive_inprogress'] = 'réanimation en cours', ['revive_complete'] = 'vous avez réanimé ~y~%s~s~', ['revive_complete_award'] = 'vous avez réanimé ~y~%s~s~, ~g~$%s~s~', + ['revive_fail_offline'] = 'that player is no longer online', ['heal_inprogress'] = 'vous soignez...', ['heal_complete'] = 'vous avez soigné ~y~%s~s~', ['no_players'] = 'aucun joueur à proximité', diff --git a/locales/pl.lua b/locales/pl.lua index ebf75ce1..7308e156 100644 --- a/locales/pl.lua +++ b/locales/pl.lua @@ -39,6 +39,7 @@ Locales['pl'] = { ['revive_inprogress'] = 'trwa wskrzeszenie', ['revive_complete'] = 'zostałeś wskrzeszony ~y~%s~s~', ['revive_complete_award'] = 'zostałeś wskrzeszony ~y~%s~s~ i zarobiono ~g~$%s~s~!', + ['revive_fail_offline'] = 'that player is no longer online', ['heal_inprogress'] = 'leczysz!', ['heal_complete'] = 'zostałeś uleczony ~y~%s~s~', ['no_players'] = 'brak graczy w pobliżu', diff --git a/locales/sv.lua b/locales/sv.lua index 64abd2cf..c52d1f33 100644 --- a/locales/sv.lua +++ b/locales/sv.lua @@ -39,6 +39,7 @@ Locales['sv'] = { ['revive_inprogress'] = 'en återupplivning har börjats', ['revive_complete'] = 'du har återupplivat ~y~%s~s~, bra jobbat!', ['revive_complete_award'] = 'du har återupplivat ~y~%s~s~ och tjärnat ~g~%s SEK~s~ för dina tjänster, bra jobbat!', + ['revive_fail_offline'] = 'den spelaren har lämnat servern', ['heal_inprogress'] = 'du behandlar patienten!', ['heal_complete'] = 'du har behandlat ~y~%s~s~', ['no_players'] = 'det finns inga spelare i närheten!', diff --git a/server/main.lua b/server/main.lua index 1f037c9e..6da561e6 100644 --- a/server/main.lua +++ b/server/main.lua @@ -3,17 +3,24 @@ local playersHealing = {} TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) -RegisterServerEvent('esx_ambulancejob:revive') -AddEventHandler('esx_ambulancejob:revive', function(target) +RegisterNetEvent('esx_ambulancejob:revive') +AddEventHandler('esx_ambulancejob:revive', function(playerId) local xPlayer = ESX.GetPlayerFromId(source) - if xPlayer.job.name == 'ambulance' then - xPlayer.addMoney(Config.ReviveReward) - TriggerClientEvent('esx_ambulancejob:revive', target) + if xPlayer and xPlayer.job.name == 'ambulance' then + local xTarget = ESX.GetPlayerFromId(playerId) + + if xTarget then + xPlayer.showNotification(_U('revive_complete_award', xTarget.name, Config.ReviveReward)) + xPlayer.addMoney(Config.ReviveReward) + xTarget.triggerEvent('esx_ambulancejob:revive') + else + xPlayer.showNotification(_U('revive_fail_offline')) + end end end) -RegisterServerEvent('esx_ambulancejob:heal') +RegisterNetEvent('esx_ambulancejob:heal') AddEventHandler('esx_ambulancejob:heal', function(target, type) local xPlayer = ESX.GetPlayerFromId(source) @@ -22,7 +29,7 @@ AddEventHandler('esx_ambulancejob:heal', function(target, type) end end) -RegisterServerEvent('esx_ambulancejob:putInVehicle') +RegisterNetEvent('esx_ambulancejob:putInVehicle') AddEventHandler('esx_ambulancejob:putInVehicle', function(target) local xPlayer = ESX.GetPlayerFromId(source) @@ -88,7 +95,7 @@ if Config.EarlyRespawnFine then cb(bankBalance >= Config.EarlyRespawnFineAmount) end) - RegisterServerEvent('esx_ambulancejob:payFine') + RegisterNetEvent('esx_ambulancejob:payFine') AddEventHandler('esx_ambulancejob:payFine', function() local xPlayer = ESX.GetPlayerFromId(source) local fineAmount = Config.EarlyRespawnFineAmount @@ -188,7 +195,7 @@ function getPriceFromHash(hashKey, jobGrade, type) return 0 end -RegisterServerEvent('esx_ambulancejob:removeItem') +RegisterNetEvent('esx_ambulancejob:removeItem') AddEventHandler('esx_ambulancejob:removeItem', function(item) local xPlayer = ESX.GetPlayerFromId(source) xPlayer.removeInventoryItem(item, 1) @@ -200,7 +207,7 @@ AddEventHandler('esx_ambulancejob:removeItem', function(item) end end) -RegisterServerEvent('esx_ambulancejob:giveItem') +RegisterNetEvent('esx_ambulancejob:giveItem') AddEventHandler('esx_ambulancejob:giveItem', function(itemName, amount) local xPlayer = ESX.GetPlayerFromId(source) @@ -274,7 +281,7 @@ ESX.RegisterServerCallback('esx_ambulancejob:getDeathStatus', function(source, c end) end) -RegisterServerEvent('esx_ambulancejob:setDeathStatus') +RegisterNetEvent('esx_ambulancejob:setDeathStatus') AddEventHandler('esx_ambulancejob:setDeathStatus', function(isDead) local identifier = GetPlayerIdentifiers(source)[1] From 01a6cc466fd1ad815350f4ed27900186a1bfecc5 Mon Sep 17 00:00:00 2001 From: maiconkkl Date: Sun, 5 Jan 2020 15:51:05 -0300 Subject: [PATCH 138/177] Improved Portuguese locale (#174) * Correcting and improving translation * Update br.lua * Update br.lua * Update br.lua --- locales/br.lua | 146 ++++++++++++++++++++++++------------------------- 1 file changed, 73 insertions(+), 73 deletions(-) diff --git a/locales/br.lua b/locales/br.lua index 6d9551c2..3a96cd65 100644 --- a/locales/br.lua +++ b/locales/br.lua @@ -1,93 +1,93 @@ Locales['br'] = { -- Cloakroom - ['cloakroom'] = 'Vestiário', - ['ems_clothes_civil'] = 'Roupa Normal', - ['ems_clothes_ems'] = 'Entrar como Socorrista', + ['cloakroom'] = 'guarda roupa', + ['ems_clothes_civil'] = 'roupa normal', + ['ems_clothes_ems'] = 'entrar como socorrista', -- Vehicles - ['ambulance'] = 'ambulance', - ['helicopter_prompt'] = 'press ~INPUT_CONTEXT~ to access the ~y~Helicopter Actions~s~.', - ['helicopter_buy'] = 'helicopter shop', - ['helicopter_garage'] = 'open garage', - ['helicopter_store'] = 'store helicopter in garage', - ['helicopter_garage_title'] = 'helicopter Garage', - ['helicopter_title'] = 'helicopter Actions', - ['helicopter_notauthorized'] = 'you\'re not authorized to buy helicopters.', - ['garage_prompt'] = 'press ~INPUT_CONTEXT~ to access the ~y~Vehicle Actions~s~.', - ['garage_title'] = 'vehicle Actions', - ['garage_stored'] = 'stored', - ['garage_notstored'] = 'not in garage', - ['garage_storing'] = 'we\'re attempting to remove the vehicle, make sure no players are around it.', - ['garage_has_stored'] = 'the vehicle has been stored in your garage', - ['garage_has_notstored'] = 'no nearby owned vehicles were found', - ['garage_notavailable'] = 'your vehicle is not stored in the garage.', - ['garage_blocked'] = 'there\'s no available spawn points!', - ['garage_empty'] = 'you dont have any vehicles in your garage.', - ['garage_released'] = 'your vehicle has been released from the garage.', - ['garage_store_nearby'] = 'there is no nearby vehicles.', - ['garage_storeditem'] = 'open garage', - ['garage_storeitem'] = 'store vehicle in garage', - ['garage_buyitem'] = 'vehicle shop', + ['ambulance'] = 'ambulancia', + ['helicopter_prompt'] = 'pressione ~INPUT_CONTEXT~ para acessar a ~y~Helicopter Actions~s~.', + ['helicopter_buy'] = 'loja de helicóptero', + ['helicopter_garage'] = 'garagem aberta', + ['helicopter_store'] = 'helicóptero da loja entregue na garagem', + ['helicopter_garage_title'] = 'garagem de helicóptero', + ['helicopter_title'] = 'ações do helicóptero', + ['helicopter_notauthorized'] = 'você não está autorizado a comprar helicópteros.', + ['garage_prompt'] = 'pressione ~INPUT_CONTEXT~ para entra no ~y~Vehicle Actions~s~.', + ['garage_title'] = 'ações do veiculo', + ['garage_stored'] = 'guardado', + ['garage_notstored'] = 'não foi guardado', + ['garage_storing'] = 'estamos tentando guardar o veículo, verifique se não há cidadões ao seu redor.', + ['garage_has_stored'] = 'o veículo foi guardado na sua garagem', + ['garage_has_notstored'] = 'nem um dos seus veiculos foi encontrado proximo', + ['garage_notavailable'] = 'o seu veículo não está guardado na garagem.', + ['garage_blocked'] = 'não há pontos de spawn disponíveis!', + ['garage_empty'] = 'você não tem veículos na sua garagem.', + ['garage_released'] = 'seu veículo foi liberado da garagem.', + ['garage_store_nearby'] = 'não há veículos próximos.', + ['garage_storeditem'] = 'abrir garagem', + ['garage_storeitem'] = 'veículo da loja na garagem', + ['garage_buyitem'] = 'loja de veículos', ['shop_item'] = '$%s', - ['vehicleshop_title'] = 'vehicle Shop', - ['vehicleshop_confirm'] = 'do you want to buy this vehicle?', - ['vehicleshop_bought'] = 'you have bought ~y~%s~s~ for ~r~$%s~s~', - ['vehicleshop_money'] = 'you cannot afford that vehicle', - ['vehicleshop_awaiting_model'] = 'the vehicle is currently ~g~DOWNLOADING & LOADING~s~ please wait', - ['confirm_no'] = 'no', - ['confirm_yes'] = 'yes', + ['vehicleshop_title'] = 'loja de veículos', + ['vehicleshop_confirm'] = 'você quer comprar este veículo?', + ['vehicleshop_bought'] = 'você comprou ~y~%s~s~ para ~r~$%s~s~', + ['vehicleshop_money'] = 'você não pode pagar esse veículo', + ['vehicleshop_awaiting_model'] = 'o veículo está atualmente ~g~DOWNLOADING & LOADING~s~, por favor aguarde', + ['confirm_no'] = 'não', + ['confirm_yes'] = 'sim', -- Action Menu - ['revive_inprogress'] = 'Reanimação em andamento', + ['revive_inprogress'] = 'reanimação em andamento', ['revive_complete'] = 'você ressuscitou ~y~%s~s~', ['revive_complete_award'] = 'você ressuscitou ~y~%s~s~, ~g~$%s~s~', - ['revive_fail_offline'] = 'that player is no longer online', - ['heal_inprogress'] = 'you are healing!', - ['heal_complete'] = 'you have healed ~y~%s~s~', - ['no_players'] = 'Nenhum jogador nas proximidades', - ['no_vehicles'] = 'Sem veículos nas proximidades', - ['player_not_unconscious'] = 'Não está inconsciente', - ['player_not_conscious'] = 'that player is not conscious!', + ['revive_fail_offline'] = 'esse cidadão não está mais na cidade', + ['heal_inprogress'] = 'você está curando!', + ['heal_complete'] = 'você curou ~y~%s~s~', + ['no_players'] = 'nenhum cidadão nas proximidades', + ['no_vehicles'] = 'sem veículos nas proximidades', + ['player_not_unconscious'] = 'não está inconsciente', + ['player_not_conscious'] = 'esse cidadão não está consciente!', -- Boss Menu - ['boss_actions'] = 'Menu Administração', + ['boss_actions'] = 'menu administração', -- Misc ['invalid_amount'] = '~r~Quantidade inválida', - ['actions_prompt'] = 'press ~INPUT_CONTEXT~ access the ~y~Ambulance Actions~s~.', - ['deposit_amount'] = 'Quantidade inválida para deposito', - ['money_withdraw'] = 'Quantidade a ser retirada', - ['fast_travel'] = 'Aperte ~INPUT_CONTEXT~ para mover-se rapidamente.', - ['open_pharmacy'] = 'Aperte ~INPUT_CONTEXT~ para abrir a farmácia.', - ['pharmacy_menu_title'] = 'Farmácia', + ['actions_prompt'] = 'aperte ~INPUT_CONTEXT~ para entra ~y~Ambulance Actions~s~.', + ['deposit_amount'] = 'quantidade inválida para deposito', + ['money_withdraw'] = 'quantidade a ser retirada', + ['fast_travel'] = 'aperte ~INPUT_CONTEXT~ para mover-se rapidamente.', + ['open_pharmacy'] = 'aperte ~INPUT_CONTEXT~ para abrir a farmácia.', + ['pharmacy_menu_title'] = 'farmácia', ['pharmacy_take'] = 'tomar %s', - ['medikit'] = 'Seringa', - ['bandage'] = 'Vendagem', - ['max_item'] = 'você já carrega o suficiente sobre você.', + ['medikit'] = 'seringa', + ['bandage'] = 'vendagem', + ['max_item'] = 'você não pode carregar mais', -- F6 Menu - ['ems_menu'] = 'Interação com cidadão', - ['ems_menu_title'] = 'Ambulância - Interação com cidadão', - ['ems_menu_revive'] = 'Reanimar', - ['ems_menu_putincar'] = 'Colocar no veiculo', - ['ems_menu_small'] = 'Curar pequenas feridas', - ['ems_menu_big'] = 'Tratando lesões graves', + ['ems_menu'] = 'interação com cidadão', + ['ems_menu_title'] = 'ambulância - Interação com cidadão', + ['ems_menu_revive'] = 'reanimar', + ['ems_menu_putincar'] = 'colocar no veiculo', + ['ems_menu_small'] = 'curar pequenas feridas', + ['ems_menu_big'] = 'tratando lesões graves', -- Phone - ['alert_ambulance'] = 'Alerta Socorro', + ['alert_ambulance'] = 'alerta socorrista', -- Death - ['respawn_available_in'] = 'respawn available in ~b~%s minutes %s seconds~s~', - ['respawn_bleedout_in'] = 'you will bleed out in ~b~%s minutes %s seconds~s~\n', - ['respawn_bleedout_prompt'] = 'hold [~b~E~s~] to respawn', - ['respawn_bleedout_fine'] = 'hold [~b~E~s~] to respawn for ~g~$%s~s~', - ['respawn_bleedout_fine_msg'] = 'you paid ~r~$%s~s~ to respawn.', - ['distress_send'] = 'press [~b~G~s~] to send distress signal', - ['distress_sent'] = 'distress signal has been sent to available units!', - ['distress_message'] = 'medical attention required: unconscious citizen!', - ['combatlog_message'] = 'you have been force-respawned because you\'ve previously left the server when dead.', + ['respawn_available_in'] = 'você irar reviver em ~b~%s minutos %s segundos~s~', + ['respawn_bleedout_in'] = 'você vai sangrar ~b~%s minutos %s segundos~s~\n', + ['respawn_bleedout_prompt'] = 'aguarde [~b~E~s~] para reviver', + ['respawn_bleedout_fine'] = 'aguarde [~b~E~s~] para reviver por ~g~$%s~s~', + ['respawn_bleedout_fine_msg'] = 'você precisa pagar ~r~$%s~s~ para reviver', + ['distress_send'] = 'pressione [~b~G~s~] enviar sinal de socorro', + ['distress_sent'] = 'sinal de socorro foi enviado para as unidades disponíveis!', + ['distress_message'] = 'atenção médica necessária: cidadão inconsciente!', + ['combatlog_message'] = 'você foi revivido porque deixou o servidor anteriormente quando estava morto.', -- Revive - ['revive_help'] = 'reviver um jogador', + ['revive_help'] = 'reviver um cidadão', -- Item ['used_medikit'] = 'você usou 1x Seringa', ['used_bandage'] = 'você usou 1x Vendagem', - ['not_enough_medikit'] = 'Você não tem ~b~Seringa~s~.', - ['not_enough_bandage'] = 'Você não tem ~b~Vendagem~s~.', - ['healed'] = 'Você foi tratado.', + ['not_enough_medikit'] = 'você não tem ~b~Seringa~s~.', + ['not_enough_bandage'] = 'você não tem ~b~Vendagem~s~.', + ['healed'] = 'você foi tratado.', -- Blips - ['blip_hospital'] = 'Hôspital', - ['blip_dead'] = 'unconscious player', + ['blip_hospital'] = 'hospital', + ['blip_dead'] = 'cidadão inconsciente', } From 210b98975a4bb52d244e3d44ffa9d59d1df4684c Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Sun, 12 Jan 2020 22:15:47 +0100 Subject: [PATCH 139/177] Removed old lastPosition code --- client/main.lua | 7 ------- 1 file changed, 7 deletions(-) diff --git a/client/main.lua b/client/main.lua index f0375890..517b6483 100644 --- a/client/main.lua +++ b/client/main.lua @@ -308,10 +308,7 @@ function RemoveItemsAfterRPDeath() z = Config.RespawnPoint.coords.z } - ESX.SetPlayerData('lastPosition', formattedCoords) ESX.SetPlayerData('loadout', {}) - - TriggerServerEvent('esx:updateLastPosition', formattedCoords) RespawnPed(PlayerPedId(), formattedCoords, Config.RespawnPoint.heading) StopScreenEffect('DeathFailOut') @@ -365,10 +362,6 @@ AddEventHandler('esx_ambulancejob:revive', function() z = ESX.Math.Round(coords.z, 1) } - ESX.SetPlayerData('lastPosition', formattedCoords) - - TriggerServerEvent('esx:updateLastPosition', formattedCoords) - RespawnPed(playerPed, formattedCoords, 0.0) StopScreenEffect('DeathFailOut') From 32f8a2d45d9c6f052dd18f3194c23afa0c963691 Mon Sep 17 00:00:00 2001 From: maiconkkl Date: Wed, 15 Jan 2020 16:41:55 -0300 Subject: [PATCH 140/177] Create SqlTranslate (#175) --- localization/br_esx_ambulancejob.sql | 33 ++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 localization/br_esx_ambulancejob.sql diff --git a/localization/br_esx_ambulancejob.sql b/localization/br_esx_ambulancejob.sql new file mode 100644 index 00000000..98357560 --- /dev/null +++ b/localization/br_esx_ambulancejob.sql @@ -0,0 +1,33 @@ +USE `essentialmode`; + +INSERT INTO `addon_account` (name, label, shared) VALUES + ('society_ambulance', 'EMS', 1) +; + +INSERT INTO `addon_inventory` (name, label, shared) VALUES + ('society_ambulance', 'EMS', 1) +; + +INSERT INTO `datastore` (name, label, shared) VALUES + ('society_ambulance', 'EMS', 1) +; + +INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_female) VALUES + ('ambulance',0,'ambulância','Jr. EMT',20,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), + ('ambulance',1,'medico','EMT',40,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), + ('ambulance',2,'medico chefe','Sr. EMT',60,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), + ('ambulance',3,'boss','EMT Supervisor',80,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}') +; + +INSERT INTO `jobs` (name, label) VALUES + ('ambulance','EMS') +; + +INSERT INTO `items` (name, label, weight) VALUES + ('bandage','curativo', 2), + ('medikit','kit medico', 2) +; + +ALTER TABLE `users` + ADD `is_dead` TINYINT(1) NULL DEFAULT '0' +; From d94522fbbe50c0db4a35809bb6393d10b0011f25 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Wed, 15 Jan 2020 20:43:40 +0100 Subject: [PATCH 141/177] Fixed #177 --- server/main.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/main.lua b/server/main.lua index 6da561e6..b9b7afc0 100644 --- a/server/main.lua +++ b/server/main.lua @@ -229,7 +229,7 @@ end) TriggerEvent('es:addGroupCommand', 'revive', 'admin', function(source, args, user) if args[1] then local playerId = tonumber(args[1]) - if playerId and ESX.Players[playerId] then + if playerId and ESX.GetPlayerFromId(playerId) then TriggerClientEvent('esx_ambulancejob:revive', playerId) else TriggerClientEvent('chat:addMessage', source, { args = { '^1SYSTEM', 'Player not online.' } }) From 7cf30361542d95b059d23ffdeae734c8bce09378 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Sun, 19 Jan 2020 16:38:59 +0100 Subject: [PATCH 142/177] Minor adjustments --- client/job.lua | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/client/job.lua b/client/job.lua index 2434ca4f..013e9e5e 100644 --- a/client/job.lua +++ b/client/job.lua @@ -149,7 +149,7 @@ function revivePlayer(closestPlayer) Citizen.Wait(900) ESX.Streaming.RequestAnimDict(lib, function() - TaskPlayAnim(playerPed, lib, anim, 8.0, -8.0, -1, 0, 0, false, false, false) + TaskPlayAnim(playerPed, lib, anim, 8.0, -8.0, -1, 0, 0.0, false, false, false) end) end @@ -724,16 +724,13 @@ function OpenShopMenu(elements, restoreCoords, shopCoords) align = 'top-left', elements = elements }, function(data, menu) - ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'vehicle_shop_confirm', { title = _U('vehicleshop_confirm', data.current.name, data.current.price), align = 'top-left', elements = { - { label = _U('confirm_no'), value = 'no' }, - { label = _U('confirm_yes'), value = 'yes' } - } - }, function(data2, menu2) - + {label = _U('confirm_no'), value = 'no'}, + {label = _U('confirm_yes'), value = 'yes'} + }}, function(data2, menu2) if data2.current.value == 'yes' then local newPlate = exports['esx_vehicleshop']:GeneratePlate() local vehicle = GetVehiclePedIsIn(playerPed, false) From ecb553f23cccc7f4520c8ab70c2a90a307d9c186 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Sun, 19 Jan 2020 16:44:22 +0100 Subject: [PATCH 143/177] Minor adjustments --- client/job.lua | 21 +++++--------- config.lua | 79 +++++++++++++++++++++++--------------------------- 2 files changed, 44 insertions(+), 56 deletions(-) diff --git a/client/job.lua b/client/job.lua index 013e9e5e..c3ee0617 100644 --- a/client/job.lua +++ b/client/job.lua @@ -32,7 +32,6 @@ function OpenAmbulanceActionsMenu() end function OpenMobileAmbulanceActionsMenu() - ESX.UI.Menu.CloseAll() ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'mobile_ambulance_actions', { @@ -40,8 +39,7 @@ function OpenMobileAmbulanceActionsMenu() align = 'top-left', elements = { {label = _U('ems_menu'), value = 'citizen_interaction'} - } - }, function(data, menu) + }}, function(data, menu) if data.current.value == 'citizen_interaction' then ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'citizen_interaction', { title = _U('ems_menu_title'), @@ -51,8 +49,7 @@ function OpenMobileAmbulanceActionsMenu() {label = _U('ems_menu_small'), value = 'small'}, {label = _U('ems_menu_big'), value = 'big'}, {label = _U('ems_menu_putincar'), value = 'put_in_vehicle'} - } - }, function(data, menu) + }}, function(data, menu) if isBusy then return end local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() @@ -60,11 +57,9 @@ function OpenMobileAmbulanceActionsMenu() if closestPlayer == -1 or closestDistance > 1.0 then ESX.ShowNotification(_U('no_players')) else - if data.current.value == 'revive' then revivePlayer(closestPlayer) elseif data.current.value == 'small' then - ESX.TriggerServerCallback('esx_ambulancejob:getItemAmount', function(quantity) if quantity > 0 then local closestPlayerPed = GetPlayerPed(closestPlayer) @@ -195,7 +190,7 @@ Citizen.CreateThread(function() -- Ambulance Actions for k,v in ipairs(hospital.AmbulanceActions) do - local distance = GetDistanceBetweenCoords(playerCoords, v, true) + local distance = #(playerCoords - v) if distance < Config.DrawDistance then DrawMarker(Config.Marker.type, v, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Config.Marker.x, Config.Marker.y, Config.Marker.z, Config.Marker.r, Config.Marker.g, Config.Marker.b, Config.Marker.a, false, false, 2, Config.Marker.rotate, nil, nil, false) @@ -209,7 +204,7 @@ Citizen.CreateThread(function() -- Pharmacies for k,v in ipairs(hospital.Pharmacies) do - local distance = GetDistanceBetweenCoords(playerCoords, v, true) + local distance = #(playerCoords - v) if distance < Config.DrawDistance then DrawMarker(Config.Marker.type, v, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Config.Marker.x, Config.Marker.y, Config.Marker.z, Config.Marker.r, Config.Marker.g, Config.Marker.b, Config.Marker.a, false, false, 2, Config.Marker.rotate, nil, nil, false) @@ -223,7 +218,7 @@ Citizen.CreateThread(function() -- Vehicle Spawners for k,v in ipairs(hospital.Vehicles) do - local distance = GetDistanceBetweenCoords(playerCoords, v.Spawner, true) + local distance = #(playerCoords - v.Spawner) if distance < Config.DrawDistance then DrawMarker(v.Marker.type, v.Spawner, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, v.Marker.x, v.Marker.y, v.Marker.z, v.Marker.r, v.Marker.g, v.Marker.b, v.Marker.a, false, false, 2, v.Marker.rotate, nil, nil, false) @@ -237,7 +232,7 @@ Citizen.CreateThread(function() -- Helicopter Spawners for k,v in ipairs(hospital.Helicopters) do - local distance = GetDistanceBetweenCoords(playerCoords, v.Spawner, true) + local distance = #(playerCoords - v.Spawner) if distance < Config.DrawDistance then DrawMarker(v.Marker.type, v.Spawner, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, v.Marker.x, v.Marker.y, v.Marker.z, v.Marker.r, v.Marker.g, v.Marker.b, v.Marker.a, false, false, 2, v.Marker.rotate, nil, nil, false) @@ -251,7 +246,7 @@ Citizen.CreateThread(function() -- Fast Travels for k,v in ipairs(hospital.FastTravels) do - local distance = GetDistanceBetweenCoords(playerCoords, v.From, true) + local distance = #(playerCoords - v.From) if distance < Config.DrawDistance then DrawMarker(v.Marker.type, v.From, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, v.Marker.x, v.Marker.y, v.Marker.z, v.Marker.r, v.Marker.g, v.Marker.b, v.Marker.a, false, false, 2, v.Marker.rotate, nil, nil, false) @@ -266,7 +261,7 @@ Citizen.CreateThread(function() -- Fast Travels (Prompt) for k,v in ipairs(hospital.FastTravelsPrompt) do - local distance = GetDistanceBetweenCoords(playerCoords, v.From, true) + local distance = #(playerCoords - v.From) if distance < Config.DrawDistance then DrawMarker(v.Marker.type, v.From, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, v.Marker.x, v.Marker.y, v.Marker.z, v.Marker.r, v.Marker.g, v.Marker.b, v.Marker.a, false, false, 2, v.Marker.rotate, nil, nil, false) diff --git a/config.lua b/config.lua index 8a37c47c..20e848f9 100644 --- a/config.lua +++ b/config.lua @@ -2,7 +2,7 @@ Config = {} Config.DrawDistance = 100.0 -Config.Marker = { type = 1, x = 1.5, y = 1.5, z = 0.5, r = 102, g = 0, b = 102, a = 100, rotate = false } +Config.Marker = {type = 1, x = 1.5, y = 1.5, z = 0.5, r = 102, g = 0, b = 102, a = 100, rotate = false} Config.ReviveReward = 700 -- revive reward, set to 0 if you don't want it enabled Config.AntiCombatLog = true -- enable anti-combat logging? @@ -10,11 +10,8 @@ Config.LoadIpl = true -- disable if you're using fivem-ipl or Config.Locale = 'fr' -local second = 1000 -local minute = 60 * second - -Config.EarlyRespawnTimer = 2 * minute -- Time til respawn is available -Config.BleedoutTimer = 10 * minute -- Time til the player bleeds out +Config.EarlyRespawnTimer = 60000 * 1 -- time til respawn is available +Config.BleedoutTimer = 60000 * 10 -- time til the player bleeds out Config.EnablePlayerManagement = false @@ -26,7 +23,7 @@ Config.RemoveItemsAfterRPDeath = true Config.EarlyRespawnFine = false Config.EarlyRespawnFineAmount = 5000 -Config.RespawnPoint = { coords = vector3(341.0, -1397.3, 32.5), heading = 48.5 } +Config.RespawnPoint = {coords = vector3(341.0, -1397.3, 32.5), heading = 48.5} Config.Hospitals = { @@ -51,11 +48,11 @@ Config.Hospitals = { { Spawner = vector3(307.7, -1433.4, 30.0), InsideShop = vector3(446.7, -1355.6, 43.5), - Marker = { type = 36, x = 1.0, y = 1.0, z = 1.0, r = 100, g = 50, b = 200, a = 100, rotate = true }, + Marker = {type = 36, x = 1.0, y = 1.0, z = 1.0, r = 100, g = 50, b = 200, a = 100, rotate = true}, SpawnPoints = { - { coords = vector3(297.2, -1429.5, 29.8), heading = 227.6, radius = 4.0 }, - { coords = vector3(294.0, -1433.1, 29.8), heading = 227.6, radius = 4.0 }, - { coords = vector3(309.4, -1442.5, 29.8), heading = 227.6, radius = 6.0 } + {coords = vector3(297.2, -1429.5, 29.8), heading = 227.6, radius = 4.0}, + {coords = vector3(294.0, -1433.1, 29.8), heading = 227.6, radius = 4.0}, + {coords = vector3(309.4, -1442.5, 29.8), heading = 227.6, radius = 6.0} } } }, @@ -64,10 +61,10 @@ Config.Hospitals = { { Spawner = vector3(317.5, -1449.5, 46.5), InsideShop = vector3(305.6, -1419.7, 41.5), - Marker = { type = 34, x = 1.5, y = 1.5, z = 1.5, r = 100, g = 150, b = 150, a = 100, rotate = true }, + Marker = {type = 34, x = 1.5, y = 1.5, z = 1.5, r = 100, g = 150, b = 150, a = 100, rotate = true}, SpawnPoints = { - { coords = vector3(313.5, -1465.1, 46.5), heading = 142.7, radius = 10.0 }, - { coords = vector3(299.5, -1453.2, 46.5), heading = 142.7, radius = 10.0 } + {coords = vector3(313.5, -1465.1, 46.5), heading = 142.7, radius = 10.0}, + {coords = vector3(299.5, -1453.2, 46.5), heading = 142.7, radius = 10.0} } } }, @@ -75,53 +72,53 @@ Config.Hospitals = { FastTravels = { { From = vector3(294.7, -1448.1, 29.0), - To = { coords = vector3(272.8, -1358.8, 23.5), heading = 0.0 }, - Marker = { type = 1, x = 2.0, y = 2.0, z = 0.5, r = 102, g = 0, b = 102, a = 100, rotate = false } + To = {coords = vector3(272.8, -1358.8, 23.5), heading = 0.0}, + Marker = {type = 1, x = 2.0, y = 2.0, z = 0.5, r = 102, g = 0, b = 102, a = 100, rotate = false} }, { From = vector3(275.3, -1361, 23.5), - To = { coords = vector3(295.8, -1446.5, 28.9), heading = 0.0 }, - Marker = { type = 1, x = 2.0, y = 2.0, z = 0.5, r = 102, g = 0, b = 102, a = 100, rotate = false } + To = {coords = vector3(295.8, -1446.5, 28.9), heading = 0.0}, + Marker = {type = 1, x = 2.0, y = 2.0, z = 0.5, r = 102, g = 0, b = 102, a = 100, rotate = false} }, { From = vector3(247.3, -1371.5, 23.5), - To = { coords = vector3(333.1, -1434.9, 45.5), heading = 138.6 }, - Marker = { type = 1, x = 1.5, y = 1.5, z = 0.5, r = 102, g = 0, b = 102, a = 100, rotate = false } + To = {coords = vector3(333.1, -1434.9, 45.5), heading = 138.6}, + Marker = {type = 1, x = 1.5, y = 1.5, z = 0.5, r = 102, g = 0, b = 102, a = 100, rotate = false} }, { From = vector3(335.5, -1432.0, 45.50), - To = { coords = vector3(249.1, -1369.6, 23.5), heading = 0.0 }, - Marker = { type = 1, x = 2.0, y = 2.0, z = 0.5, r = 102, g = 0, b = 102, a = 100, rotate = false } + To = {coords = vector3(249.1, -1369.6, 23.5), heading = 0.0}, + Marker = {type = 1, x = 2.0, y = 2.0, z = 0.5, r = 102, g = 0, b = 102, a = 100, rotate = false} }, { From = vector3(234.5, -1373.7, 20.9), - To = { coords = vector3(320.9, -1478.6, 28.8), heading = 0.0 }, - Marker = { type = 1, x = 1.5, y = 1.5, z = 1.0, r = 102, g = 0, b = 102, a = 100, rotate = false } + To = {coords = vector3(320.9, -1478.6, 28.8), heading = 0.0}, + Marker = {type = 1, x = 1.5, y = 1.5, z = 1.0, r = 102, g = 0, b = 102, a = 100, rotate = false} }, { From = vector3(317.9, -1476.1, 28.9), - To = { coords = vector3(238.6, -1368.4, 23.5), heading = 0.0 }, - Marker = { type = 1, x = 1.5, y = 1.5, z = 1.0, r = 102, g = 0, b = 102, a = 100, rotate = false } + To = {coords = vector3(238.6, -1368.4, 23.5), heading = 0.0}, + Marker = {type = 1, x = 1.5, y = 1.5, z = 1.0, r = 102, g = 0, b = 102, a = 100, rotate = false} } }, FastTravelsPrompt = { { From = vector3(237.4, -1373.8, 26.0), - To = { coords = vector3(251.9, -1363.3, 38.5), heading = 0.0 }, - Marker = { type = 1, x = 1.5, y = 1.5, z = 0.5, r = 102, g = 0, b = 102, a = 100, rotate = false }, + To = {coords = vector3(251.9, -1363.3, 38.5), heading = 0.0}, + Marker = {type = 1, x = 1.5, y = 1.5, z = 0.5, r = 102, g = 0, b = 102, a = 100, rotate = false}, Prompt = _U('fast_travel') }, { From = vector3(256.5, -1357.7, 36.0), - To = { coords = vector3(235.4, -1372.8, 26.3), heading = 0.0 }, - Marker = { type = 1, x = 1.5, y = 1.5, z = 0.5, r = 102, g = 0, b = 102, a = 100, rotate = false }, + To = {coords = vector3(235.4, -1372.8, 26.3), heading = 0.0}, + Marker = {type = 1, x = 1.5, y = 1.5, z = 0.5, r = 102, g = 0, b = 102, a = 100, rotate = false}, Prompt = _U('fast_travel') } } @@ -130,41 +127,37 @@ Config.Hospitals = { } Config.AuthorizedVehicles = { - ambulance = { - { model = 'ambulance', label = 'Ambulance Van', price = 5000} + {model = 'ambulance', label = 'Ambulance Van', price = 5000} }, doctor = { - { model = 'ambulance', label = 'Ambulance Van', price = 4500} + {model = 'ambulance', label = 'Ambulance Van', price = 4500} }, chief_doctor = { - { model = 'ambulance', label = 'Ambulance Van', price = 3000} + {model = 'ambulance', label = 'Ambulance Van', price = 3000} }, boss = { - { model = 'ambulance', label = 'Ambulance Van', price = 2000} + {model = 'ambulance', label = 'Ambulance Van', price = 2000} } - } Config.AuthorizedHelicopters = { - ambulance = {}, doctor = { - { model = 'buzzard2', label = 'Nagasaki Buzzard', price = 150000 } + {model = 'buzzard2', label = 'Nagasaki Buzzard', price = 150000} }, chief_doctor = { - { model = 'buzzard2', label = 'Nagasaki Buzzard', price = 150000 }, - { model = 'seasparrow', label = 'Sea Sparrow', price = 300000 } + {model = 'buzzard2', label = 'Nagasaki Buzzard', price = 150000}, + {model = 'seasparrow', label = 'Sea Sparrow', price = 300000} }, boss = { - { model = 'buzzard2', label = 'Nagasaki Buzzard', price = 10000 }, - { model = 'seasparrow', label = 'Sea Sparrow', price = 250000 } + {model = 'buzzard2', label = 'Nagasaki Buzzard', price = 10000}, + {model = 'seasparrow', label = 'Sea Sparrow', price = 250000} } - } From 6b056fe421b1ccffef13b15f850a2ceb822a97ec Mon Sep 17 00:00:00 2001 From: rex2630 Date: Sun, 19 Jan 2020 16:47:27 +0100 Subject: [PATCH 144/177] Replace __resource.lua with fxmanifest.lua --- __resource.lua => fxmanifest.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) rename __resource.lua => fxmanifest.lua (90%) diff --git a/__resource.lua b/fxmanifest.lua similarity index 90% rename from __resource.lua rename to fxmanifest.lua index f5f45d38..7acca84c 100644 --- a/__resource.lua +++ b/fxmanifest.lua @@ -1,4 +1,6 @@ -resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937' +fx_version 'adamant' + +game 'gta5' description 'ESX Ambulance Job' @@ -38,4 +40,4 @@ dependencies { 'es_extended', 'esx_skin', 'esx_vehicleshop' -} \ No newline at end of file +} From 6f8587b391886359b22a2bc41bc78869d3940703 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Sun, 19 Jan 2020 17:14:33 +0100 Subject: [PATCH 145/177] Implemented dead player blips, closes #46 (read desc) - Fixed vehicles in vehicle shop not unloading - Use busy spinner instead of drawing when loading vehicles --- client/job.lua | 78 ++++++++++++++++++++++++++++++++----------------- client/main.lua | 30 ++++++------------- locales/br.lua | 1 - locales/cs.lua | 1 - locales/en.lua | 1 - locales/es.lua | 1 - locales/fi.lua | 1 - locales/fr.lua | 1 - locales/pl.lua | 1 - locales/sv.lua | 1 - server/main.lua | 50 ++++++++++++++++++++++++++----- 11 files changed, 102 insertions(+), 64 deletions(-) diff --git a/client/job.lua b/client/job.lua index c3ee0617..c0c3c06c 100644 --- a/client/job.lua +++ b/client/job.lua @@ -1,6 +1,6 @@ local CurrentAction, CurrentActionMsg, CurrentActionData = nil, '', {} local HasAlreadyEnteredMarker, LastHospital, LastPart, LastPartNum -local isBusy = false +local isBusy, deadPlayers, deadPlayerBlips, isOnDuty = false, {}, {}, false local spawnedVehicles, isInShopMenu = {}, false function OpenAmbulanceActionsMenu() @@ -407,11 +407,16 @@ function OpenCloakroomMenu() elements = { {label = _U('ems_clothes_civil'), value = 'citizen_wear'}, {label = _U('ems_clothes_ems'), value = 'ambulance_wear'}, - } - }, function(data, menu) + }}, function(data, menu) if data.current.value == 'citizen_wear' then ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin) TriggerEvent('skinchanger:loadSkin', skin) + isOnDuty = false + + for playerId,v in pairs(deadPlayerBlips) do + RemoveBlip(v) + deadPlayerBlips[playerId] = nil + end end) elseif data.current.value == 'ambulance_wear' then ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin) @@ -420,6 +425,8 @@ function OpenCloakroomMenu() else TriggerEvent('skinchanger:loadClothes', skin, jobSkin.skin_female) end + + isOnDuty = true end) end @@ -768,12 +775,13 @@ function OpenShopMenu(elements, restoreCoords, shopCoords) ESX.Game.Teleport(playerPed, restoreCoords) end, function(data, menu) DeleteSpawnedVehicles() - WaitForVehicleToLoad(data.current.model) + ESX.Game.SpawnLocalVehicle(data.current.model, shopCoords, 0.0, function(vehicle) table.insert(spawnedVehicles, vehicle) TaskWarpPedIntoVehicle(playerPed, vehicle, -1) FreezeEntityPosition(vehicle, true) + SetModelAsNoLongerNeeded(data.current.model) end) end) @@ -782,6 +790,7 @@ function OpenShopMenu(elements, restoreCoords, shopCoords) table.insert(spawnedVehicles, vehicle) TaskWarpPedIntoVehicle(playerPed, vehicle, -1) FreezeEntityPosition(vehicle, true) + SetModelAsNoLongerNeeded(elements[1].model) end) end @@ -812,35 +821,19 @@ function WaitForVehicleToLoad(modelHash) if not HasModelLoaded(modelHash) then RequestModel(modelHash) + BeginTextCommandBusyspinnerOn('STRING') + AddTextComponentSubstringPlayerName(_U('vehicleshop_awaiting_model')) + EndTextCommandBusyspinnerOn(4) + while not HasModelLoaded(modelHash) do Citizen.Wait(0) - - DisableControlAction(0, 27, true) - DisableControlAction(0, 173, true) - DisableControlAction(0, 174, true) - DisableControlAction(0, 175, true) - DisableControlAction(0, 176, true) -- ENTER key - DisableControlAction(0, 177, true) - - drawLoadingText(_U('vehicleshop_awaiting_model'), 255, 255, 255, 255) + DisableAllControlActions(0) end + + BusyspinnerOff() end end -function drawLoadingText(text, red, green, blue, alpha) - SetTextFont(4) - SetTextScale(0.0, 0.5) - SetTextColour(red, green, blue, alpha) - SetTextDropshadow(0, 0, 0, 0, 255) - SetTextDropShadow() - SetTextOutline() - SetTextCentre(true) - - BeginTextCommandDisplayText("STRING") - AddTextComponentSubstringPlayerName(text) - EndTextCommandDisplayText(0.5, 0.5) -end - function OpenPharmacyMenu() ESX.UI.Menu.CloseAll() @@ -898,3 +891,34 @@ AddEventHandler('esx_ambulancejob:heal', function(healType, quiet) ESX.ShowNotification(_U('healed')) end end) + +RegisterNetEvent('esx_ambulancejob:setDeadPlayers') +AddEventHandler('esx_ambulancejob:setDeadPlayers', function(_deadPlayers) + deadPlayers = _deadPlayers + + if isOnDuty then + for playerId,v in pairs(deadPlayerBlips) do + RemoveBlip(v) + deadPlayerBlips[playerId] = nil + end + + for playerId,status in pairs(deadPlayers) do + if status == 'distress' then + local player = GetPlayerFromServerId(playerId) + local playerPed = GetPlayerPed(player) + local blip = AddBlipForEntity(playerPed) + + SetBlipSprite(blip, 303) + SetBlipColour(blip, 1) + SetBlipFlashes(blip, true) + SetBlipCategory(blip, 7) + + BeginTextCommandSetBlipName('STRING') + AddTextComponentSubstringPlayerName(_U('blip_dead')) + EndTextCommandSetBlipName(blip) + + deadPlayerBlips[playerId] = blip + end + end + end +end) diff --git a/client/main.lua b/client/main.lua index 517b6483..55f7689c 100644 --- a/client/main.lua +++ b/client/main.lua @@ -109,7 +109,7 @@ AddEventHandler('esx_ambulancejob:useItem', function(itemName) Citizen.Wait(0) DisableAllControlActions(0) end - + TriggerEvent('esx_ambulancejob:heal', 'big', true) ESX.ShowNotification(_U('used_medikit')) end) @@ -151,16 +151,8 @@ function StartDistressSignal() AddTextComponentSubstringPlayerName(_U('distress_send')) EndTextCommandDisplayText(0.175, 0.805) - if IsControlPressed(0, 47) then + if IsControlJustReleased(0, 47) then SendDistressSignal() - - Citizen.CreateThread(function() - Citizen.Wait(1000 * 60 * 5) - if isDead then - StartDistressSignal() - end - end) - break end end @@ -172,11 +164,7 @@ function SendDistressSignal() local coords = GetEntityCoords(playerPed) ESX.ShowNotification(_U('distress_sent')) - TriggerServerEvent('esx_phone:send', 'ambulance', _U('distress_message'), false, { - x = coords.x, - y = coords.y, - z = coords.z - }) + TriggerServerEvent('esx_ambulancejob:onPlayerDistress') end function DrawGenericTextThisFrame() @@ -195,9 +183,9 @@ function secondsToClock(seconds) if seconds <= 0 then return 0, 0 else - local hours = string.format("%02.f", math.floor(seconds / 3600)) - local mins = string.format("%02.f", math.floor(seconds / 60 - (hours * 60))) - local secs = string.format("%02.f", math.floor(seconds - hours * 3600 - mins * 60)) + local hours = string.format('%02.f', math.floor(seconds / 3600)) + local mins = string.format('%02.f', math.floor(seconds / 60 - (hours * 60))) + local secs = string.format('%02.f', math.floor(seconds - hours * 3600 - mins * 60)) return mins, secs end @@ -245,7 +233,7 @@ function StartDeathTimer() DrawGenericTextThisFrame() - SetTextEntry("STRING") + SetTextEntry('STRING') AddTextComponentString(text) DrawText(0.5, 0.8) end @@ -280,11 +268,11 @@ function StartDeathTimer() DrawGenericTextThisFrame() - SetTextEntry("STRING") + SetTextEntry('STRING') AddTextComponentString(text) DrawText(0.5, 0.8) end - + if bleedoutTimer < 1 and isDead then RemoveItemsAfterRPDeath() end diff --git a/locales/br.lua b/locales/br.lua index 3a96cd65..da8db727 100644 --- a/locales/br.lua +++ b/locales/br.lua @@ -77,7 +77,6 @@ Locales['br'] = { ['respawn_bleedout_fine_msg'] = 'você precisa pagar ~r~$%s~s~ para reviver', ['distress_send'] = 'pressione [~b~G~s~] enviar sinal de socorro', ['distress_sent'] = 'sinal de socorro foi enviado para as unidades disponíveis!', - ['distress_message'] = 'atenção médica necessária: cidadão inconsciente!', ['combatlog_message'] = 'você foi revivido porque deixou o servidor anteriormente quando estava morto.', -- Revive ['revive_help'] = 'reviver um cidadão', diff --git a/locales/cs.lua b/locales/cs.lua index 807ad4e2..f3a01344 100644 --- a/locales/cs.lua +++ b/locales/cs.lua @@ -77,7 +77,6 @@ Locales['cs'] = { ['respawn_bleedout_fine_msg'] = 'zaplatili jste ~r~$%s~s~ za respawn.', ['distress_send'] = 'stiskněte [~b~G~s~] pro vyslání tísňového signálu', ['distress_sent'] = 'tísňový signál byl vyslán dostupným jednotkám!', - ['distress_message'] = 'nutná lékařská péče: občan v bezvědomí!', ['combatlog_message'] = 'byli jste násilně oživeni, protože jste předtím opustili server, když jste byli mrtví.', -- Revive ['revive_help'] = 'oživit hráče', diff --git a/locales/en.lua b/locales/en.lua index ab37f814..eee39e22 100644 --- a/locales/en.lua +++ b/locales/en.lua @@ -77,7 +77,6 @@ Locales['en'] = { ['respawn_bleedout_fine_msg'] = 'you paid ~r~$%s~s~ to respawn.', ['distress_send'] = 'press [~b~G~s~] to send distress signal', ['distress_sent'] = 'distress signal has been sent to available units!', - ['distress_message'] = 'medical attention required: unconscious citizen!', ['combatlog_message'] = 'you have been force-respawned because you\'ve previously left the server when dead.', -- Revive ['revive_help'] = 'revive a player', diff --git a/locales/es.lua b/locales/es.lua index caad1d52..a9cec2aa 100644 --- a/locales/es.lua +++ b/locales/es.lua @@ -77,7 +77,6 @@ Locales['es'] = { ['respawn_bleedout_fine_msg'] = 'you paid ~r~$%s~s~ to respawn.', ['distress_send'] = 'press [~b~G~s~] to send distress signal', ['distress_sent'] = 'distress signal has been sent to available units!', - ['distress_message'] = 'medical attention required: unconscious citizen!', ['combatlog_message'] = 'you have been force-respawned because you\'ve previously left the server when dead.', -- Revive ['revive_help'] = 'reviver un jugador', diff --git a/locales/fi.lua b/locales/fi.lua index ecc1b36e..3ca1f5c6 100644 --- a/locales/fi.lua +++ b/locales/fi.lua @@ -77,7 +77,6 @@ Locales['fi'] = { ['respawn_bleedout_fine_msg'] = 'you paid ~r~$%s~s~ to respawn.', ['distress_send'] = 'press [~b~G~s~] to send distress signal', ['distress_sent'] = 'distress signal has been sent to available units!', - ['distress_message'] = 'medical attention required: unconscious citizen!', ['combatlog_message'] = 'you have been force-respawned because you\'ve previously left the server when dead.', -- Revive ['revive_help'] = 'elvytä pelaaja', diff --git a/locales/fr.lua b/locales/fr.lua index 24fb1a4c..e86658c7 100644 --- a/locales/fr.lua +++ b/locales/fr.lua @@ -77,7 +77,6 @@ Locales['fr'] = { ['respawn_bleedout_fine_msg'] = 'vous avez payé ~r~$%s~s~ pour être réanimer.', ['distress_send'] = 'appuyez sur [~b~G~s~] pour envoyer un signal de détresse', ['distress_sent'] = 'un signal a été envoyé à toutes les unités disponibles!', - ['distress_message'] = 'interventtion requise: citoyen inconscient!', ['combatlog_message'] = 'vous avez été réanimé de force car vous avez quitté le serveur.', -- Revive ['revive_help'] = 'relancer un joueur', diff --git a/locales/pl.lua b/locales/pl.lua index 7308e156..9d70f91e 100644 --- a/locales/pl.lua +++ b/locales/pl.lua @@ -77,7 +77,6 @@ Locales['pl'] = { ['respawn_bleedout_fine_msg'] = 'you paid ~r~$%s~s~ to respawn.', ['distress_send'] = 'press [~b~G~s~] to send distress signal', ['distress_sent'] = 'distress signal has been sent to available units!', - ['distress_message'] = 'medical attention required: unconscious citizen!', ['combatlog_message'] = 'you have been force-respawned because you\'ve previously left the server when dead.', -- Revive ['revive_help'] = 'ożyw gracza', diff --git a/locales/sv.lua b/locales/sv.lua index c52d1f33..773a0ebc 100644 --- a/locales/sv.lua +++ b/locales/sv.lua @@ -77,7 +77,6 @@ Locales['sv'] = { ['respawn_bleedout_fine_msg'] = 'du betalade ~r~%s SEK~s~ för att respawna.', ['distress_send'] = 'tryck ~b~[G]~s~ för att skicka nödsignal', ['distress_sent'] = 'nödsignal har skickats till samtliga enheter!', - ['distress_message'] = 'läkarvård krävs: medvetslös medborgare!', ['combatlog_message'] = 'du har force-respawnats på grund av att du lämnat servern medans du var död', -- Revive ['revive_help'] = 'återuppliva en spelare', diff --git a/server/main.lua b/server/main.lua index b9b7afc0..08eff022 100644 --- a/server/main.lua +++ b/server/main.lua @@ -1,8 +1,12 @@ ESX = nil -local playersHealing = {} +local playersHealing, deadPlayers = {}, {} TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) +TriggerEvent('esx_phone:registerNumber', 'ambulance', _U('alert_ambulance'), true, true) + +TriggerEvent('esx_society:registerSociety', 'ambulance', 'Ambulance', 'society_ambulance', 'society_ambulance', 'society_ambulance', {type = 'public'}) + RegisterNetEvent('esx_ambulancejob:revive') AddEventHandler('esx_ambulancejob:revive', function(playerId) local xPlayer = ESX.GetPlayerFromId(source) @@ -11,15 +15,49 @@ AddEventHandler('esx_ambulancejob:revive', function(playerId) local xTarget = ESX.GetPlayerFromId(playerId) if xTarget then - xPlayer.showNotification(_U('revive_complete_award', xTarget.name, Config.ReviveReward)) - xPlayer.addMoney(Config.ReviveReward) - xTarget.triggerEvent('esx_ambulancejob:revive') + if deadPlayers[playerId] then + xPlayer.showNotification(_U('revive_complete_award', xTarget.name, Config.ReviveReward)) + xPlayer.addMoney(Config.ReviveReward) + xTarget.triggerEvent('esx_ambulancejob:revive') + deadPlayers[playerId] = nil + else + xPlayer.showNotification(_U('player_not_unconscious')) + end else xPlayer.showNotification(_U('revive_fail_offline')) end end end) +RegisterNetEvent('esx:onPlayerDeath') +AddEventHandler('esx:onPlayerDeath', function(data) + deadPlayers[source] = 'dead' + TriggerClientEvent('esx_ambulancejob:setDeadPlayers', -1, deadPlayers) +end) + +RegisterNetEvent('esx_ambulancejob:onPlayerDistress') +AddEventHandler('esx_ambulancejob:onPlayerDistress', function() + if deadPlayers[source] then + deadPlayers[source] = 'distress' + TriggerClientEvent('esx_ambulancejob:setDeadPlayers', -1, deadPlayers) + end +end) + +RegisterNetEvent('esx_ambulancejob:onPlayerSpawn') +AddEventHandler('esx_ambulancejob:onPlayerSpawn', function() + if deadPlayers[source] then + deadPlayers[source] = nil + TriggerClientEvent('esx_ambulancejob:setDeadPlayers', -1, deadPlayers) + end +end) + +AddEventHandler('esx:playerDropped', function(playerId, reason) + if deadPlayers[playerId] then + deadPlayers[playerId] = nil + TriggerClientEvent('esx_ambulancejob:setDeadPlayers', -1, deadPlayers) + end +end) + RegisterNetEvent('esx_ambulancejob:heal') AddEventHandler('esx_ambulancejob:heal', function(target, type) local xPlayer = ESX.GetPlayerFromId(source) @@ -38,10 +76,6 @@ AddEventHandler('esx_ambulancejob:putInVehicle', function(target) end end) -TriggerEvent('esx_phone:registerNumber', 'ambulance', _U('alert_ambulance'), true, true) - -TriggerEvent('esx_society:registerSociety', 'ambulance', 'Ambulance', 'society_ambulance', 'society_ambulance', 'society_ambulance', {type = 'public'}) - ESX.RegisterServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function(source, cb) local xPlayer = ESX.GetPlayerFromId(source) From 9a80cd0dcd2c40c46c081e3a93a18fbad6354542 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Fri, 24 Jan 2020 11:19:56 +0100 Subject: [PATCH 146/177] Minor code improvements --- client/job.lua | 51 +++++++++++++++++++++---------------------------- client/main.lua | 2 +- 2 files changed, 23 insertions(+), 30 deletions(-) diff --git a/client/job.lua b/client/job.lua index c0c3c06c..a43f732f 100644 --- a/client/job.lua +++ b/client/job.lua @@ -187,7 +187,6 @@ Citizen.CreateThread(function() local currentHospital, currentPart, currentPartNum for hospitalNum,hospital in pairs(Config.Hospitals) do - -- Ambulance Actions for k,v in ipairs(hospital.AmbulanceActions) do local distance = #(playerCoords - v) @@ -195,10 +194,10 @@ Citizen.CreateThread(function() if distance < Config.DrawDistance then DrawMarker(Config.Marker.type, v, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Config.Marker.x, Config.Marker.y, Config.Marker.z, Config.Marker.r, Config.Marker.g, Config.Marker.b, Config.Marker.a, false, false, 2, Config.Marker.rotate, nil, nil, false) letSleep = false - end - if distance < Config.Marker.x then - isInMarker, currentHospital, currentPart, currentPartNum = true, hospitalNum, 'AmbulanceActions', k + if distance < Config.Marker.x then + isInMarker, currentHospital, currentPart, currentPartNum = true, hospitalNum, 'AmbulanceActions', k + end end end @@ -209,10 +208,10 @@ Citizen.CreateThread(function() if distance < Config.DrawDistance then DrawMarker(Config.Marker.type, v, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Config.Marker.x, Config.Marker.y, Config.Marker.z, Config.Marker.r, Config.Marker.g, Config.Marker.b, Config.Marker.a, false, false, 2, Config.Marker.rotate, nil, nil, false) letSleep = false - end - if distance < Config.Marker.x then - isInMarker, currentHospital, currentPart, currentPartNum = true, hospitalNum, 'Pharmacy', k + if distance < Config.Marker.x then + isInMarker, currentHospital, currentPart, currentPartNum = true, hospitalNum, 'Pharmacy', k + end end end @@ -223,10 +222,10 @@ Citizen.CreateThread(function() if distance < Config.DrawDistance then DrawMarker(v.Marker.type, v.Spawner, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, v.Marker.x, v.Marker.y, v.Marker.z, v.Marker.r, v.Marker.g, v.Marker.b, v.Marker.a, false, false, 2, v.Marker.rotate, nil, nil, false) letSleep = false - end - if distance < v.Marker.x then - isInMarker, currentHospital, currentPart, currentPartNum = true, hospitalNum, 'Vehicles', k + if distance < v.Marker.x then + isInMarker, currentHospital, currentPart, currentPartNum = true, hospitalNum, 'Vehicles', k + end end end @@ -237,10 +236,10 @@ Citizen.CreateThread(function() if distance < Config.DrawDistance then DrawMarker(v.Marker.type, v.Spawner, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, v.Marker.x, v.Marker.y, v.Marker.z, v.Marker.r, v.Marker.g, v.Marker.b, v.Marker.a, false, false, 2, v.Marker.rotate, nil, nil, false) letSleep = false - end - if distance < v.Marker.x then - isInMarker, currentHospital, currentPart, currentPartNum = true, hospitalNum, 'Helicopters', k + if distance < v.Marker.x then + isInMarker, currentHospital, currentPart, currentPartNum = true, hospitalNum, 'Helicopters', k + end end end @@ -251,11 +250,10 @@ Citizen.CreateThread(function() if distance < Config.DrawDistance then DrawMarker(v.Marker.type, v.From, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, v.Marker.x, v.Marker.y, v.Marker.z, v.Marker.r, v.Marker.g, v.Marker.b, v.Marker.a, false, false, 2, v.Marker.rotate, nil, nil, false) letSleep = false - end - - if distance < v.Marker.x then - FastTravel(v.To.coords, v.To.heading) + if distance < v.Marker.x then + FastTravel(v.To.coords, v.To.heading) + end end end @@ -266,18 +264,16 @@ Citizen.CreateThread(function() if distance < Config.DrawDistance then DrawMarker(v.Marker.type, v.From, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, v.Marker.x, v.Marker.y, v.Marker.z, v.Marker.r, v.Marker.g, v.Marker.b, v.Marker.a, false, false, 2, v.Marker.rotate, nil, nil, false) letSleep = false - end - if distance < v.Marker.x then - isInMarker, currentHospital, currentPart, currentPartNum = true, hospitalNum, 'FastTravelsPrompt', k + if distance < v.Marker.x then + isInMarker, currentHospital, currentPart, currentPartNum = true, hospitalNum, 'FastTravelsPrompt', k + end end end - end -- Logic for exiting & entering markers if isInMarker and not HasAlreadyEnteredMarker or (isInMarker and (LastHospital ~= currentHospital or LastPart ~= currentPart or LastPartNum ~= currentPartNum)) then - if (LastHospital ~= nil and LastPart ~= nil and LastPartNum ~= nil) and (LastHospital ~= currentHospital or LastPart ~= currentPart or LastPartNum ~= currentPartNum) @@ -289,7 +285,6 @@ Citizen.CreateThread(function() HasAlreadyEnteredMarker, LastHospital, LastPart, LastPartNum = true, currentHospital, currentPart, currentPartNum TriggerEvent('esx_ambulancejob:hasEnteredMarker', currentHospital, currentPart, currentPartNum) - end if not hasExited and not isInMarker and HasAlreadyEnteredMarker then @@ -348,7 +343,6 @@ Citizen.CreateThread(function() ESX.ShowHelpNotification(CurrentActionMsg) if IsControlJustReleased(0, 38) then - if CurrentAction == 'AmbulanceActions' then OpenAmbulanceActionsMenu() elseif CurrentAction == 'Pharmacy' then @@ -362,10 +356,9 @@ Citizen.CreateThread(function() end CurrentAction = nil - end - elseif ESX.PlayerData.job ~= nil and ESX.PlayerData.job.name == 'ambulance' and not isDead then + elseif ESX.PlayerData.job and ESX.PlayerData.job.name == 'ambulance' and not isDead then if IsControlJustReleased(0, 167) then OpenMobileAmbulanceActionsMenu() end @@ -907,16 +900,16 @@ AddEventHandler('esx_ambulancejob:setDeadPlayers', function(_deadPlayers) local player = GetPlayerFromServerId(playerId) local playerPed = GetPlayerPed(player) local blip = AddBlipForEntity(playerPed) - + SetBlipSprite(blip, 303) SetBlipColour(blip, 1) SetBlipFlashes(blip, true) SetBlipCategory(blip, 7) - + BeginTextCommandSetBlipName('STRING') AddTextComponentSubstringPlayerName(_U('blip_dead')) EndTextCommandSetBlipName(blip) - + deadPlayerBlips[playerId] = blip end end diff --git a/client/main.lua b/client/main.lua index 55f7689c..a73715e7 100644 --- a/client/main.lua +++ b/client/main.lua @@ -138,7 +138,7 @@ function StartDistressSignal() local timer = Config.BleedoutTimer while timer > 0 and isDead do - Citizen.Wait(2) + Citizen.Wait(0) timer = timer - 30 SetTextFont(4) From 24990717bc5b90c125943c9eb416dfc671530554 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Fri, 24 Jan 2020 11:25:25 +0100 Subject: [PATCH 147/177] Fixed #135 --- client/job.lua | 249 ++++++++++++++++++++++++++----------------------- 1 file changed, 133 insertions(+), 116 deletions(-) diff --git a/client/job.lua b/client/job.lua index a43f732f..f6c5eff5 100644 --- a/client/job.lua +++ b/client/job.lua @@ -182,67 +182,120 @@ end Citizen.CreateThread(function() while true do Citizen.Wait(0) - local playerCoords = GetEntityCoords(PlayerPedId()) - local letSleep, isInMarker, hasExited = true, false, false - local currentHospital, currentPart, currentPartNum + + if ESX.PlayerData.job and ESX.PlayerData.job.name == 'ambulance' then + local playerCoords = GetEntityCoords(PlayerPedId()) + local letSleep, isInMarker, hasExited = true, false, false + local currentHospital, currentPart, currentPartNum + + for hospitalNum,hospital in pairs(Config.Hospitals) do + -- Ambulance Actions + for k,v in ipairs(hospital.AmbulanceActions) do + local distance = #(playerCoords - v) + + if distance < Config.DrawDistance then + DrawMarker(Config.Marker.type, v, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Config.Marker.x, Config.Marker.y, Config.Marker.z, Config.Marker.r, Config.Marker.g, Config.Marker.b, Config.Marker.a, false, false, 2, Config.Marker.rotate, nil, nil, false) + letSleep = false + + if distance < Config.Marker.x then + isInMarker, currentHospital, currentPart, currentPartNum = true, hospitalNum, 'AmbulanceActions', k + end + end + end + + -- Pharmacies + for k,v in ipairs(hospital.Pharmacies) do + local distance = #(playerCoords - v) + + if distance < Config.DrawDistance then + DrawMarker(Config.Marker.type, v, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Config.Marker.x, Config.Marker.y, Config.Marker.z, Config.Marker.r, Config.Marker.g, Config.Marker.b, Config.Marker.a, false, false, 2, Config.Marker.rotate, nil, nil, false) + letSleep = false + + if distance < Config.Marker.x then + isInMarker, currentHospital, currentPart, currentPartNum = true, hospitalNum, 'Pharmacy', k + end + end + end + + -- Vehicle Spawners + for k,v in ipairs(hospital.Vehicles) do + local distance = #(playerCoords - v.Spawner) + + if distance < Config.DrawDistance then + DrawMarker(v.Marker.type, v.Spawner, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, v.Marker.x, v.Marker.y, v.Marker.z, v.Marker.r, v.Marker.g, v.Marker.b, v.Marker.a, false, false, 2, v.Marker.rotate, nil, nil, false) + letSleep = false + + if distance < v.Marker.x then + isInMarker, currentHospital, currentPart, currentPartNum = true, hospitalNum, 'Vehicles', k + end + end + end + + -- Helicopter Spawners + for k,v in ipairs(hospital.Helicopters) do + local distance = #(playerCoords - v.Spawner) + + if distance < Config.DrawDistance then + DrawMarker(v.Marker.type, v.Spawner, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, v.Marker.x, v.Marker.y, v.Marker.z, v.Marker.r, v.Marker.g, v.Marker.b, v.Marker.a, false, false, 2, v.Marker.rotate, nil, nil, false) + letSleep = false + + if distance < v.Marker.x then + isInMarker, currentHospital, currentPart, currentPartNum = true, hospitalNum, 'Helicopters', k + end + end + end + + -- Fast Travels (Prompt) + for k,v in ipairs(hospital.FastTravelsPrompt) do + local distance = #(playerCoords - v.From) + + if distance < Config.DrawDistance then + DrawMarker(v.Marker.type, v.From, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, v.Marker.x, v.Marker.y, v.Marker.z, v.Marker.r, v.Marker.g, v.Marker.b, v.Marker.a, false, false, 2, v.Marker.rotate, nil, nil, false) + letSleep = false + + if distance < v.Marker.x then + isInMarker, currentHospital, currentPart, currentPartNum = true, hospitalNum, 'FastTravelsPrompt', k + end + end + end + end + + -- Logic for exiting & entering markers + if isInMarker and not HasAlreadyEnteredMarker or (isInMarker and (LastHospital ~= currentHospital or LastPart ~= currentPart or LastPartNum ~= currentPartNum)) then + if + (LastHospital ~= nil and LastPart ~= nil and LastPartNum ~= nil) and + (LastHospital ~= currentHospital or LastPart ~= currentPart or LastPartNum ~= currentPartNum) + then + TriggerEvent('esx_ambulancejob:hasExitedMarker', LastHospital, LastPart, LastPartNum) + hasExited = true + end + + HasAlreadyEnteredMarker, LastHospital, LastPart, LastPartNum = true, currentHospital, currentPart, currentPartNum + + TriggerEvent('esx_ambulancejob:hasEnteredMarker', currentHospital, currentPart, currentPartNum) + end + + if not hasExited and not isInMarker and HasAlreadyEnteredMarker then + HasAlreadyEnteredMarker = false + TriggerEvent('esx_ambulancejob:hasExitedMarker', LastHospital, LastPart, LastPartNum) + end + + if letSleep then + Citizen.Wait(500) + end + else + Citizen.Wait(500) + end + end +end) + +-- Fast travels +Citizen.CreateThread(function() + while true do + Citizen.Wait(0) + local playerCoords, letSleep = GetEntityCoords(PlayerPedId()), true for hospitalNum,hospital in pairs(Config.Hospitals) do - -- Ambulance Actions - for k,v in ipairs(hospital.AmbulanceActions) do - local distance = #(playerCoords - v) - - if distance < Config.DrawDistance then - DrawMarker(Config.Marker.type, v, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Config.Marker.x, Config.Marker.y, Config.Marker.z, Config.Marker.r, Config.Marker.g, Config.Marker.b, Config.Marker.a, false, false, 2, Config.Marker.rotate, nil, nil, false) - letSleep = false - - if distance < Config.Marker.x then - isInMarker, currentHospital, currentPart, currentPartNum = true, hospitalNum, 'AmbulanceActions', k - end - end - end - - -- Pharmacies - for k,v in ipairs(hospital.Pharmacies) do - local distance = #(playerCoords - v) - - if distance < Config.DrawDistance then - DrawMarker(Config.Marker.type, v, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Config.Marker.x, Config.Marker.y, Config.Marker.z, Config.Marker.r, Config.Marker.g, Config.Marker.b, Config.Marker.a, false, false, 2, Config.Marker.rotate, nil, nil, false) - letSleep = false - - if distance < Config.Marker.x then - isInMarker, currentHospital, currentPart, currentPartNum = true, hospitalNum, 'Pharmacy', k - end - end - end - - -- Vehicle Spawners - for k,v in ipairs(hospital.Vehicles) do - local distance = #(playerCoords - v.Spawner) - - if distance < Config.DrawDistance then - DrawMarker(v.Marker.type, v.Spawner, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, v.Marker.x, v.Marker.y, v.Marker.z, v.Marker.r, v.Marker.g, v.Marker.b, v.Marker.a, false, false, 2, v.Marker.rotate, nil, nil, false) - letSleep = false - - if distance < v.Marker.x then - isInMarker, currentHospital, currentPart, currentPartNum = true, hospitalNum, 'Vehicles', k - end - end - end - - -- Helicopter Spawners - for k,v in ipairs(hospital.Helicopters) do - local distance = #(playerCoords - v.Spawner) - - if distance < Config.DrawDistance then - DrawMarker(v.Marker.type, v.Spawner, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, v.Marker.x, v.Marker.y, v.Marker.z, v.Marker.r, v.Marker.g, v.Marker.b, v.Marker.a, false, false, 2, v.Marker.rotate, nil, nil, false) - letSleep = false - - if distance < v.Marker.x then - isInMarker, currentHospital, currentPart, currentPartNum = true, hospitalNum, 'Helicopters', k - end - end - end - -- Fast Travels for k,v in ipairs(hospital.FastTravels) do local distance = #(playerCoords - v.From) @@ -256,40 +309,6 @@ Citizen.CreateThread(function() end end end - - -- Fast Travels (Prompt) - for k,v in ipairs(hospital.FastTravelsPrompt) do - local distance = #(playerCoords - v.From) - - if distance < Config.DrawDistance then - DrawMarker(v.Marker.type, v.From, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, v.Marker.x, v.Marker.y, v.Marker.z, v.Marker.r, v.Marker.g, v.Marker.b, v.Marker.a, false, false, 2, v.Marker.rotate, nil, nil, false) - letSleep = false - - if distance < v.Marker.x then - isInMarker, currentHospital, currentPart, currentPartNum = true, hospitalNum, 'FastTravelsPrompt', k - end - end - end - end - - -- Logic for exiting & entering markers - if isInMarker and not HasAlreadyEnteredMarker or (isInMarker and (LastHospital ~= currentHospital or LastPart ~= currentPart or LastPartNum ~= currentPartNum)) then - if - (LastHospital ~= nil and LastPart ~= nil and LastPartNum ~= nil) and - (LastHospital ~= currentHospital or LastPart ~= currentPart or LastPartNum ~= currentPartNum) - then - TriggerEvent('esx_ambulancejob:hasExitedMarker', LastHospital, LastPart, LastPartNum) - hasExited = true - end - - HasAlreadyEnteredMarker, LastHospital, LastPart, LastPartNum = true, currentHospital, currentPart, currentPartNum - - TriggerEvent('esx_ambulancejob:hasEnteredMarker', currentHospital, currentPart, currentPartNum) - end - - if not hasExited and not isInMarker and HasAlreadyEnteredMarker then - HasAlreadyEnteredMarker = false - TriggerEvent('esx_ambulancejob:hasExitedMarker', LastHospital, LastPart, LastPartNum) end if letSleep then @@ -299,30 +318,28 @@ Citizen.CreateThread(function() end) AddEventHandler('esx_ambulancejob:hasEnteredMarker', function(hospital, part, partNum) - if ESX.PlayerData.job and ESX.PlayerData.job.name == 'ambulance' then - if part == 'AmbulanceActions' then - CurrentAction = part - CurrentActionMsg = _U('actions_prompt') - CurrentActionData = {} - elseif part == 'Pharmacy' then - CurrentAction = part - CurrentActionMsg = _U('open_pharmacy') - CurrentActionData = {} - elseif part == 'Vehicles' then - CurrentAction = part - CurrentActionMsg = _U('garage_prompt') - CurrentActionData = {hospital = hospital, partNum = partNum} - elseif part == 'Helicopters' then - CurrentAction = part - CurrentActionMsg = _U('helicopter_prompt') - CurrentActionData = {hospital = hospital, partNum = partNum} - elseif part == 'FastTravelsPrompt' then - local travelItem = Config.Hospitals[hospital][part][partNum] + if part == 'AmbulanceActions' then + CurrentAction = part + CurrentActionMsg = _U('actions_prompt') + CurrentActionData = {} + elseif part == 'Pharmacy' then + CurrentAction = part + CurrentActionMsg = _U('open_pharmacy') + CurrentActionData = {} + elseif part == 'Vehicles' then + CurrentAction = part + CurrentActionMsg = _U('garage_prompt') + CurrentActionData = {hospital = hospital, partNum = partNum} + elseif part == 'Helicopters' then + CurrentAction = part + CurrentActionMsg = _U('helicopter_prompt') + CurrentActionData = {hospital = hospital, partNum = partNum} + elseif part == 'FastTravelsPrompt' then + local travelItem = Config.Hospitals[hospital][part][partNum] - CurrentAction = part - CurrentActionMsg = travelItem.Prompt - CurrentActionData = {to = travelItem.To.coords, heading = travelItem.To.heading} - end + CurrentAction = part + CurrentActionMsg = travelItem.Prompt + CurrentActionData = {to = travelItem.To.coords, heading = travelItem.To.heading} end end) From ef171d2ded64ed4c8fc94762c20d46a6b1e72ebe Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Fri, 24 Jan 2020 11:33:53 +0100 Subject: [PATCH 148/177] Minor cleanup, removed unused code --- client/job.lua | 56 +++++++------------------------------------------ client/main.lua | 31 ++++++++++++--------------- 2 files changed, 21 insertions(+), 66 deletions(-) diff --git a/client/job.lua b/client/job.lua index f6c5eff5..c2d8b9f1 100644 --- a/client/job.lua +++ b/client/job.lua @@ -459,11 +459,9 @@ function OpenVehicleSpawnerMenu(hospital, partNum) align = 'top-left', elements = elements }, function(data, menu) - if data.current.action == 'buy_vehicle' then local shopCoords = Config.Hospitals[hospital].Vehicles[partNum].InsideShop local shopElements = {} - local authorizedVehicles = Config.AuthorizedVehicles[ESX.PlayerData.job.grade_name] if #authorizedVehicles > 0 then @@ -476,11 +474,9 @@ function OpenVehicleSpawnerMenu(hospital, partNum) type = 'car' }) end - else - return - end - OpenShopMenu(shopElements, playerCoords, shopCoords) + OpenShopMenu(shopElements, playerCoords, shopCoords) + end elseif data.current.action == 'garage' then local garage = {} @@ -529,20 +525,16 @@ function OpenVehicleSpawnerMenu(hospital, partNum) end, function(data2, menu2) menu2.close() end) - else ESX.ShowNotification(_U('garage_empty')) end end, 'car') - elseif data.current.action == 'store_garage' then StoreNearbyVehicle(playerCoords) end - end, function(data, menu) menu.close() end) - end function StoreNearbyVehicle(playerCoords) @@ -629,22 +621,18 @@ end function OpenHelicopterSpawnerMenu(hospital, partNum) local playerCoords = GetEntityCoords(PlayerPedId()) ESX.PlayerData = ESX.GetPlayerData() - local elements = { - {label = _U('helicopter_garage'), action = 'garage'}, - {label = _U('helicopter_store'), action = 'store_garage'}, - {label = _U('helicopter_buy'), action = 'buy_helicopter'} - } ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'helicopter_spawner', { title = _U('helicopter_title'), align = 'top-left', - elements = elements - }, function(data, menu) - + elements = { + {label = _U('helicopter_garage'), action = 'garage'}, + {label = _U('helicopter_store'), action = 'store_garage'}, + {label = _U('helicopter_buy'), action = 'buy_helicopter'} + }}, function(data, menu) if data.current.action == 'buy_helicopter' then local shopCoords = Config.Hospitals[hospital].Helicopters[partNum].InsideShop local shopElements = {} - local authorizedHelicopters = Config.AuthorizedHelicopters[ESX.PlayerData.job.grade_name] if #authorizedHelicopters > 0 then @@ -711,20 +699,16 @@ function OpenHelicopterSpawnerMenu(hospital, partNum) end, function(data2, menu2) menu2.close() end) - else ESX.ShowNotification(_U('garage_empty')) end end, 'helicopter') - elseif data.current.action == 'store_garage' then StoreNearbyVehicle(playerCoords) end - end, function(data, menu) menu.close() end) - end function OpenShopMenu(elements, restoreCoords, shopCoords) @@ -853,37 +837,13 @@ function OpenPharmacyMenu() elements = { {label = _U('pharmacy_take', _U('medikit')), item = 'medikit', type = 'slider', value = 1, min = 1, max = 100}, {label = _U('pharmacy_take', _U('bandage')), item = 'bandage', type = 'slider', value = 1, min = 1, max = 100} - } - }, function(data, menu) + }}, function(data, menu) TriggerServerEvent('esx_ambulancejob:giveItem', data.current.item, data.current.value) end, function(data, menu) menu.close() end) end -function WarpPedInClosestVehicle(ped) - local coords = GetEntityCoords(ped) - - local vehicle, distance = ESX.Game.GetClosestVehicle(coords) - - if distance ~= -1 and distance <= 5.0 then - local maxSeats, freeSeat = GetVehicleMaxNumberOfPassengers(vehicle) - - for i=maxSeats - 1, 0, -1 do - if IsVehicleSeatFree(vehicle, i) then - freeSeat = i - break - end - end - - if freeSeat then - TaskWarpPedIntoVehicle(ped, vehicle, freeSeat) - end - else - ESX.ShowNotification(_U('no_vehicles')) - end -end - RegisterNetEvent('esx_ambulancejob:heal') AddEventHandler('esx_ambulancejob:heal', function(healType, quiet) local playerPed = PlayerPedId() diff --git a/client/main.lua b/client/main.lua index a73715e7..30f62169 100644 --- a/client/main.lua +++ b/client/main.lua @@ -334,32 +334,27 @@ RegisterNetEvent('esx_ambulancejob:revive') AddEventHandler('esx_ambulancejob:revive', function() local playerPed = PlayerPedId() local coords = GetEntityCoords(playerPed) - TriggerServerEvent('esx_ambulancejob:setDeathStatus', false) - Citizen.CreateThread(function() - DoScreenFadeOut(800) + DoScreenFadeOut(800) - while not IsScreenFadedOut() do - Citizen.Wait(50) - end + while not IsScreenFadedOut() do + Citizen.Wait(50) + end - local formattedCoords = { - x = ESX.Math.Round(coords.x, 1), - y = ESX.Math.Round(coords.y, 1), - z = ESX.Math.Round(coords.z, 1) - } + local formattedCoords = { + x = ESX.Math.Round(coords.x, 1), + y = ESX.Math.Round(coords.y, 1), + z = ESX.Math.Round(coords.z, 1) + } - RespawnPed(playerPed, formattedCoords, 0.0) + RespawnPed(playerPed, formattedCoords, 0.0) - StopScreenEffect('DeathFailOut') - DoScreenFadeIn(800) - end) + StopScreenEffect('DeathFailOut') + DoScreenFadeIn(800) end) -- Load unloaded IPLs if Config.LoadIpl then - Citizen.CreateThread(function() - RequestIpl('Coroner_Int_on') -- Morgue - end) + RequestIpl('Coroner_Int_on') -- Morgue end From d4776bf383120aa55ea7d950066bc549dfca43e1 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Fri, 24 Jan 2020 11:34:44 +0100 Subject: [PATCH 149/177] Removed unused locale --- locales/br.lua | 1 - locales/cs.lua | 1 - locales/en.lua | 1 - locales/es.lua | 1 - locales/fi.lua | 1 - locales/fr.lua | 1 - locales/pl.lua | 1 - locales/sv.lua | 1 - 8 files changed, 8 deletions(-) diff --git a/locales/br.lua b/locales/br.lua index da8db727..4d88eed3 100644 --- a/locales/br.lua +++ b/locales/br.lua @@ -43,7 +43,6 @@ Locales['br'] = { ['heal_inprogress'] = 'você está curando!', ['heal_complete'] = 'você curou ~y~%s~s~', ['no_players'] = 'nenhum cidadão nas proximidades', - ['no_vehicles'] = 'sem veículos nas proximidades', ['player_not_unconscious'] = 'não está inconsciente', ['player_not_conscious'] = 'esse cidadão não está consciente!', -- Boss Menu diff --git a/locales/cs.lua b/locales/cs.lua index f3a01344..5e3690d7 100644 --- a/locales/cs.lua +++ b/locales/cs.lua @@ -43,7 +43,6 @@ Locales['cs'] = { ['heal_inprogress'] = 'uzdravujete!', ['heal_complete'] = 'uzdravili jste ~y~%s~s~', ['no_players'] = 'v okolí není žádný hráč!', - ['no_vehicles'] = 'v okolí není žádné vozidlo', ['player_not_unconscious'] = 'hráč není v bezvědomí!', ['player_not_conscious'] = 'hráč je v bezvědomí!', -- Boss Menu diff --git a/locales/en.lua b/locales/en.lua index eee39e22..14111578 100644 --- a/locales/en.lua +++ b/locales/en.lua @@ -43,7 +43,6 @@ Locales['en'] = { ['heal_inprogress'] = 'you are healing!', ['heal_complete'] = 'you have healed ~y~%s~s~', ['no_players'] = 'no players nearby', - ['no_vehicles'] = 'no vehicles nearby', ['player_not_unconscious'] = 'that player is not unconscious!', ['player_not_conscious'] = 'that player is not conscious!', -- Boss Menu diff --git a/locales/es.lua b/locales/es.lua index a9cec2aa..656a4d53 100644 --- a/locales/es.lua +++ b/locales/es.lua @@ -43,7 +43,6 @@ Locales['es'] = { ['heal_inprogress'] = 'you are healing!', ['heal_complete'] = 'you have healed ~y~%s~s~', ['no_players'] = 'ningún jugador cerca', - ['no_vehicles'] = 'ningún vehículo cerca', ['player_not_unconscious'] = 'n\'estás inconsciente', ['player_not_conscious'] = 'that player is not conscious!', -- Boss Menu diff --git a/locales/fi.lua b/locales/fi.lua index 3ca1f5c6..d98cf398 100644 --- a/locales/fi.lua +++ b/locales/fi.lua @@ -43,7 +43,6 @@ Locales['fi'] = { ['heal_inprogress'] = 'sinä olet parantamassa!', ['heal_complete'] = 'sinä paransit henkilön ~y~%s~s~', ['no_players'] = 'ei pelaajia lähettyvillä', - ['no_vehicles'] = 'ei ajoneuvoja lähettyvillä', ['player_not_unconscious'] = 'tämä pelaaja ei ole tajuton!', ['player_not_conscious'] = 'tämä pelaaja ei ole tajuissaan!', -- Boss Menu diff --git a/locales/fr.lua b/locales/fr.lua index e86658c7..51d558ff 100644 --- a/locales/fr.lua +++ b/locales/fr.lua @@ -43,7 +43,6 @@ Locales['fr'] = { ['heal_inprogress'] = 'vous soignez...', ['heal_complete'] = 'vous avez soigné ~y~%s~s~', ['no_players'] = 'aucun joueur à proximité', - ['no_vehicles'] = 'aucun véhicule à proximité', ['player_not_unconscious'] = 'n\'est pas inconscient', ['player_not_conscious'] = 'Cette personne est inconsciente!', -- Boss Menu diff --git a/locales/pl.lua b/locales/pl.lua index 9d70f91e..007c8383 100644 --- a/locales/pl.lua +++ b/locales/pl.lua @@ -43,7 +43,6 @@ Locales['pl'] = { ['heal_inprogress'] = 'leczysz!', ['heal_complete'] = 'zostałeś uleczony ~y~%s~s~', ['no_players'] = 'brak graczy w pobliżu', - ['no_vehicles'] = 'brak pojazdów w pobliżu', ['player_not_unconscious'] = 'ten gracz nie jest nieprzytomny!', ['player_not_conscious'] = 'ten gracz nie jest świadomy!', -- Boss Menu diff --git a/locales/sv.lua b/locales/sv.lua index 773a0ebc..c7f55b6e 100644 --- a/locales/sv.lua +++ b/locales/sv.lua @@ -43,7 +43,6 @@ Locales['sv'] = { ['heal_inprogress'] = 'du behandlar patienten!', ['heal_complete'] = 'du har behandlat ~y~%s~s~', ['no_players'] = 'det finns inga spelare i närheten!', - ['no_vehicles'] = 'det finns inget fordon i närheten!', ['player_not_unconscious'] = 'spelaren är inte medvetslös!', ['player_not_conscious'] = 'spelaren är inte vid medvetande!', -- Boss Menu From 073cfde650e7c4b2f24326add2a6d68910b835ae Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Fri, 24 Jan 2020 12:11:45 +0100 Subject: [PATCH 150/177] Merged helicopter and car garage, which removes dupe code and move to its own file --- client/job.lua | 388 +-------------------------------------------- client/vehicle.lua | 297 ++++++++++++++++++++++++++++++++++ config.lua | 58 +++---- fxmanifest.lua | 3 +- locales/br.lua | 8 +- locales/cs.lua | 8 +- locales/en.lua | 8 +- locales/es.lua | 8 +- locales/fi.lua | 8 +- locales/fr.lua | 8 +- locales/pl.lua | 8 +- locales/sv.lua | 10 +- server/main.lua | 20 +-- 13 files changed, 346 insertions(+), 486 deletions(-) create mode 100644 client/vehicle.lua diff --git a/client/job.lua b/client/job.lua index c2d8b9f1..2dbeaf01 100644 --- a/client/job.lua +++ b/client/job.lua @@ -1,7 +1,7 @@ local CurrentAction, CurrentActionMsg, CurrentActionData = nil, '', {} local HasAlreadyEnteredMarker, LastHospital, LastPart, LastPartNum local isBusy, deadPlayers, deadPlayerBlips, isOnDuty = false, {}, {}, false -local spawnedVehicles, isInShopMenu = {}, false +isInShopMenu = false function OpenAmbulanceActionsMenu() local elements = { @@ -365,9 +365,9 @@ Citizen.CreateThread(function() elseif CurrentAction == 'Pharmacy' then OpenPharmacyMenu() elseif CurrentAction == 'Vehicles' then - OpenVehicleSpawnerMenu(CurrentActionData.hospital, CurrentActionData.partNum) + OpenVehicleSpawnerMenu('car', CurrentActionData.hospital, CurrentAction, CurrentActionData.partNum) elseif CurrentAction == 'Helicopters' then - OpenHelicopterSpawnerMenu(CurrentActionData.hospital, CurrentActionData.partNum) + OpenVehicleSpawnerMenu('helicopter', CurrentActionData.hospital, CurrentAction, CurrentActionData.partNum) elseif CurrentAction == 'FastTravelsPrompt' then FastTravel(CurrentActionData.to, CurrentActionData.heading) end @@ -446,388 +446,6 @@ function OpenCloakroomMenu() end) end -function OpenVehicleSpawnerMenu(hospital, partNum) - local playerCoords = GetEntityCoords(PlayerPedId()) - local elements = { - {label = _U('garage_storeditem'), action = 'garage'}, - {label = _U('garage_storeitem'), action = 'store_garage'}, - {label = _U('garage_buyitem'), action = 'buy_vehicle'} - } - - ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'vehicle', { - title = _U('garage_title'), - align = 'top-left', - elements = elements - }, function(data, menu) - if data.current.action == 'buy_vehicle' then - local shopCoords = Config.Hospitals[hospital].Vehicles[partNum].InsideShop - local shopElements = {} - local authorizedVehicles = Config.AuthorizedVehicles[ESX.PlayerData.job.grade_name] - - if #authorizedVehicles > 0 then - for k,vehicle in ipairs(authorizedVehicles) do - table.insert(shopElements, { - label = ('%s - %s'):format(vehicle.label, _U('shop_item', ESX.Math.GroupDigits(vehicle.price))), - name = vehicle.label, - model = vehicle.model, - price = vehicle.price, - type = 'car' - }) - end - - OpenShopMenu(shopElements, playerCoords, shopCoords) - end - elseif data.current.action == 'garage' then - local garage = {} - - ESX.TriggerServerCallback('esx_vehicleshop:retrieveJobVehicles', function(jobVehicles) - if #jobVehicles > 0 then - for k,v in ipairs(jobVehicles) do - local props = json.decode(v.vehicle) - local vehicleName = GetLabelText(GetDisplayNameFromVehicleModel(props.model)) - local label = ('%s - %s: '):format(vehicleName, props.plate) - - if v.stored then - label = label .. ('%s'):format(_U('garage_stored')) - else - label = label .. ('%s'):format(_U('garage_notstored')) - end - - table.insert(garage, { - label = label, - stored = v.stored, - model = props.model, - vehicleProps = props - }) - end - - ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'vehicle_garage', { - title = _U('garage_title'), - align = 'top-left', - elements = garage - }, function(data2, menu2) - if data2.current.stored then - local foundSpawn, spawnPoint = GetAvailableVehicleSpawnPoint(hospital, 'Vehicles', partNum) - - if foundSpawn then - menu2.close() - - ESX.Game.SpawnVehicle(data2.current.model, spawnPoint.coords, spawnPoint.heading, function(vehicle) - ESX.Game.SetVehicleProperties(vehicle, data2.current.vehicleProps) - - TriggerServerEvent('esx_vehicleshop:setJobVehicleState', data2.current.vehicleProps.plate, false) - ESX.ShowNotification(_U('garage_released')) - end) - end - else - ESX.ShowNotification(_U('garage_notavailable')) - end - end, function(data2, menu2) - menu2.close() - end) - else - ESX.ShowNotification(_U('garage_empty')) - end - end, 'car') - elseif data.current.action == 'store_garage' then - StoreNearbyVehicle(playerCoords) - end - end, function(data, menu) - menu.close() - end) -end - -function StoreNearbyVehicle(playerCoords) - local vehicles, vehiclePlates = ESX.Game.GetVehiclesInArea(playerCoords, 30.0), {} - - if #vehicles > 0 then - for k,v in ipairs(vehicles) do - - -- Make sure the vehicle we're saving is empty, or else it wont be deleted - if GetVehicleNumberOfPassengers(v) == 0 and IsVehicleSeatFree(v, -1) then - table.insert(vehiclePlates, { - vehicle = v, - plate = ESX.Math.Trim(GetVehicleNumberPlateText(v)) - }) - end - end - else - ESX.ShowNotification(_U('garage_store_nearby')) - return - end - - ESX.TriggerServerCallback('esx_ambulancejob:storeNearbyVehicle', function(storeSuccess, foundNum) - if storeSuccess then - local vehicleId = vehiclePlates[foundNum] - local attempts = 0 - ESX.Game.DeleteVehicle(vehicleId.vehicle) - isBusy = true - - Citizen.CreateThread(function() - while isBusy do - Citizen.Wait(0) - drawLoadingText(_U('garage_storing'), 255, 255, 255, 255) - end - end) - - -- Workaround for vehicle not deleting when other players are near it. - while DoesEntityExist(vehicleId.vehicle) do - Citizen.Wait(500) - attempts = attempts + 1 - - -- Give up - if attempts > 30 then - break - end - - vehicles = ESX.Game.GetVehiclesInArea(playerCoords, 30.0) - if #vehicles > 0 then - for k,v in ipairs(vehicles) do - if ESX.Math.Trim(GetVehicleNumberPlateText(v)) == vehicleId.plate then - ESX.Game.DeleteVehicle(v) - break - end - end - end - end - - isBusy = false - ESX.ShowNotification(_U('garage_has_stored')) - else - ESX.ShowNotification(_U('garage_has_notstored')) - end - end, vehiclePlates) -end - -function GetAvailableVehicleSpawnPoint(hospital, part, partNum) - local spawnPoints = Config.Hospitals[hospital][part][partNum].SpawnPoints - local found, foundSpawnPoint = false, nil - - for i=1, #spawnPoints, 1 do - if ESX.Game.IsSpawnPointClear(spawnPoints[i].coords, spawnPoints[i].radius) then - found, foundSpawnPoint = true, spawnPoints[i] - break - end - end - - if found then - return true, foundSpawnPoint - else - ESX.ShowNotification(_U('garage_blocked')) - return false - end -end - -function OpenHelicopterSpawnerMenu(hospital, partNum) - local playerCoords = GetEntityCoords(PlayerPedId()) - ESX.PlayerData = ESX.GetPlayerData() - - ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'helicopter_spawner', { - title = _U('helicopter_title'), - align = 'top-left', - elements = { - {label = _U('helicopter_garage'), action = 'garage'}, - {label = _U('helicopter_store'), action = 'store_garage'}, - {label = _U('helicopter_buy'), action = 'buy_helicopter'} - }}, function(data, menu) - if data.current.action == 'buy_helicopter' then - local shopCoords = Config.Hospitals[hospital].Helicopters[partNum].InsideShop - local shopElements = {} - local authorizedHelicopters = Config.AuthorizedHelicopters[ESX.PlayerData.job.grade_name] - - if #authorizedHelicopters > 0 then - for k,helicopter in ipairs(authorizedHelicopters) do - table.insert(shopElements, { - label = ('%s - %s'):format(helicopter.label, _U('shop_item', ESX.Math.GroupDigits(helicopter.price))), - name = helicopter.label, - model = helicopter.model, - price = helicopter.price, - type = 'helicopter' - }) - end - else - ESX.ShowNotification(_U('helicopter_notauthorized')) - return - end - - OpenShopMenu(shopElements, playerCoords, shopCoords) - elseif data.current.action == 'garage' then - local garage = {} - - ESX.TriggerServerCallback('esx_vehicleshop:retrieveJobVehicles', function(jobVehicles) - if #jobVehicles > 0 then - for k,v in ipairs(jobVehicles) do - local props = json.decode(v.vehicle) - local vehicleName = GetLabelText(GetDisplayNameFromVehicleModel(props.model)) - local label = ('%s - %s: '):format(vehicleName, props.plate) - - if v.stored then - label = label .. ('%s'):format(_U('garage_stored')) - else - label = label .. ('%s'):format(_U('garage_notstored')) - end - - table.insert(garage, { - label = label, - stored = v.stored, - model = props.model, - vehicleProps = props - }) - end - - ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'helicopter_garage', { - title = _U('helicopter_garage_title'), - align = 'top-left', - elements = garage - }, function(data2, menu2) - if data2.current.stored then - local foundSpawn, spawnPoint = GetAvailableVehicleSpawnPoint(hospital, 'Helicopters', partNum) - - if foundSpawn then - menu2.close() - - ESX.Game.SpawnVehicle(data2.current.model, spawnPoint.coords, spawnPoint.heading, function(vehicle) - ESX.Game.SetVehicleProperties(vehicle, data2.current.vehicleProps) - - TriggerServerEvent('esx_vehicleshop:setJobVehicleState', data2.current.vehicleProps.plate, false) - ESX.ShowNotification(_U('garage_released')) - end) - end - else - ESX.ShowNotification(_U('garage_notavailable')) - end - end, function(data2, menu2) - menu2.close() - end) - else - ESX.ShowNotification(_U('garage_empty')) - end - end, 'helicopter') - elseif data.current.action == 'store_garage' then - StoreNearbyVehicle(playerCoords) - end - end, function(data, menu) - menu.close() - end) -end - -function OpenShopMenu(elements, restoreCoords, shopCoords) - local playerPed = PlayerPedId() - isInShopMenu = true - - ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'vehicle_shop', { - title = _U('vehicleshop_title'), - align = 'top-left', - elements = elements - }, function(data, menu) - ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'vehicle_shop_confirm', { - title = _U('vehicleshop_confirm', data.current.name, data.current.price), - align = 'top-left', - elements = { - {label = _U('confirm_no'), value = 'no'}, - {label = _U('confirm_yes'), value = 'yes'} - }}, function(data2, menu2) - if data2.current.value == 'yes' then - local newPlate = exports['esx_vehicleshop']:GeneratePlate() - local vehicle = GetVehiclePedIsIn(playerPed, false) - local props = ESX.Game.GetVehicleProperties(vehicle) - props.plate = newPlate - - ESX.TriggerServerCallback('esx_ambulancejob:buyJobVehicle', function (bought) - if bought then - ESX.ShowNotification(_U('vehicleshop_bought', data.current.name, ESX.Math.GroupDigits(data.current.price))) - - isInShopMenu = false - ESX.UI.Menu.CloseAll() - - DeleteSpawnedVehicles() - FreezeEntityPosition(playerPed, false) - SetEntityVisible(playerPed, true) - - ESX.Game.Teleport(playerPed, restoreCoords) - else - ESX.ShowNotification(_U('vehicleshop_money')) - menu2.close() - end - end, props, data.current.type) - else - menu2.close() - end - - end, function(data2, menu2) - menu2.close() - end) - - end, function(data, menu) - isInShopMenu = false - ESX.UI.Menu.CloseAll() - - DeleteSpawnedVehicles() - FreezeEntityPosition(playerPed, false) - SetEntityVisible(playerPed, true) - - ESX.Game.Teleport(playerPed, restoreCoords) - end, function(data, menu) - DeleteSpawnedVehicles() - WaitForVehicleToLoad(data.current.model) - - ESX.Game.SpawnLocalVehicle(data.current.model, shopCoords, 0.0, function(vehicle) - table.insert(spawnedVehicles, vehicle) - TaskWarpPedIntoVehicle(playerPed, vehicle, -1) - FreezeEntityPosition(vehicle, true) - SetModelAsNoLongerNeeded(data.current.model) - end) - end) - - WaitForVehicleToLoad(elements[1].model) - ESX.Game.SpawnLocalVehicle(elements[1].model, shopCoords, 0.0, function(vehicle) - table.insert(spawnedVehicles, vehicle) - TaskWarpPedIntoVehicle(playerPed, vehicle, -1) - FreezeEntityPosition(vehicle, true) - SetModelAsNoLongerNeeded(elements[1].model) - end) -end - -Citizen.CreateThread(function() - while true do - Citizen.Wait(0) - - if isInShopMenu then - DisableControlAction(0, 75, true) -- Disable exit vehicle - DisableControlAction(27, 75, true) -- Disable exit vehicle - else - Citizen.Wait(500) - end - end -end) - -function DeleteSpawnedVehicles() - while #spawnedVehicles > 0 do - local vehicle = spawnedVehicles[1] - ESX.Game.DeleteVehicle(vehicle) - table.remove(spawnedVehicles, 1) - end -end - -function WaitForVehicleToLoad(modelHash) - modelHash = (type(modelHash) == 'number' and modelHash or GetHashKey(modelHash)) - - if not HasModelLoaded(modelHash) then - RequestModel(modelHash) - - BeginTextCommandBusyspinnerOn('STRING') - AddTextComponentSubstringPlayerName(_U('vehicleshop_awaiting_model')) - EndTextCommandBusyspinnerOn(4) - - while not HasModelLoaded(modelHash) do - Citizen.Wait(0) - DisableAllControlActions(0) - end - - BusyspinnerOff() - end -end - function OpenPharmacyMenu() ESX.UI.Menu.CloseAll() diff --git a/client/vehicle.lua b/client/vehicle.lua new file mode 100644 index 00000000..39c5ce90 --- /dev/null +++ b/client/vehicle.lua @@ -0,0 +1,297 @@ +local spawnedVehicles = {} + +function OpenVehicleSpawnerMenu(type, hospital, part, partNum) + local playerCoords = GetEntityCoords(PlayerPedId()) + + ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'vehicle', { + title = _U('garage_title'), + align = 'top-left', + elements = { + {label = _U('garage_storeditem'), action = 'garage'}, + {label = _U('garage_storeitem'), action = 'store_garage'}, + {label = _U('garage_buyitem'), action = 'buy_vehicle'} + }}, function(data, menu) + if data.current.action == 'buy_vehicle' then + local shopElements = {} + local authorizedVehicles = Config.AuthorizedVehicles[type][ESX.PlayerData.job.grade_name] + local shopCoords = Config.Hospitals[hospital][part][partNum].InsideShop + + if #authorizedVehicles > 0 then + for k,vehicle in ipairs(authorizedVehicles) do + local vehicleLabel = GetLabelText(GetDisplayNameFromVehicleModel(vehicle.model)) + + table.insert(shopElements, { + label = ('%s - %s'):format(vehicleLabel, _U('shop_item', ESX.Math.GroupDigits(vehicle.price))), + name = vehicleLabel, + model = vehicle.model, + price = vehicle.price, + props = vehicle.props, + type = type + }) + end + + OpenShopMenu(shopElements, playerCoords, shopCoords) + end + elseif data.current.action == 'garage' then + local garage = {} + + ESX.TriggerServerCallback('esx_vehicleshop:retrieveJobVehicles', function(jobVehicles) + if #jobVehicles > 0 then + for k,v in ipairs(jobVehicles) do + local props = json.decode(v.vehicle) + local vehicleName = GetLabelText(GetDisplayNameFromVehicleModel(props.model)) + local label = ('%s - %s: '):format(vehicleName, props.plate) + + if v.stored then + label = label .. ('%s'):format(_U('garage_stored')) + else + label = label .. ('%s'):format(_U('garage_notstored')) + end + + table.insert(garage, { + label = label, + stored = v.stored, + model = props.model, + vehicleProps = props + }) + end + + ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'vehicle_garage', { + title = _U('garage_title'), + align = 'top-left', + elements = garage + }, function(data2, menu2) + if data2.current.stored then + local foundSpawn, spawnPoint = GetAvailableVehicleSpawnPoint(hospital, part, partNum) + + if foundSpawn then + menu2.close() + + ESX.Game.SpawnVehicle(data2.current.model, spawnPoint.coords, spawnPoint.heading, function(vehicle) + ESX.Game.SetVehicleProperties(vehicle, data2.current.vehicleProps) + + TriggerServerEvent('esx_vehicleshop:setJobVehicleState', data2.current.vehicleProps.plate, false) + ESX.ShowNotification(_U('garage_released')) + end) + end + else + ESX.ShowNotification(_U('garage_notavailable')) + end + end, function(data2, menu2) + menu2.close() + end) + else + ESX.ShowNotification(_U('garage_empty')) + end + end, type) + elseif data.current.action == 'store_garage' then + StoreNearbyVehicle(playerCoords) + end + end, function(data, menu) + menu.close() + end) +end + +function StoreNearbyVehicle(playerCoords) + local vehicles, vehiclePlates = ESX.Game.GetVehiclesInArea(playerCoords, 30.0), {} + + if #vehicles > 0 then + for k,v in ipairs(vehicles) do + + -- Make sure the vehicle we're saving is empty, or else it wont be deleted + if GetVehicleNumberOfPassengers(v) == 0 and IsVehicleSeatFree(v, -1) then + table.insert(vehiclePlates, { + vehicle = v, + plate = ESX.Math.Trim(GetVehicleNumberPlateText(v)) + }) + end + end + else + ESX.ShowNotification(_U('garage_store_nearby')) + return + end + + ESX.TriggerServerCallback('esx_ambulancejob:storeNearbyVehicle', function(storeSuccess, foundNum) + if storeSuccess then + local vehicleId = vehiclePlates[foundNum] + local attempts = 0 + ESX.Game.DeleteVehicle(vehicleId.vehicle) + isBusy = true + + Citizen.CreateThread(function() + while isBusy do + Citizen.Wait(0) + drawLoadingText(_U('garage_storing'), 255, 255, 255, 255) + end + end) + + -- Workaround for vehicle not deleting when other players are near it. + while DoesEntityExist(vehicleId.vehicle) do + Citizen.Wait(500) + attempts = attempts + 1 + + -- Give up + if attempts > 30 then + break + end + + vehicles = ESX.Game.GetVehiclesInArea(playerCoords, 30.0) + if #vehicles > 0 then + for k,v in ipairs(vehicles) do + if ESX.Math.Trim(GetVehicleNumberPlateText(v)) == vehicleId.plate then + ESX.Game.DeleteVehicle(v) + break + end + end + end + end + + isBusy = false + ESX.ShowNotification(_U('garage_has_stored')) + else + ESX.ShowNotification(_U('garage_has_notstored')) + end + end, vehiclePlates) +end + +function GetAvailableVehicleSpawnPoint(hospital, part, partNum) + local spawnPoints = Config.Hospitals[hospital][part][partNum].SpawnPoints + local found, foundSpawnPoint = false, nil + + for i=1, #spawnPoints, 1 do + if ESX.Game.IsSpawnPointClear(spawnPoints[i].coords, spawnPoints[i].radius) then + found, foundSpawnPoint = true, spawnPoints[i] + break + end + end + + if found then + return true, foundSpawnPoint + else + ESX.ShowNotification(_U('garage_blocked')) + return false + end +end + +function OpenShopMenu(elements, restoreCoords, shopCoords) + local playerPed = PlayerPedId() + isInShopMenu = true + + ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'vehicle_shop', { + title = _U('vehicleshop_title'), + align = 'top-left', + elements = elements + }, function(data, menu) + ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'vehicle_shop_confirm', { + title = _U('vehicleshop_confirm', data.current.name, data.current.price), + align = 'top-left', + elements = { + {label = _U('confirm_no'), value = 'no'}, + {label = _U('confirm_yes'), value = 'yes'} + }}, function(data2, menu2) + if data2.current.value == 'yes' then + local newPlate = exports['esx_vehicleshop']:GeneratePlate() + local vehicle = GetVehiclePedIsIn(playerPed, false) + local props = ESX.Game.GetVehicleProperties(vehicle) + props.plate = newPlate + + ESX.TriggerServerCallback('esx_ambulancejob:buyJobVehicle', function(bought) + if bought then + ESX.ShowNotification(_U('vehicleshop_bought', data.current.name, ESX.Math.GroupDigits(data.current.price))) + + isInShopMenu = false + ESX.UI.Menu.CloseAll() + + DeleteSpawnedVehicles() + FreezeEntityPosition(playerPed, false) + SetEntityVisible(playerPed, true) + + ESX.Game.Teleport(playerPed, restoreCoords) + else + ESX.ShowNotification(_U('vehicleshop_money')) + menu2.close() + end + end, props, data.current.type) + else + menu2.close() + end + end, function(data2, menu2) + menu2.close() + end) + end, function(data, menu) + isInShopMenu = false + ESX.UI.Menu.CloseAll() + + DeleteSpawnedVehicles() + FreezeEntityPosition(playerPed, false) + SetEntityVisible(playerPed, true) + + ESX.Game.Teleport(playerPed, restoreCoords) + end, function(data, menu) + DeleteSpawnedVehicles() + WaitForVehicleToLoad(data.current.model) + + ESX.Game.SpawnLocalVehicle(data.current.model, shopCoords, 0.0, function(vehicle) + table.insert(spawnedVehicles, vehicle) + TaskWarpPedIntoVehicle(playerPed, vehicle, -1) + FreezeEntityPosition(vehicle, true) + SetModelAsNoLongerNeeded(data.current.model) + + if data.current.props then + ESX.Game.SetVehicleProperties(vehicle, data.current.props) + end + end) + end) + + WaitForVehicleToLoad(elements[1].model) + ESX.Game.SpawnLocalVehicle(elements[1].model, shopCoords, 0.0, function(vehicle) + table.insert(spawnedVehicles, vehicle) + TaskWarpPedIntoVehicle(playerPed, vehicle, -1) + FreezeEntityPosition(vehicle, true) + SetModelAsNoLongerNeeded(elements[1].model) + + if elements[1].props then + ESX.Game.SetVehicleProperties(vehicle, elements[1].props) + end + end) +end + +Citizen.CreateThread(function() + while true do + Citizen.Wait(0) + + if isInShopMenu then + DisableControlAction(0, 75, true) -- Disable exit vehicle + DisableControlAction(27, 75, true) -- Disable exit vehicle + else + Citizen.Wait(500) + end + end +end) + +function DeleteSpawnedVehicles() + while #spawnedVehicles > 0 do + local vehicle = spawnedVehicles[1] + ESX.Game.DeleteVehicle(vehicle) + table.remove(spawnedVehicles, 1) + end +end + +function WaitForVehicleToLoad(modelHash) + modelHash = (type(modelHash) == 'number' and modelHash or GetHashKey(modelHash)) + + if not HasModelLoaded(modelHash) then + RequestModel(modelHash) + + BeginTextCommandBusyspinnerOn('STRING') + AddTextComponentSubstringPlayerName(_U('vehicleshop_awaiting_model')) + EndTextCommandBusyspinnerOn(4) + + while not HasModelLoaded(modelHash) do + Citizen.Wait(0) + DisableAllControlActions(0) + end + + BusyspinnerOff() + end +end diff --git a/config.lua b/config.lua index 20e848f9..7bb21f18 100644 --- a/config.lua +++ b/config.lua @@ -127,37 +127,39 @@ Config.Hospitals = { } Config.AuthorizedVehicles = { - ambulance = { - {model = 'ambulance', label = 'Ambulance Van', price = 5000} + car = { + ambulance = { + {model = 'ambulance', price = 5000} + }, + + doctor = { + {model = 'ambulance', price = 4500} + }, + + chief_doctor = { + {model = 'ambulance', price = 3000} + }, + + boss = { + {model = 'ambulance', price = 2000} + } }, - doctor = { - {model = 'ambulance', label = 'Ambulance Van', price = 4500} - }, + helicopter = { + ambulance = {}, - chief_doctor = { - {model = 'ambulance', label = 'Ambulance Van', price = 3000} - }, + doctor = { + {model = 'buzzard2', price = 150000} + }, - boss = { - {model = 'ambulance', label = 'Ambulance Van', price = 2000} - } -} - -Config.AuthorizedHelicopters = { - ambulance = {}, - - doctor = { - {model = 'buzzard2', label = 'Nagasaki Buzzard', price = 150000} - }, - - chief_doctor = { - {model = 'buzzard2', label = 'Nagasaki Buzzard', price = 150000}, - {model = 'seasparrow', label = 'Sea Sparrow', price = 300000} - }, - - boss = { - {model = 'buzzard2', label = 'Nagasaki Buzzard', price = 10000}, - {model = 'seasparrow', label = 'Sea Sparrow', price = 250000} + chief_doctor = { + {model = 'buzzard2', price = 150000}, + {model = 'seasparrow', price = 300000} + }, + + boss = { + {model = 'buzzard2', price = 10000}, + {model = 'seasparrow', price = 250000} + } } } diff --git a/fxmanifest.lua b/fxmanifest.lua index 7acca84c..ba925897 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -33,7 +33,8 @@ client_scripts { 'locales/cs.lua', 'config.lua', 'client/main.lua', - 'client/job.lua' + 'client/job.lua', + 'client/vehicle.lua', } dependencies { diff --git a/locales/br.lua b/locales/br.lua index 4d88eed3..9e3147d0 100644 --- a/locales/br.lua +++ b/locales/br.lua @@ -6,12 +6,6 @@ Locales['br'] = { -- Vehicles ['ambulance'] = 'ambulancia', ['helicopter_prompt'] = 'pressione ~INPUT_CONTEXT~ para acessar a ~y~Helicopter Actions~s~.', - ['helicopter_buy'] = 'loja de helicóptero', - ['helicopter_garage'] = 'garagem aberta', - ['helicopter_store'] = 'helicóptero da loja entregue na garagem', - ['helicopter_garage_title'] = 'garagem de helicóptero', - ['helicopter_title'] = 'ações do helicóptero', - ['helicopter_notauthorized'] = 'você não está autorizado a comprar helicópteros.', ['garage_prompt'] = 'pressione ~INPUT_CONTEXT~ para entra no ~y~Vehicle Actions~s~.', ['garage_title'] = 'ações do veiculo', ['garage_stored'] = 'guardado', @@ -30,7 +24,7 @@ Locales['br'] = { ['shop_item'] = '$%s', ['vehicleshop_title'] = 'loja de veículos', ['vehicleshop_confirm'] = 'você quer comprar este veículo?', - ['vehicleshop_bought'] = 'você comprou ~y~%s~s~ para ~r~$%s~s~', + ['vehicleshop_bought'] = 'você comprou ~y~%s~s~ para ~g~$%s~s~', ['vehicleshop_money'] = 'você não pode pagar esse veículo', ['vehicleshop_awaiting_model'] = 'o veículo está atualmente ~g~DOWNLOADING & LOADING~s~, por favor aguarde', ['confirm_no'] = 'não', diff --git a/locales/cs.lua b/locales/cs.lua index 5e3690d7..37d65c5a 100644 --- a/locales/cs.lua +++ b/locales/cs.lua @@ -6,12 +6,6 @@ Locales['cs'] = { -- Vehicles ['ambulance'] = 'ambulance', ['helicopter_prompt'] = 'press ~INPUT_CONTEXT~ to access the ~y~Helicopter Actions~s~.', - ['helicopter_buy'] = 'helicopter shop', - ['helicopter_garage'] = 'open garage', - ['helicopter_store'] = 'store helicopter in garage', - ['helicopter_garage_title'] = 'helicopter Garage', - ['helicopter_title'] = 'helicopter Actions', - ['helicopter_notauthorized'] = 'you\'re not authorized to buy helicopters.', ['garage_prompt'] = 'press ~INPUT_CONTEXT~ to access the ~y~Vehicle Actions~s~.', ['garage_title'] = 'vehicle Actions', ['garage_stored'] = 'stored', @@ -30,7 +24,7 @@ Locales['cs'] = { ['shop_item'] = '$%s', ['vehicleshop_title'] = 'vehicle Shop', ['vehicleshop_confirm'] = 'do you want to buy this vehicle?', - ['vehicleshop_bought'] = 'you have bought ~y~%s~s~ for ~r~$%s~s~', + ['vehicleshop_bought'] = 'you have bought ~y~%s~s~ for ~g~$%s~s~', ['vehicleshop_money'] = 'you cannot afford that vehicle', ['vehicleshop_awaiting_model'] = 'the vehicle is currently ~g~DOWNLOADING & LOADING~s~ please wait', ['confirm_no'] = 'no', diff --git a/locales/en.lua b/locales/en.lua index 14111578..5b5f6d24 100644 --- a/locales/en.lua +++ b/locales/en.lua @@ -6,12 +6,6 @@ Locales['en'] = { -- Vehicles ['ambulance'] = 'ambulance', ['helicopter_prompt'] = 'press ~INPUT_CONTEXT~ to access the ~y~Helicopter Actions~s~.', - ['helicopter_buy'] = 'helicopter shop', - ['helicopter_garage'] = 'open garage', - ['helicopter_store'] = 'store helicopter in garage', - ['helicopter_garage_title'] = 'helicopter Garage', - ['helicopter_title'] = 'helicopter Actions', - ['helicopter_notauthorized'] = 'you\'re not authorized to buy helicopters.', ['garage_prompt'] = 'press ~INPUT_CONTEXT~ to access the ~y~Vehicle Actions~s~.', ['garage_title'] = 'vehicle Actions', ['garage_stored'] = 'stored', @@ -30,7 +24,7 @@ Locales['en'] = { ['shop_item'] = '$%s', ['vehicleshop_title'] = 'vehicle Shop', ['vehicleshop_confirm'] = 'do you want to buy this vehicle?', - ['vehicleshop_bought'] = 'you have bought ~y~%s~s~ for ~r~$%s~s~', + ['vehicleshop_bought'] = 'you have bought ~y~%s~s~ for ~g~$%s~s~', ['vehicleshop_money'] = 'you cannot afford that vehicle', ['vehicleshop_awaiting_model'] = 'the vehicle is currently ~g~DOWNLOADING & LOADING~s~ please wait', ['confirm_no'] = 'no', diff --git a/locales/es.lua b/locales/es.lua index 656a4d53..e231db54 100644 --- a/locales/es.lua +++ b/locales/es.lua @@ -6,12 +6,6 @@ Locales['es'] = { -- Vehicles ['ambulance'] = 'ambulance', ['helicopter_prompt'] = 'press ~INPUT_CONTEXT~ to access the ~y~Helicopter Actions~s~.', - ['helicopter_buy'] = 'helicopter shop', - ['helicopter_garage'] = 'open garage', - ['helicopter_store'] = 'store helicopter in garage', - ['helicopter_garage_title'] = 'helicopter Garage', - ['helicopter_title'] = 'helicopter Actions', - ['helicopter_notauthorized'] = 'you\'re not authorized to buy helicopters.', ['garage_prompt'] = 'press ~INPUT_CONTEXT~ to access the ~y~Vehicle Actions~s~.', ['garage_title'] = 'vehicle Actions', ['garage_stored'] = 'stored', @@ -30,7 +24,7 @@ Locales['es'] = { ['shop_item'] = '$%s', ['vehicleshop_title'] = 'vehicle Shop', ['vehicleshop_confirm'] = 'do you want to buy this vehicle?', - ['vehicleshop_bought'] = 'you have bought ~y~%s~s~ for ~r~$%s~s~', + ['vehicleshop_bought'] = 'you have bought ~y~%s~s~ for ~g~$%s~s~', ['vehicleshop_money'] = 'you cannot afford that vehicle', ['vehicleshop_awaiting_model'] = 'the vehicle is currently ~g~DOWNLOADING & LOADING~s~ please wait', ['confirm_no'] = 'no', diff --git a/locales/fi.lua b/locales/fi.lua index d98cf398..9ef6caf8 100644 --- a/locales/fi.lua +++ b/locales/fi.lua @@ -6,12 +6,6 @@ Locales['fi'] = { -- Vehicles ['ambulance'] = 'ambulance', ['helicopter_prompt'] = 'press ~INPUT_CONTEXT~ to access the ~y~Helicopter Actions~s~.', - ['helicopter_buy'] = 'helicopter shop', - ['helicopter_garage'] = 'open garage', - ['helicopter_store'] = 'store helicopter in garage', - ['helicopter_garage_title'] = 'helicopter Garage', - ['helicopter_title'] = 'helicopter Actions', - ['helicopter_notauthorized'] = 'you\'re not authorized to buy helicopters.', ['garage_prompt'] = 'press ~INPUT_CONTEXT~ to access the ~y~Vehicle Actions~s~.', ['garage_title'] = 'vehicle Actions', ['garage_stored'] = 'stored', @@ -30,7 +24,7 @@ Locales['fi'] = { ['shop_item'] = '$%s', ['vehicleshop_title'] = 'vehicle Shop', ['vehicleshop_confirm'] = 'do you want to buy this vehicle?', - ['vehicleshop_bought'] = 'you have bought ~y~%s~s~ for ~r~$%s~s~', + ['vehicleshop_bought'] = 'you have bought ~y~%s~s~ for ~g~$%s~s~', ['vehicleshop_money'] = 'you cannot afford that vehicle', ['vehicleshop_awaiting_model'] = 'the vehicle is currently ~g~DOWNLOADING & LOADING~s~ please wait', ['confirm_no'] = 'no', diff --git a/locales/fr.lua b/locales/fr.lua index 51d558ff..fb750289 100644 --- a/locales/fr.lua +++ b/locales/fr.lua @@ -6,12 +6,6 @@ Locales['fr'] = { -- Vehicles ['ambulance'] = 'ambulance', ['helicopter_prompt'] = 'appuyez sur ~INPUT_CONTEXT~ pour accéder aux ~y~Actions de l\'hélicoptère~s~.', - ['helicopter_buy'] = 'magasin hélicoptère', - ['helicopter_garage'] = 'ouvrir le garage', - ['helicopter_store'] = 'garer l\'hélicoptère dans le garage', - ['helicopter_garage_title'] = 'garage hélicoptère', - ['helicopter_title'] = 'actions hélicoptère', - ['helicopter_notauthorized'] = 'vous n\'êtes pas autorisé à acheter un hélicoptère.', ['garage_prompt'] = 'appuyez sur ~INPUT_CONTEXT~ pour accéder aux ~y~Actions des véhciules~s~.', ['garage_title'] = 'actions véhicules', ['garage_stored'] = 'rangé', @@ -30,7 +24,7 @@ Locales['fr'] = { ['shop_item'] = '$%s', ['vehicleshop_title'] = 'magasin véhicule', ['vehicleshop_confirm'] = 'voulez-vous acheter ce véhicule?', - ['vehicleshop_bought'] = 'vous avez acheté ~y~%s~s~ pour ~r~$%s~s~', + ['vehicleshop_bought'] = 'vous avez acheté ~y~%s~s~ pour ~g~$%s~s~', ['vehicleshop_money'] = 'vous ne pouvez pas acheter ce véhicule', ['vehicleshop_awaiting_model'] = 'le véhicule est actuellement en ~g~PRÉPARATION~s~ veuillez patienter', ['confirm_no'] = 'non', diff --git a/locales/pl.lua b/locales/pl.lua index 007c8383..ebf082c1 100644 --- a/locales/pl.lua +++ b/locales/pl.lua @@ -6,12 +6,6 @@ Locales['pl'] = { -- Vehicles ['ambulance'] = 'ambulance', ['helicopter_prompt'] = 'press ~INPUT_CONTEXT~ to access the ~y~Helicopter Actions~s~.', - ['helicopter_buy'] = 'helicopter shop', - ['helicopter_garage'] = 'open garage', - ['helicopter_store'] = 'store helicopter in garage', - ['helicopter_garage_title'] = 'helicopter Garage', - ['helicopter_title'] = 'helicopter Actions', - ['helicopter_notauthorized'] = 'you\'re not authorized to buy helicopters.', ['garage_prompt'] = 'press ~INPUT_CONTEXT~ to access the ~y~Vehicle Actions~s~.', ['garage_title'] = 'vehicle Actions', ['garage_stored'] = 'stored', @@ -30,7 +24,7 @@ Locales['pl'] = { ['shop_item'] = '$%s', ['vehicleshop_title'] = 'vehicle Shop', ['vehicleshop_confirm'] = 'do you want to buy this vehicle?', - ['vehicleshop_bought'] = 'you have bought ~y~%s~s~ for ~r~$%s~s~', + ['vehicleshop_bought'] = 'you have bought ~y~%s~s~ for ~g~$%s~s~', ['vehicleshop_money'] = 'you cannot afford that vehicle', ['vehicleshop_awaiting_model'] = 'the vehicle is currently ~g~DOWNLOADING & LOADING~s~ please wait', ['confirm_no'] = 'no', diff --git a/locales/sv.lua b/locales/sv.lua index c7f55b6e..b0d736aa 100644 --- a/locales/sv.lua +++ b/locales/sv.lua @@ -5,13 +5,7 @@ Locales['sv'] = { ['ems_clothes_ems'] = 'ambulanskläder', -- Vehicles ['ambulance'] = 'ambulans', - ['helicopter_prompt'] = 'klicka på ~INPUT_CONTEXT~ för att komma åt ~y~garaget~s~.', - ['helicopter_buy'] = 'fordonshandel', - ['helicopter_garage'] = 'öppna garage', - ['helicopter_store'] = 'ställ in helikopter', - ['helicopter_garage_title'] = 'garage', - ['helicopter_title'] = 'garage', - ['helicopter_notauthorized'] = 'du har inte behörighet till att köpa en helikopter.', + ['helicopter_prompt'] = 'tryck ~INPUT_CONTEXT~ för att komma åt ~y~helikoptergaraget~s~.', ['garage_prompt'] = 'tryck ~INPUT_CONTEXT~ för att komma åt ~y~garaget~s~.', ['garage_title'] = 'garage', ['garage_stored'] = 'inställt', @@ -30,7 +24,7 @@ Locales['sv'] = { ['shop_item'] = '%s SEK', ['vehicleshop_title'] = 'fordonshandel', ['vehicleshop_confirm'] = 'vill du köpa detta fordon?', - ['vehicleshop_bought'] = 'du köpte ~y~%s~s~ för ~r~$%s~s~', + ['vehicleshop_bought'] = 'du köpte ~y~%s~s~ för ~g~%s SEK~s~', ['vehicleshop_money'] = 'du har inte råd med detta fordon', ['vehicleshop_awaiting_model'] = 'fordonet ~g~LADDAS NED OCH LADDAS IN~s~ var god vänta', ['confirm_no'] = 'nej', diff --git a/server/main.lua b/server/main.lua index 08eff022..4b24fb5e 100644 --- a/server/main.lua +++ b/server/main.lua @@ -207,22 +207,12 @@ ESX.RegisterServerCallback('esx_ambulancejob:storeNearbyVehicle', function(sourc end end) -function getPriceFromHash(hashKey, jobGrade, type) - if type == 'helicopter' then - local vehicles = Config.AuthorizedHelicopters[jobGrade] +function getPriceFromHash(vehicleHash, jobGrade, type) + local vehicles = Config.AuthorizedVehicles[type][jobGrade] - for k,v in ipairs(vehicles) do - if GetHashKey(v.model) == hashKey then - return v.price - end - end - elseif type == 'car' then - local vehicles = Config.AuthorizedVehicles[jobGrade] - - for k,v in ipairs(vehicles) do - if GetHashKey(v.model) == hashKey then - return v.price - end + for k,v in ipairs(vehicles) do + if GetHashKey(v.model) == vehicleHash then + return v.price end end From a606c2bdd27f047db2f7dc7da7dae08c419da7fb Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Fri, 24 Jan 2020 12:21:11 +0100 Subject: [PATCH 151/177] Fixed NUI limit with too many vehicles in garage --- client/vehicle.lua | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/client/vehicle.lua b/client/vehicle.lua index 39c5ce90..77e14355 100644 --- a/client/vehicle.lua +++ b/client/vehicle.lua @@ -37,6 +37,8 @@ function OpenVehicleSpawnerMenu(type, hospital, part, partNum) ESX.TriggerServerCallback('esx_vehicleshop:retrieveJobVehicles', function(jobVehicles) if #jobVehicles > 0 then + local allVehicleProps = {} + for k,v in ipairs(jobVehicles) do local props = json.decode(v.vehicle) local vehicleName = GetLabelText(GetDisplayNameFromVehicleModel(props.model)) @@ -52,8 +54,10 @@ function OpenVehicleSpawnerMenu(type, hospital, part, partNum) label = label, stored = v.stored, model = props.model, - vehicleProps = props + plate = props.plate }) + + allVehicleProps[props.plate] = props end ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'vehicle_garage', { @@ -68,9 +72,10 @@ function OpenVehicleSpawnerMenu(type, hospital, part, partNum) menu2.close() ESX.Game.SpawnVehicle(data2.current.model, spawnPoint.coords, spawnPoint.heading, function(vehicle) - ESX.Game.SetVehicleProperties(vehicle, data2.current.vehicleProps) + local vehicleProps = allVehicleProps[data2.current.plate] + ESX.Game.SetVehicleProperties(vehicle, vehicleProps) - TriggerServerEvent('esx_vehicleshop:setJobVehicleState', data2.current.vehicleProps.plate, false) + TriggerServerEvent('esx_vehicleshop:setJobVehicleState', data2.current.plate, false) ESX.ShowNotification(_U('garage_released')) end) end From bfb15244d0a8b338e88861fd1afbae446c9585d9 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Fri, 24 Jan 2020 12:29:14 +0100 Subject: [PATCH 152/177] Added IsModelInCdimage() check to garage --- client/vehicle.lua | 103 +++++++++++++++++++++++++-------------------- 1 file changed, 57 insertions(+), 46 deletions(-) diff --git a/client/vehicle.lua b/client/vehicle.lua index 77e14355..a14a6b33 100644 --- a/client/vehicle.lua +++ b/client/vehicle.lua @@ -18,19 +18,23 @@ function OpenVehicleSpawnerMenu(type, hospital, part, partNum) if #authorizedVehicles > 0 then for k,vehicle in ipairs(authorizedVehicles) do - local vehicleLabel = GetLabelText(GetDisplayNameFromVehicleModel(vehicle.model)) + if IsModelInCdimage(vehicle.model) then + local vehicleLabel = GetLabelText(GetDisplayNameFromVehicleModel(vehicle.model)) - table.insert(shopElements, { - label = ('%s - %s'):format(vehicleLabel, _U('shop_item', ESX.Math.GroupDigits(vehicle.price))), - name = vehicleLabel, - model = vehicle.model, - price = vehicle.price, - props = vehicle.props, - type = type - }) + table.insert(shopElements, { + label = ('%s - %s'):format(vehicleLabel, _U('shop_item', ESX.Math.GroupDigits(vehicle.price))), + name = vehicleLabel, + model = vehicle.model, + price = vehicle.price, + props = vehicle.props, + type = type + }) + end end - OpenShopMenu(shopElements, playerCoords, shopCoords) + if #shopElements > 0 then + OpenShopMenu(shopElements, playerCoords, shopCoords) + end end elseif data.current.action == 'garage' then local garage = {} @@ -41,50 +45,57 @@ function OpenVehicleSpawnerMenu(type, hospital, part, partNum) for k,v in ipairs(jobVehicles) do local props = json.decode(v.vehicle) - local vehicleName = GetLabelText(GetDisplayNameFromVehicleModel(props.model)) - local label = ('%s - %s: '):format(vehicleName, props.plate) - if v.stored then - label = label .. ('%s'):format(_U('garage_stored')) - else - label = label .. ('%s'):format(_U('garage_notstored')) + if IsModelInCdimage(props.model) then + local vehicleName = GetLabelText(GetDisplayNameFromVehicleModel(props.model)) + local label = ('%s - %s: '):format(vehicleName, props.plate) + + if v.stored then + label = label .. ('%s'):format(_U('garage_stored')) + else + label = label .. ('%s'):format(_U('garage_notstored')) + end + + table.insert(garage, { + label = label, + stored = v.stored, + model = props.model, + plate = props.plate + }) + + allVehicleProps[props.plate] = props end - - table.insert(garage, { - label = label, - stored = v.stored, - model = props.model, - plate = props.plate - }) - - allVehicleProps[props.plate] = props end - ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'vehicle_garage', { - title = _U('garage_title'), - align = 'top-left', - elements = garage - }, function(data2, menu2) - if data2.current.stored then - local foundSpawn, spawnPoint = GetAvailableVehicleSpawnPoint(hospital, part, partNum) + if #garage > 0 then + ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'vehicle_garage', { + title = _U('garage_title'), + align = 'top-left', + elements = garage + }, function(data2, menu2) + if data2.current.stored then + local foundSpawn, spawnPoint = GetAvailableVehicleSpawnPoint(hospital, part, partNum) - if foundSpawn then - menu2.close() + if foundSpawn then + menu2.close() - ESX.Game.SpawnVehicle(data2.current.model, spawnPoint.coords, spawnPoint.heading, function(vehicle) - local vehicleProps = allVehicleProps[data2.current.plate] - ESX.Game.SetVehicleProperties(vehicle, vehicleProps) + ESX.Game.SpawnVehicle(data2.current.model, spawnPoint.coords, spawnPoint.heading, function(vehicle) + local vehicleProps = allVehicleProps[data2.current.plate] + ESX.Game.SetVehicleProperties(vehicle, vehicleProps) - TriggerServerEvent('esx_vehicleshop:setJobVehicleState', data2.current.plate, false) - ESX.ShowNotification(_U('garage_released')) - end) + TriggerServerEvent('esx_vehicleshop:setJobVehicleState', data2.current.plate, false) + ESX.ShowNotification(_U('garage_released')) + end) + end + else + ESX.ShowNotification(_U('garage_notavailable')) end - else - ESX.ShowNotification(_U('garage_notavailable')) - end - end, function(data2, menu2) - menu2.close() - end) + end, function(data2, menu2) + menu2.close() + end) + else + ESX.ShowNotification(_U('garage_empty')) + end else ESX.ShowNotification(_U('garage_empty')) end From 783a5eeae2a8d45033949fa9ee48393af63c1471 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Thu, 6 Feb 2020 13:06:25 +0100 Subject: [PATCH 153/177] Fixed remove blips on change job, fixed blip not properly registering --- client/job.lua | 17 ++++++++++++++--- client/main.lua | 3 +-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/client/job.lua b/client/job.lua index 2dbeaf01..6802391e 100644 --- a/client/job.lua +++ b/client/job.lua @@ -4,9 +4,7 @@ local isBusy, deadPlayers, deadPlayerBlips, isOnDuty = false, {}, {}, false isInShopMenu = false function OpenAmbulanceActionsMenu() - local elements = { - {label = _U('cloakroom'), value = 'cloakroom'} - } + local elements = {{label = _U('cloakroom'), value = 'cloakroom'}} if Config.EnablePlayerManagement and ESX.PlayerData.job.grade_name == 'boss' then table.insert(elements, {label = _U('boss_actions'), value = 'boss_actions'}) @@ -437,6 +435,7 @@ function OpenCloakroomMenu() end isOnDuty = true + TriggerEvent('esx_ambulancejob:setDeadPlayers', deadPlayers) end) end @@ -480,6 +479,18 @@ AddEventHandler('esx_ambulancejob:heal', function(healType, quiet) end end) +RegisterNetEvent('esx:setJob') +AddEventHandler('esx:setJob', function(job) + if isOnDuty and job ~= 'ambulance' then + for playerId,v in pairs(deadPlayerBlips) do + RemoveBlip(v) + deadPlayerBlips[playerId] = nil + end + + isOnDuty = false + end +end) + RegisterNetEvent('esx_ambulancejob:setDeadPlayers') AddEventHandler('esx_ambulancejob:setDeadPlayers', function(_deadPlayers) deadPlayers = _deadPlayers diff --git a/client/main.lua b/client/main.lua index 30f62169..3b8dcdae 100644 --- a/client/main.lua +++ b/client/main.lua @@ -30,6 +30,7 @@ end) AddEventHandler('playerSpawned', function() isDead = false + TriggerServerEvent('esx_ambulancejob:onPlayerSpawn') if firstSpawn then exports.spawnmanager:setAutoSpawn(false) -- disable respawn @@ -45,8 +46,6 @@ AddEventHandler('playerSpawned', function() RemoveItemsAfterRPDeath() end end) - else - TriggerServerEvent('esx_ambulancejob:onPlayerSpawn') end end) From e8e3eaa4d1c84f5833d92e16878224f8a3fb865f Mon Sep 17 00:00:00 2001 From: Alex Garcio Date: Thu, 13 Feb 2020 16:44:14 -0500 Subject: [PATCH 154/177] Added ability to find an invisible dead player https://github.com/ESX-Org/esx_ambulancejob/issues/20 --- client/job.lua | 7 +++++-- client/main.lua | 37 ++++++++++++++++++++++++++++++++++++- locales/br.lua | 1 + locales/cs.lua | 1 + locales/en.lua | 1 + locales/es.lua | 1 + locales/fi.lua | 1 + locales/fr.lua | 1 + locales/pl.lua | 1 + locales/sv.lua | 1 + server/main.lua | 5 +++++ 11 files changed, 54 insertions(+), 3 deletions(-) diff --git a/client/job.lua b/client/job.lua index 6802391e..c2d977f2 100644 --- a/client/job.lua +++ b/client/job.lua @@ -46,13 +46,16 @@ function OpenMobileAmbulanceActionsMenu() {label = _U('ems_menu_revive'), value = 'revive'}, {label = _U('ems_menu_small'), value = 'small'}, {label = _U('ems_menu_big'), value = 'big'}, - {label = _U('ems_menu_putincar'), value = 'put_in_vehicle'} + {label = _U('ems_menu_putincar'), value = 'put_in_vehicle'}, + {label = _U('ems_menu_search'), value = 'search'} }}, function(data, menu) if isBusy then return end local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() - if closestPlayer == -1 or closestDistance > 1.0 then + if data.current.value == 'search' then + TriggerServerEvent('esx_ambulancejob:svsearch') + elseif closestPlayer == -1 or closestDistance > 1.0 then ESX.ShowNotification(_U('no_players')) else if data.current.value == 'revive' then diff --git a/client/main.lua b/client/main.lua index 3b8dcdae..3746ee40 100644 --- a/client/main.lua +++ b/client/main.lua @@ -1,6 +1,6 @@ local firstSpawn, PlayerLoaded = true, false -isDead = false +isDead, isSearched, medic = false, false, 0 ESX = nil Citizen.CreateThread(function() @@ -81,6 +81,41 @@ Citizen.CreateThread(function() end end) +Citizen.CreateThread(function() + while true do + Citizen.Wait(0) + if isDead and isSearched then + local playerPed = PlayerPedId() + local ped = GetPlayerPed(GetPlayerFromServerId(medic)) + isSearched = false + + AttachEntityToEntity(playerPed, ped, 11816, 0.54, 0.54, 0.0, 0.0, 0.0, 0.0, false, false, false, false, 2, true) + Citizen.Wait(1000) + DetachEntity(playerPed, true, false) + ClearPedTasksImmediately(playerPed) + end + end +end) + +RegisterNetEvent('esx_ambulancejob:clsearch') +AddEventHandler('esx_ambulancejob:clsearch', function(medicId) + local playerPed = PlayerPedId() + + if isDead then + local coords = GetEntityCoords(playerPed) + local playersInArea = ESX.Game.GetPlayersInArea(coords, 50.0) + + for i=1, #playersInArea, 1 do + local player = playersInArea[i] + if player == GetPlayerFromServerId(medicId) then + medic = tonumber(medicId) + isSearched = true + break + end + end + end +end) + function OnPlayerDeath() isDead = true ESX.UI.Menu.CloseAll() diff --git a/locales/br.lua b/locales/br.lua index 9e3147d0..dead693d 100644 --- a/locales/br.lua +++ b/locales/br.lua @@ -60,6 +60,7 @@ Locales['br'] = { ['ems_menu_putincar'] = 'colocar no veiculo', ['ems_menu_small'] = 'curar pequenas feridas', ['ems_menu_big'] = 'tratando lesões graves', + ['ems_menu_search'] = 'paciente não encontrado', -- Phone ['alert_ambulance'] = 'alerta socorrista', -- Death diff --git a/locales/cs.lua b/locales/cs.lua index 37d65c5a..dfc9a125 100644 --- a/locales/cs.lua +++ b/locales/cs.lua @@ -60,6 +60,7 @@ Locales['cs'] = { ['ems_menu_putincar'] = 'naložit do vozidla', ['ems_menu_small'] = 'ošetřit malé zranění', ['ems_menu_big'] = 'ošetřit vážné zranění', + ['ems_menu_search'] = 'pacient nebyl nalezen', -- Phone ['alert_ambulance'] = 'zdravotnický poplach', -- Death diff --git a/locales/en.lua b/locales/en.lua index 5b5f6d24..d00b4ab4 100644 --- a/locales/en.lua +++ b/locales/en.lua @@ -60,6 +60,7 @@ Locales['en'] = { ['ems_menu_putincar'] = 'put in Vehicle', ['ems_menu_small'] = 'heal small wounds', ['ems_menu_big'] = 'treat serious injuries', + ['ems_menu_search'] = 'patient not found', -- Phone ['alert_ambulance'] = 'alert Ambulance', -- Death diff --git a/locales/es.lua b/locales/es.lua index e231db54..afd81dac 100644 --- a/locales/es.lua +++ b/locales/es.lua @@ -60,6 +60,7 @@ Locales['es'] = { ['ems_menu_putincar'] = 'meter en el vehículo', ['ems_menu_small'] = 'heal small wounds', ['ems_menu_big'] = 'treat serious injuries', + ['ems_menu_search'] = 'Paciente no encontrado', -- Phone ['alert_ambulance'] = 'Alerta de ambulancia', -- Death diff --git a/locales/fi.lua b/locales/fi.lua index 9ef6caf8..bc100b14 100644 --- a/locales/fi.lua +++ b/locales/fi.lua @@ -60,6 +60,7 @@ Locales['fi'] = { ['ems_menu_putincar'] = 'Laita ajoneuvoon', ['ems_menu_small'] = 'hoida pieniä haavoja', ['ems_menu_big'] = 'hoida isoja haavoja', + ['ems_menu_search'] = 'potilasta ei löydy', -- Phone ['alert_ambulance'] = 'hälyytys Ensihoidolle', -- Death diff --git a/locales/fr.lua b/locales/fr.lua index fb750289..ce6c7e83 100644 --- a/locales/fr.lua +++ b/locales/fr.lua @@ -60,6 +60,7 @@ Locales['fr'] = { ['ems_menu_putincar'] = 'mettre dans véhicule', ['ems_menu_small'] = 'soigner petites blessures', ['ems_menu_big'] = 'soigner blessures graves', + ['ems_menu_search'] = 'patient introuvable', -- Phone ['alert_ambulance'] = 'alerte Ambulance', -- Death diff --git a/locales/pl.lua b/locales/pl.lua index ebf082c1..80b1378b 100644 --- a/locales/pl.lua +++ b/locales/pl.lua @@ -60,6 +60,7 @@ Locales['pl'] = { ['ems_menu_putincar'] = 'umieścić w pojeździe', ['ems_menu_small'] = 'ulecz małe rany', ['ems_menu_big'] = 'ulecz poważne obrażenia', + ['ems_menu_search'] = 'nie znaleziono pacjenta', -- Phone ['alert_ambulance'] = 'wezwij ambulans', -- Death diff --git a/locales/sv.lua b/locales/sv.lua index b0d736aa..71f4740e 100644 --- a/locales/sv.lua +++ b/locales/sv.lua @@ -60,6 +60,7 @@ Locales['sv'] = { ['ems_menu_putincar'] = 'sätt i fordon', ['ems_menu_small'] = 'behandla mindre skador', ['ems_menu_big'] = 'behandla svåra skador', + ['ems_menu_search'] = 'patienten hittades inte', -- Phone ['alert_ambulance'] = 'ambulanssamtal', -- Death diff --git a/server/main.lua b/server/main.lua index 4b24fb5e..eb92dfdc 100644 --- a/server/main.lua +++ b/server/main.lua @@ -35,6 +35,11 @@ AddEventHandler('esx:onPlayerDeath', function(data) TriggerClientEvent('esx_ambulancejob:setDeadPlayers', -1, deadPlayers) end) +RegisterServerEvent('esx_ambulancejob:svsearch') +AddEventHandler('esx_ambulancejob:svsearch', function() + TriggerClientEvent('esx_ambulancejob:clsearch', -1, source) +end) + RegisterNetEvent('esx_ambulancejob:onPlayerDistress') AddEventHandler('esx_ambulancejob:onPlayerDistress', function() if deadPlayers[source] then From 739a228dd28bab665033b6ed97839ef2889572b2 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Mon, 17 Feb 2020 21:15:52 +0100 Subject: [PATCH 155/177] Updated to work with latest ESX --- client/main.lua | 20 +++++++++++--------- server/main.lua | 29 ++++++++++------------------- 2 files changed, 21 insertions(+), 28 deletions(-) diff --git a/client/main.lua b/client/main.lua index 3b8dcdae..2298cbb1 100644 --- a/client/main.lua +++ b/client/main.lua @@ -36,16 +36,18 @@ AddEventHandler('playerSpawned', function() exports.spawnmanager:setAutoSpawn(false) -- disable respawn firstSpawn = false - ESX.TriggerServerCallback('esx_ambulancejob:getDeathStatus', function(shouldDie) - if shouldDie and Config.AntiCombatLog then - while not PlayerLoaded do - Citizen.Wait(1000) - end - - ESX.ShowNotification(_U('combatlog_message')) - RemoveItemsAfterRPDeath() + if Config.AntiCombatLog then + while not PlayerLoaded do + Citizen.Wait(1000) end - end) + + ESX.TriggerServerCallback('esx_ambulancejob:getDeathStatus', function(shouldDie) + if shouldDie then + ESX.ShowNotification(_U('combatlog_message')) + RemoveItemsAfterRPDeath() + end + end) + end end end) diff --git a/server/main.lua b/server/main.lua index 4b24fb5e..57fed8ae 100644 --- a/server/main.lua +++ b/server/main.lua @@ -250,20 +250,11 @@ AddEventHandler('esx_ambulancejob:giveItem', function(itemName, amount) end end) -TriggerEvent('es:addGroupCommand', 'revive', 'admin', function(source, args, user) - if args[1] then - local playerId = tonumber(args[1]) - if playerId and ESX.GetPlayerFromId(playerId) then - TriggerClientEvent('esx_ambulancejob:revive', playerId) - else - TriggerClientEvent('chat:addMessage', source, { args = { '^1SYSTEM', 'Player not online.' } }) - end - else - TriggerClientEvent('esx_ambulancejob:revive', source) - end -end, function(source, args, user) - TriggerClientEvent('chat:addMessage', source, { args = { '^1SYSTEM', 'Insufficient Permissions.' } }) -end, { help = _U('revive_help'), params = {{ name = 'playerId' }} }) +ESX.RegisterCommand('revive', 'admin', function(xPlayer, args, showError) + args.playerId.triggerEvent('esx_ambulancejob:revive') +end, true, {help = _U('revive_help'), validate = true, arguments = { + {name = 'playerId', help = 'The player id', type = 'player'} +}}) ESX.RegisterUsableItem('medikit', function(source) if not playersHealing[source] then @@ -292,13 +283,13 @@ ESX.RegisterUsableItem('bandage', function(source) end) ESX.RegisterServerCallback('esx_ambulancejob:getDeathStatus', function(source, cb) - local identifier = GetPlayerIdentifiers(source)[1] + local xPlayer = ESX.GetPlayerFromId(source) MySQL.Async.fetchScalar('SELECT is_dead FROM users WHERE identifier = @identifier', { - ['@identifier'] = identifier + ['@identifier'] = xPlayer.identifier }, function(isDead) if isDead then - print(('[esx_ambulancejob] [^2INFO^7] "%s" attempted combat logging'):format(identifier)) + print(('[esx_ambulancejob] [^2INFO^7] "%s" attempted combat logging'):format(xPlayer.identifier)) end cb(isDead) @@ -307,11 +298,11 @@ end) RegisterNetEvent('esx_ambulancejob:setDeathStatus') AddEventHandler('esx_ambulancejob:setDeathStatus', function(isDead) - local identifier = GetPlayerIdentifiers(source)[1] + local xPlayer = ESX.GetPlayerFromId(source) if type(isDead) == 'boolean' then MySQL.Sync.execute('UPDATE users SET is_dead = @isDead WHERE identifier = @identifier', { - ['@identifier'] = identifier, + ['@identifier'] = xPlayer.identifier, ['@isDead'] = isDead }) end From 2da17bc123378100147803906bc4e805c610dab4 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Tue, 24 Mar 2020 10:33:56 +0100 Subject: [PATCH 156/177] Support latest esx --- client/main.lua | 9 ++++----- server/main.lua | 4 ++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/client/main.lua b/client/main.lua index 2298cbb1..3596a306 100644 --- a/client/main.lua +++ b/client/main.lua @@ -28,12 +28,10 @@ AddEventHandler('esx:setJob', function(job) ESX.PlayerData.job = job end) -AddEventHandler('playerSpawned', function() +AddEventHandler('esx:onPlayerSpawn', function() isDead = false - TriggerServerEvent('esx_ambulancejob:onPlayerSpawn') if firstSpawn then - exports.spawnmanager:setAutoSpawn(false) -- disable respawn firstSpawn = false if Config.AntiCombatLog then @@ -310,10 +308,11 @@ function RespawnPed(ped, coords, heading) SetEntityCoordsNoOffset(ped, coords.x, coords.y, coords.z, false, false, false, true) NetworkResurrectLocalPlayer(coords.x, coords.y, coords.z, heading, true, false) SetPlayerInvincible(ped, false) - TriggerEvent('playerSpawned', coords.x, coords.y, coords.z) ClearPedBloodDamage(ped) - ESX.UI.Menu.CloseAll() + TriggerServerEvent('esx:onPlayerSpawn') + TriggerEvent('esx:onPlayerSpawn') + TriggerEvent('playerSpawned') -- compatibility with old scripts, will be removed soon end RegisterNetEvent('esx_phone:loaded') diff --git a/server/main.lua b/server/main.lua index 57fed8ae..664d7457 100644 --- a/server/main.lua +++ b/server/main.lua @@ -43,8 +43,8 @@ AddEventHandler('esx_ambulancejob:onPlayerDistress', function() end end) -RegisterNetEvent('esx_ambulancejob:onPlayerSpawn') -AddEventHandler('esx_ambulancejob:onPlayerSpawn', function() +RegisterNetEvent('esx:onPlayerSpawn') +AddEventHandler('esx:onPlayerSpawn', function() if deadPlayers[source] then deadPlayers[source] = nil TriggerClientEvent('esx_ambulancejob:setDeadPlayers', -1, deadPlayers) From 32a7fb15de083de3ac6801b669cff179162c1e5b Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Tue, 14 Apr 2020 16:47:41 +0200 Subject: [PATCH 157/177] New sql code --- esx_ambulancejob.sql | 2 +- localization/br_esx_ambulancejob.sql | 2 +- localization/cs_esx_ambulancejob.sql | 2 +- localization/de_esx_ambulancejob.sql | 2 +- localization/en_esx_ambulancejob.sql | 2 +- localization/fi_esx_ambulancejob.sql | 2 +- localization/pl_esx_ambulancejob.sql | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/esx_ambulancejob.sql b/esx_ambulancejob.sql index c7a4097e..09c3d72b 100644 --- a/esx_ambulancejob.sql +++ b/esx_ambulancejob.sql @@ -1,4 +1,4 @@ -USE `essentialmode`; +USE `es_extended`; INSERT INTO `addon_account` (name, label, shared) VALUES ('society_ambulance', 'Ambulance', 1) diff --git a/localization/br_esx_ambulancejob.sql b/localization/br_esx_ambulancejob.sql index 98357560..0665e65e 100644 --- a/localization/br_esx_ambulancejob.sql +++ b/localization/br_esx_ambulancejob.sql @@ -1,4 +1,4 @@ -USE `essentialmode`; +USE `es_extended`; INSERT INTO `addon_account` (name, label, shared) VALUES ('society_ambulance', 'EMS', 1) diff --git a/localization/cs_esx_ambulancejob.sql b/localization/cs_esx_ambulancejob.sql index b5264a06..9f51a9ec 100644 --- a/localization/cs_esx_ambulancejob.sql +++ b/localization/cs_esx_ambulancejob.sql @@ -1,4 +1,4 @@ -USE `essentialmode`; +USE `es_extended`; INSERT INTO `addon_account` (name, label, shared) VALUES ('society_ambulance', 'Záchranka', 1) diff --git a/localization/de_esx_ambulancejob.sql b/localization/de_esx_ambulancejob.sql index bd1ff039..e902c92c 100644 --- a/localization/de_esx_ambulancejob.sql +++ b/localization/de_esx_ambulancejob.sql @@ -1,4 +1,4 @@ -USE `essentialmode`; +USE `es_extended`; INSERT INTO `addon_account` (name, label, shared) VALUES ('society_ambulance', 'Notdienst', 1) diff --git a/localization/en_esx_ambulancejob.sql b/localization/en_esx_ambulancejob.sql index 6ba8b1a6..bec419d8 100644 --- a/localization/en_esx_ambulancejob.sql +++ b/localization/en_esx_ambulancejob.sql @@ -1,4 +1,4 @@ -USE `essentialmode`; +USE `es_extended`; INSERT INTO `addon_account` (name, label, shared) VALUES ('society_ambulance', 'EMS', 1) diff --git a/localization/fi_esx_ambulancejob.sql b/localization/fi_esx_ambulancejob.sql index 1508ad3d..c4e4e286 100644 --- a/localization/fi_esx_ambulancejob.sql +++ b/localization/fi_esx_ambulancejob.sql @@ -1,4 +1,4 @@ -USE `essentialmode`; +USE `es_extended`; INSERT INTO `addon_account` (name, label, shared) VALUES ('society_ambulance', 'Ensihoito', 1) diff --git a/localization/pl_esx_ambulancejob.sql b/localization/pl_esx_ambulancejob.sql index 2f52bad6..c739fefa 100644 --- a/localization/pl_esx_ambulancejob.sql +++ b/localization/pl_esx_ambulancejob.sql @@ -1,4 +1,4 @@ -USE `essentialmode`; +USE `es_extended`; INSERT INTO `addon_account` (name, label, shared) VALUES ('society_ambulance', 'Ambulance', 1) From fa22df84ac31096a8aa13738cd727d359c1feffc Mon Sep 17 00:00:00 2001 From: LeonAnderson48 <63073120+LeonAnderson48@users.noreply.github.com> Date: Thu, 14 May 2020 17:07:29 +0100 Subject: [PATCH 158/177] Add files via upload --- main.lua | 360 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 360 insertions(+) create mode 100644 main.lua diff --git a/main.lua b/main.lua new file mode 100644 index 00000000..988e98eb --- /dev/null +++ b/main.lua @@ -0,0 +1,360 @@ +local firstSpawn, PlayerLoaded = true, false + +isDead = false +ESX = nil + +Citizen.CreateThread(function() + while ESX == nil do + TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) + Citizen.Wait(0) + end + + while ESX.GetPlayerData().job == nil do + Citizen.Wait(100) + end + + PlayerLoaded = true + ESX.PlayerData = ESX.GetPlayerData() +end) + +RegisterNetEvent('esx:playerLoaded') +AddEventHandler('esx:playerLoaded', function(xPlayer) + ESX.PlayerData = xPlayer + PlayerLoaded = true +end) + +RegisterNetEvent('esx:setJob') +AddEventHandler('esx:setJob', function(job) + ESX.PlayerData.job = job +end) + +AddEventHandler('esx:onPlayerSpawn', function() + isDead = false + + if firstSpawn then + firstSpawn = false + + if Config.AntiCombatLog then + while not PlayerLoaded do + Citizen.Wait(5000) + end + + ESX.TriggerServerCallback('esx_ambulancejob:getDeathStatus', function(shouldDie) + if shouldDie then + Citizen.Wait(10000) + SetEntityHealth(PlayerPedId(), 0) + end + end) + end + end +end) + +-- Create blips +Citizen.CreateThread(function() + for k,v in pairs(Config.Hospitals) do + local blip = AddBlipForCoord(v.Blip.coords) + + SetBlipSprite(blip, v.Blip.sprite) + SetBlipScale(blip, v.Blip.scale) + SetBlipColour(blip, v.Blip.color) + SetBlipAsShortRange(blip, true) + + BeginTextCommandSetBlipName('STRING') + AddTextComponentSubstringPlayerName(_U('blip_hospital')) + EndTextCommandSetBlipName(blip) + end +end) + +-- Disable most inputs when dead +Citizen.CreateThread(function() + while true do + Citizen.Wait(0) + + if isDead then + DisableAllControlActions(0) + EnableControlAction(0, 47, true) + EnableControlAction(0, 245, true) + EnableControlAction(0, 38, true) + else + Citizen.Wait(500) + end + end +end) + +function OnPlayerDeath() + isDead = true + ESX.UI.Menu.CloseAll() + TriggerServerEvent('esx_ambulancejob:setDeathStatus', true) + + StartDeathTimer() + StartDistressSignal() + + StartScreenEffect('DeathFailOut', 0, false) +end + +RegisterNetEvent('esx_ambulancejob:useItem') +AddEventHandler('esx_ambulancejob:useItem', function(itemName) + ESX.UI.Menu.CloseAll() + + if itemName == 'medikit' then + local lib, anim = 'anim@heists@narcotics@funding@gang_idle', 'gang_chatting_idle01' -- TODO better animations + local playerPed = PlayerPedId() + + ESX.Streaming.RequestAnimDict(lib, function() + TaskPlayAnim(playerPed, lib, anim, 8.0, -8.0, -1, 0, 0, false, false, false) + + Citizen.Wait(500) + while IsEntityPlayingAnim(playerPed, lib, anim, 3) do + Citizen.Wait(0) + DisableAllControlActions(0) + end + + TriggerEvent('esx_ambulancejob:heal', 'big', true) + ESX.ShowNotification(_U('used_medikit')) + end) + + elseif itemName == 'bandage' then + local lib, anim = 'anim@heists@narcotics@funding@gang_idle', 'gang_chatting_idle01' -- TODO better animations + local playerPed = PlayerPedId() + + ESX.Streaming.RequestAnimDict(lib, function() + TaskPlayAnim(playerPed, lib, anim, 8.0, -8.0, -1, 0, 0, false, false, false) + + Citizen.Wait(500) + while IsEntityPlayingAnim(playerPed, lib, anim, 3) do + Citizen.Wait(0) + DisableAllControlActions(0) + end + + TriggerEvent('esx_ambulancejob:heal', 'small', true) + ESX.ShowNotification(_U('used_bandage')) + end) + end +end) + +function StartDistressSignal() + Citizen.CreateThread(function() + local timer = Config.BleedoutTimer + + while timer > 0 and isDead do + Citizen.Wait(0) + timer = timer - 30 + + SetTextFont(4) + SetTextScale(0.45, 0.45) + SetTextColour(185, 185, 185, 255) + SetTextDropshadow(0, 0, 0, 0, 255) + SetTextDropShadow() + SetTextOutline() + BeginTextCommandDisplayText('STRING') + AddTextComponentSubstringPlayerName(_U('distress_send')) + EndTextCommandDisplayText(0.175, 0.805) + + if IsControlJustReleased(0, 47) then + SendDistressSignal() + break + end + end + end) +end + +function SendDistressSignal() + local playerPed = PlayerPedId() + local coords = GetEntityCoords(playerPed) + + ESX.ShowNotification(_U('distress_sent')) + TriggerServerEvent('esx_ambulancejob:onPlayerDistress') +end + +function DrawGenericTextThisFrame() + SetTextFont(4) + SetTextScale(0.0, 0.5) + SetTextColour(255, 255, 255, 255) + SetTextDropshadow(0, 0, 0, 0, 255) + SetTextDropShadow() + SetTextOutline() + SetTextCentre(true) +end + +function secondsToClock(seconds) + local seconds, hours, mins, secs = tonumber(seconds), 0, 0, 0 + + if seconds <= 0 then + return 0, 0 + else + local hours = string.format('%02.f', math.floor(seconds / 3600)) + local mins = string.format('%02.f', math.floor(seconds / 60 - (hours * 60))) + local secs = string.format('%02.f', math.floor(seconds - hours * 3600 - mins * 60)) + + return mins, secs + end +end + +function StartDeathTimer() + local canPayFine = false + + if Config.EarlyRespawnFine then + ESX.TriggerServerCallback('esx_ambulancejob:checkBalance', function(canPay) + canPayFine = canPay + end) + end + + local earlySpawnTimer = ESX.Math.Round(Config.EarlyRespawnTimer / 1000) + local bleedoutTimer = ESX.Math.Round(Config.BleedoutTimer / 1000) + + Citizen.CreateThread(function() + -- early respawn timer + while earlySpawnTimer > 0 and isDead do + Citizen.Wait(1000) + + if earlySpawnTimer > 0 then + earlySpawnTimer = earlySpawnTimer - 1 + end + end + + -- bleedout timer + while bleedoutTimer > 0 and isDead do + Citizen.Wait(1000) + + if bleedoutTimer > 0 then + bleedoutTimer = bleedoutTimer - 1 + end + end + end) + + Citizen.CreateThread(function() + local text, timeHeld + + -- early respawn timer + while earlySpawnTimer > 0 and isDead do + Citizen.Wait(0) + text = _U('respawn_available_in', secondsToClock(earlySpawnTimer)) + + DrawGenericTextThisFrame() + + SetTextEntry('STRING') + AddTextComponentString(text) + DrawText(0.5, 0.8) + end + + -- bleedout timer + while bleedoutTimer > 0 and isDead do + Citizen.Wait(0) + text = _U('respawn_bleedout_in', secondsToClock(bleedoutTimer)) + + if not Config.EarlyRespawnFine then + text = text .. _U('respawn_bleedout_prompt') + + if IsControlPressed(0, 38) and timeHeld > 60 then + RemoveItemsAfterRPDeath() + break + end + elseif Config.EarlyRespawnFine and canPayFine then + text = text .. _U('respawn_bleedout_fine', ESX.Math.GroupDigits(Config.EarlyRespawnFineAmount)) + + if IsControlPressed(0, 38) and timeHeld > 60 then + TriggerServerEvent('esx_ambulancejob:payFine') + RemoveItemsAfterRPDeath() + break + end + end + + if IsControlPressed(0, 38) then + timeHeld = timeHeld + 1 + else + timeHeld = 0 + end + + DrawGenericTextThisFrame() + + SetTextEntry('STRING') + AddTextComponentString(text) + DrawText(0.5, 0.8) + end + + if bleedoutTimer < 1 and isDead then + RemoveItemsAfterRPDeath() + end + end) +end + +function RemoveItemsAfterRPDeath() + TriggerServerEvent('esx_ambulancejob:setDeathStatus', false) + + Citizen.CreateThread(function() + DoScreenFadeOut(800) + + while not IsScreenFadedOut() do + Citizen.Wait(10) + end + + ESX.TriggerServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function() + local formattedCoords = { + x = Config.RespawnPoint.coords.x, + y = Config.RespawnPoint.coords.y, + z = Config.RespawnPoint.coords.z + } + + ESX.SetPlayerData('loadout', {}) + RespawnPed(PlayerPedId(), formattedCoords, Config.RespawnPoint.heading) + + StopScreenEffect('DeathFailOut') + DoScreenFadeIn(800) + end) + end) +end + +function RespawnPed(ped, coords, heading) + SetEntityCoordsNoOffset(ped, coords.x, coords.y, coords.z, false, false, false, true) + NetworkResurrectLocalPlayer(coords.x, coords.y, coords.z, heading, true, false) + SetPlayerInvincible(ped, false) + ClearPedBloodDamage(ped) + + TriggerServerEvent('esx:onPlayerSpawn') + TriggerEvent('esx:onPlayerSpawn') + TriggerEvent('playerSpawned') -- compatibility with old scripts, will be removed soon +end + +RegisterNetEvent('esx_phone:loaded') +AddEventHandler('esx_phone:loaded', function(phoneNumber, contacts) + local specialContact = { + name = 'Ambulance', + number = 'ambulance', + base64Icon = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEwAACxMBAJqcGAAABp5JREFUWIW1l21sFNcVhp/58npn195de23Ha4Mh2EASSvk0CPVHmmCEI0RCTQMBKVVooxYoalBVCVokICWFVFVEFeKoUdNECkZQIlAoFGMhIkrBQGxHwhAcChjbeLcsYHvNfsx+zNz+MBDWNrYhzSvdP+e+c973XM2cc0dihFi9Yo6vSzN/63dqcwPZcnEwS9PDmYoE4IxZIj+ciBb2mteLwlZdfji+dXtNU2AkeaXhCGteLZ/X/IS64/RoR5mh9tFVAaMiAldKQUGiRzFp1wXJPj/YkxblbfFLT/tjq9/f1XD0sQyse2li7pdP5tYeLXXMMGUojAiWKeOodE1gqpmNfN2PFeoF00T2uLGKfZzTwhzqbaEmeYWAQ0K1oKIlfPb7t+7M37aruXvEBlYvnV7xz2ec/2jNs9kKooKNjlksiXhJfLqf1PXOIU9M8fmw/XgRu523eTNyhhu6xLjbSeOFC6EX3t3V9PmwBla9Vv7K7u85d3bpqlwVcvHn7B8iVX+IFQoNKdwfstuFtWoFvwp9zj5XL7nRlPXyudjS9z+u35tmuH/lu6dl7+vSVXmDUcpbX+skP65BxOOPJA4gjDicOM2PciejeTwcsYek1hyl6me5nhNnmwPXBhjYuGC699OpzoaAO0PbYJSy5vgt4idOPrJwf6QuX2FO0oOtqIgj9pDU5dCWrMlyvXf86xsGgHyPeLos83Brns1WFXLxxgVBorHpW4vfQ6KhkbUtCot6srns1TLPjNVr7+1J0PepVc92H/Eagkb7IsTWd4ZMaN+yCXv5zLRY9GQ9xuYtQz4nfreWGdH9dNlkfnGq5/kdO88ekwGan1B3mDJsdMxCqv5w2Iq0khLs48vSllrsG/Y5pfojNugzScnQXKBVA8hrX51ddHq0o6wwIlgS8Y7obZdUZVjOYLC6e3glWkBBVHC2RJ+w/qezCuT/2sV6Q5VYpowjvnf/iBJJqvpYBgBS+w6wVB5DLEOiTZHWy36nNheg0jUBs3PoJnMfyuOdAECqrZ3K7KcACGQp89RAtlysCphqZhPtRzYlcPx+ExklJUiq0le5omCfOGFAYn3qFKS/fZAWS7a3Y2wa+GJOEy4US+B3aaPUYJamj4oI5LA/jWQBt5HIK5+JfXzZsJVpXi/ac8+mxWIXWzAG4Wb4g/jscNMp63I4U5FcKaVvsNyFALokSA47Kx8PVk83OabCHZsiqwAKEpjmfUJIkoh/R+L9oTpjluhRkGSPG4A7EkS+Y3HZk0OXYpIVNy01P5yItnptDsvtIwr0SunqoVP1GG1taTHn1CloXm9aLBEIEDl/IS2W6rg+qIFEYR7+OJTesqJqYa95/VKBNOHLjDBZ8sDS2998a0Bs/F//gvu5Z9NivadOc/U3676pEsizBIN1jCYlhClL+ELJDrkobNUBfBZqQfMN305HAgnIeYi4OnYMh7q/AsAXSdXK+eH41sykxd+TV/AsXvR/MeARAttD9pSqF9nDNfSEoDQsb5O31zQFprcaV244JPY7bqG6Xd9K3C3ALgbfk3NzqNE6CdplZrVFL27eWR+UASb6479ULfhD5AzOlSuGFTE6OohebElbcb8fhxA4xEPUgdTK19hiNKCZgknB+Ep44E44d82cxqPPOKctCGXzTmsBXbV1j1S5XQhyHq6NvnABPylu46A7QmVLpP7w9pNz4IEb0YyOrnmjb8bjB129fDBRkDVj2ojFbYBnCHHb7HL+OC7KQXeEsmAiNrnTqLy3d3+s/bvlVmxpgffM1fyM5cfsPZLuK+YHnvHELl8eUlwV4BXim0r6QV+4gD9Nlnjbfg1vJGktbI5UbN/TcGmAAYDG84Gry/MLLl/zKouO2Xukq/YkCyuWYV5owTIGjhVFCPL6J7kLOTcH89ereF1r4qOsm3gjSevl85El1Z98cfhB3qBN9+dLp1fUTco+0OrVMnNjFuv0chYbBYT2HcBoa+8TALyWQOt/ImPHoFS9SI3WyRajgdt2mbJgIlbREplfveuLf/XXemjXX7v46ZxzPlfd8YlZ01My5MUEVdIY5rueYopw4fQHkbv7/rZkTw6JwjyalBCHur9iD9cI2mU0UzD3P9H6yZ1G5dt7Gwe96w07dl5fXj7vYqH2XsNovdTI6KMrlsAXhRyz7/C7FBO/DubdVq4nBLPaohcnBeMr3/2k4fhQ+Uc8995YPq2wMzNjww2X+vwNt1p00ynrd2yKDJAVN628sBX1hZIdxXdStU9G5W2bd9YHR5L3f/CNmJeY9G8WAAAAAElFTkSuQmCC' + } + + TriggerEvent('esx_phone:addSpecialContact', specialContact.name, specialContact.number, specialContact.base64Icon) +end) + +AddEventHandler('esx:onPlayerDeath', function(data) + OnPlayerDeath() +end) + +RegisterNetEvent('esx_ambulancejob:revive') +AddEventHandler('esx_ambulancejob:revive', function() + local playerPed = PlayerPedId() + local coords = GetEntityCoords(playerPed) + TriggerServerEvent('esx_ambulancejob:setDeathStatus', false) + + DoScreenFadeOut(800) + + while not IsScreenFadedOut() do + Citizen.Wait(50) + end + + local formattedCoords = { + x = ESX.Math.Round(coords.x, 1), + y = ESX.Math.Round(coords.y, 1), + z = ESX.Math.Round(coords.z, 1) + } + + RespawnPed(playerPed, formattedCoords, 0.0) + + StopScreenEffect('DeathFailOut') + DoScreenFadeIn(800) +end) + +-- Load unloaded IPLs +if Config.LoadIpl then + RequestIpl('Coroner_Int_on') -- Morgue +end From ac66b60938cf6460e7f26ac64fda1927fca6bed1 Mon Sep 17 00:00:00 2001 From: LeonAnderson48 <63073120+LeonAnderson48@users.noreply.github.com> Date: Thu, 14 May 2020 17:13:52 +0100 Subject: [PATCH 159/177] Delete main.lua --- main.lua | 360 ------------------------------------------------------- 1 file changed, 360 deletions(-) delete mode 100644 main.lua diff --git a/main.lua b/main.lua deleted file mode 100644 index 988e98eb..00000000 --- a/main.lua +++ /dev/null @@ -1,360 +0,0 @@ -local firstSpawn, PlayerLoaded = true, false - -isDead = false -ESX = nil - -Citizen.CreateThread(function() - while ESX == nil do - TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) - Citizen.Wait(0) - end - - while ESX.GetPlayerData().job == nil do - Citizen.Wait(100) - end - - PlayerLoaded = true - ESX.PlayerData = ESX.GetPlayerData() -end) - -RegisterNetEvent('esx:playerLoaded') -AddEventHandler('esx:playerLoaded', function(xPlayer) - ESX.PlayerData = xPlayer - PlayerLoaded = true -end) - -RegisterNetEvent('esx:setJob') -AddEventHandler('esx:setJob', function(job) - ESX.PlayerData.job = job -end) - -AddEventHandler('esx:onPlayerSpawn', function() - isDead = false - - if firstSpawn then - firstSpawn = false - - if Config.AntiCombatLog then - while not PlayerLoaded do - Citizen.Wait(5000) - end - - ESX.TriggerServerCallback('esx_ambulancejob:getDeathStatus', function(shouldDie) - if shouldDie then - Citizen.Wait(10000) - SetEntityHealth(PlayerPedId(), 0) - end - end) - end - end -end) - --- Create blips -Citizen.CreateThread(function() - for k,v in pairs(Config.Hospitals) do - local blip = AddBlipForCoord(v.Blip.coords) - - SetBlipSprite(blip, v.Blip.sprite) - SetBlipScale(blip, v.Blip.scale) - SetBlipColour(blip, v.Blip.color) - SetBlipAsShortRange(blip, true) - - BeginTextCommandSetBlipName('STRING') - AddTextComponentSubstringPlayerName(_U('blip_hospital')) - EndTextCommandSetBlipName(blip) - end -end) - --- Disable most inputs when dead -Citizen.CreateThread(function() - while true do - Citizen.Wait(0) - - if isDead then - DisableAllControlActions(0) - EnableControlAction(0, 47, true) - EnableControlAction(0, 245, true) - EnableControlAction(0, 38, true) - else - Citizen.Wait(500) - end - end -end) - -function OnPlayerDeath() - isDead = true - ESX.UI.Menu.CloseAll() - TriggerServerEvent('esx_ambulancejob:setDeathStatus', true) - - StartDeathTimer() - StartDistressSignal() - - StartScreenEffect('DeathFailOut', 0, false) -end - -RegisterNetEvent('esx_ambulancejob:useItem') -AddEventHandler('esx_ambulancejob:useItem', function(itemName) - ESX.UI.Menu.CloseAll() - - if itemName == 'medikit' then - local lib, anim = 'anim@heists@narcotics@funding@gang_idle', 'gang_chatting_idle01' -- TODO better animations - local playerPed = PlayerPedId() - - ESX.Streaming.RequestAnimDict(lib, function() - TaskPlayAnim(playerPed, lib, anim, 8.0, -8.0, -1, 0, 0, false, false, false) - - Citizen.Wait(500) - while IsEntityPlayingAnim(playerPed, lib, anim, 3) do - Citizen.Wait(0) - DisableAllControlActions(0) - end - - TriggerEvent('esx_ambulancejob:heal', 'big', true) - ESX.ShowNotification(_U('used_medikit')) - end) - - elseif itemName == 'bandage' then - local lib, anim = 'anim@heists@narcotics@funding@gang_idle', 'gang_chatting_idle01' -- TODO better animations - local playerPed = PlayerPedId() - - ESX.Streaming.RequestAnimDict(lib, function() - TaskPlayAnim(playerPed, lib, anim, 8.0, -8.0, -1, 0, 0, false, false, false) - - Citizen.Wait(500) - while IsEntityPlayingAnim(playerPed, lib, anim, 3) do - Citizen.Wait(0) - DisableAllControlActions(0) - end - - TriggerEvent('esx_ambulancejob:heal', 'small', true) - ESX.ShowNotification(_U('used_bandage')) - end) - end -end) - -function StartDistressSignal() - Citizen.CreateThread(function() - local timer = Config.BleedoutTimer - - while timer > 0 and isDead do - Citizen.Wait(0) - timer = timer - 30 - - SetTextFont(4) - SetTextScale(0.45, 0.45) - SetTextColour(185, 185, 185, 255) - SetTextDropshadow(0, 0, 0, 0, 255) - SetTextDropShadow() - SetTextOutline() - BeginTextCommandDisplayText('STRING') - AddTextComponentSubstringPlayerName(_U('distress_send')) - EndTextCommandDisplayText(0.175, 0.805) - - if IsControlJustReleased(0, 47) then - SendDistressSignal() - break - end - end - end) -end - -function SendDistressSignal() - local playerPed = PlayerPedId() - local coords = GetEntityCoords(playerPed) - - ESX.ShowNotification(_U('distress_sent')) - TriggerServerEvent('esx_ambulancejob:onPlayerDistress') -end - -function DrawGenericTextThisFrame() - SetTextFont(4) - SetTextScale(0.0, 0.5) - SetTextColour(255, 255, 255, 255) - SetTextDropshadow(0, 0, 0, 0, 255) - SetTextDropShadow() - SetTextOutline() - SetTextCentre(true) -end - -function secondsToClock(seconds) - local seconds, hours, mins, secs = tonumber(seconds), 0, 0, 0 - - if seconds <= 0 then - return 0, 0 - else - local hours = string.format('%02.f', math.floor(seconds / 3600)) - local mins = string.format('%02.f', math.floor(seconds / 60 - (hours * 60))) - local secs = string.format('%02.f', math.floor(seconds - hours * 3600 - mins * 60)) - - return mins, secs - end -end - -function StartDeathTimer() - local canPayFine = false - - if Config.EarlyRespawnFine then - ESX.TriggerServerCallback('esx_ambulancejob:checkBalance', function(canPay) - canPayFine = canPay - end) - end - - local earlySpawnTimer = ESX.Math.Round(Config.EarlyRespawnTimer / 1000) - local bleedoutTimer = ESX.Math.Round(Config.BleedoutTimer / 1000) - - Citizen.CreateThread(function() - -- early respawn timer - while earlySpawnTimer > 0 and isDead do - Citizen.Wait(1000) - - if earlySpawnTimer > 0 then - earlySpawnTimer = earlySpawnTimer - 1 - end - end - - -- bleedout timer - while bleedoutTimer > 0 and isDead do - Citizen.Wait(1000) - - if bleedoutTimer > 0 then - bleedoutTimer = bleedoutTimer - 1 - end - end - end) - - Citizen.CreateThread(function() - local text, timeHeld - - -- early respawn timer - while earlySpawnTimer > 0 and isDead do - Citizen.Wait(0) - text = _U('respawn_available_in', secondsToClock(earlySpawnTimer)) - - DrawGenericTextThisFrame() - - SetTextEntry('STRING') - AddTextComponentString(text) - DrawText(0.5, 0.8) - end - - -- bleedout timer - while bleedoutTimer > 0 and isDead do - Citizen.Wait(0) - text = _U('respawn_bleedout_in', secondsToClock(bleedoutTimer)) - - if not Config.EarlyRespawnFine then - text = text .. _U('respawn_bleedout_prompt') - - if IsControlPressed(0, 38) and timeHeld > 60 then - RemoveItemsAfterRPDeath() - break - end - elseif Config.EarlyRespawnFine and canPayFine then - text = text .. _U('respawn_bleedout_fine', ESX.Math.GroupDigits(Config.EarlyRespawnFineAmount)) - - if IsControlPressed(0, 38) and timeHeld > 60 then - TriggerServerEvent('esx_ambulancejob:payFine') - RemoveItemsAfterRPDeath() - break - end - end - - if IsControlPressed(0, 38) then - timeHeld = timeHeld + 1 - else - timeHeld = 0 - end - - DrawGenericTextThisFrame() - - SetTextEntry('STRING') - AddTextComponentString(text) - DrawText(0.5, 0.8) - end - - if bleedoutTimer < 1 and isDead then - RemoveItemsAfterRPDeath() - end - end) -end - -function RemoveItemsAfterRPDeath() - TriggerServerEvent('esx_ambulancejob:setDeathStatus', false) - - Citizen.CreateThread(function() - DoScreenFadeOut(800) - - while not IsScreenFadedOut() do - Citizen.Wait(10) - end - - ESX.TriggerServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function() - local formattedCoords = { - x = Config.RespawnPoint.coords.x, - y = Config.RespawnPoint.coords.y, - z = Config.RespawnPoint.coords.z - } - - ESX.SetPlayerData('loadout', {}) - RespawnPed(PlayerPedId(), formattedCoords, Config.RespawnPoint.heading) - - StopScreenEffect('DeathFailOut') - DoScreenFadeIn(800) - end) - end) -end - -function RespawnPed(ped, coords, heading) - SetEntityCoordsNoOffset(ped, coords.x, coords.y, coords.z, false, false, false, true) - NetworkResurrectLocalPlayer(coords.x, coords.y, coords.z, heading, true, false) - SetPlayerInvincible(ped, false) - ClearPedBloodDamage(ped) - - TriggerServerEvent('esx:onPlayerSpawn') - TriggerEvent('esx:onPlayerSpawn') - TriggerEvent('playerSpawned') -- compatibility with old scripts, will be removed soon -end - -RegisterNetEvent('esx_phone:loaded') -AddEventHandler('esx_phone:loaded', function(phoneNumber, contacts) - local specialContact = { - name = 'Ambulance', - number = 'ambulance', - base64Icon = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEwAACxMBAJqcGAAABp5JREFUWIW1l21sFNcVhp/58npn195de23Ha4Mh2EASSvk0CPVHmmCEI0RCTQMBKVVooxYoalBVCVokICWFVFVEFeKoUdNECkZQIlAoFGMhIkrBQGxHwhAcChjbeLcsYHvNfsx+zNz+MBDWNrYhzSvdP+e+c973XM2cc0dihFi9Yo6vSzN/63dqcwPZcnEwS9PDmYoE4IxZIj+ciBb2mteLwlZdfji+dXtNU2AkeaXhCGteLZ/X/IS64/RoR5mh9tFVAaMiAldKQUGiRzFp1wXJPj/YkxblbfFLT/tjq9/f1XD0sQyse2li7pdP5tYeLXXMMGUojAiWKeOodE1gqpmNfN2PFeoF00T2uLGKfZzTwhzqbaEmeYWAQ0K1oKIlfPb7t+7M37aruXvEBlYvnV7xz2ec/2jNs9kKooKNjlksiXhJfLqf1PXOIU9M8fmw/XgRu523eTNyhhu6xLjbSeOFC6EX3t3V9PmwBla9Vv7K7u85d3bpqlwVcvHn7B8iVX+IFQoNKdwfstuFtWoFvwp9zj5XL7nRlPXyudjS9z+u35tmuH/lu6dl7+vSVXmDUcpbX+skP65BxOOPJA4gjDicOM2PciejeTwcsYek1hyl6me5nhNnmwPXBhjYuGC699OpzoaAO0PbYJSy5vgt4idOPrJwf6QuX2FO0oOtqIgj9pDU5dCWrMlyvXf86xsGgHyPeLos83Brns1WFXLxxgVBorHpW4vfQ6KhkbUtCot6srns1TLPjNVr7+1J0PepVc92H/Eagkb7IsTWd4ZMaN+yCXv5zLRY9GQ9xuYtQz4nfreWGdH9dNlkfnGq5/kdO88ekwGan1B3mDJsdMxCqv5w2Iq0khLs48vSllrsG/Y5pfojNugzScnQXKBVA8hrX51ddHq0o6wwIlgS8Y7obZdUZVjOYLC6e3glWkBBVHC2RJ+w/qezCuT/2sV6Q5VYpowjvnf/iBJJqvpYBgBS+w6wVB5DLEOiTZHWy36nNheg0jUBs3PoJnMfyuOdAECqrZ3K7KcACGQp89RAtlysCphqZhPtRzYlcPx+ExklJUiq0le5omCfOGFAYn3qFKS/fZAWS7a3Y2wa+GJOEy4US+B3aaPUYJamj4oI5LA/jWQBt5HIK5+JfXzZsJVpXi/ac8+mxWIXWzAG4Wb4g/jscNMp63I4U5FcKaVvsNyFALokSA47Kx8PVk83OabCHZsiqwAKEpjmfUJIkoh/R+L9oTpjluhRkGSPG4A7EkS+Y3HZk0OXYpIVNy01P5yItnptDsvtIwr0SunqoVP1GG1taTHn1CloXm9aLBEIEDl/IS2W6rg+qIFEYR7+OJTesqJqYa95/VKBNOHLjDBZ8sDS2998a0Bs/F//gvu5Z9NivadOc/U3676pEsizBIN1jCYlhClL+ELJDrkobNUBfBZqQfMN305HAgnIeYi4OnYMh7q/AsAXSdXK+eH41sykxd+TV/AsXvR/MeARAttD9pSqF9nDNfSEoDQsb5O31zQFprcaV244JPY7bqG6Xd9K3C3ALgbfk3NzqNE6CdplZrVFL27eWR+UASb6479ULfhD5AzOlSuGFTE6OohebElbcb8fhxA4xEPUgdTK19hiNKCZgknB+Ep44E44d82cxqPPOKctCGXzTmsBXbV1j1S5XQhyHq6NvnABPylu46A7QmVLpP7w9pNz4IEb0YyOrnmjb8bjB129fDBRkDVj2ojFbYBnCHHb7HL+OC7KQXeEsmAiNrnTqLy3d3+s/bvlVmxpgffM1fyM5cfsPZLuK+YHnvHELl8eUlwV4BXim0r6QV+4gD9Nlnjbfg1vJGktbI5UbN/TcGmAAYDG84Gry/MLLl/zKouO2Xukq/YkCyuWYV5owTIGjhVFCPL6J7kLOTcH89ereF1r4qOsm3gjSevl85El1Z98cfhB3qBN9+dLp1fUTco+0OrVMnNjFuv0chYbBYT2HcBoa+8TALyWQOt/ImPHoFS9SI3WyRajgdt2mbJgIlbREplfveuLf/XXemjXX7v46ZxzPlfd8YlZ01My5MUEVdIY5rueYopw4fQHkbv7/rZkTw6JwjyalBCHur9iD9cI2mU0UzD3P9H6yZ1G5dt7Gwe96w07dl5fXj7vYqH2XsNovdTI6KMrlsAXhRyz7/C7FBO/DubdVq4nBLPaohcnBeMr3/2k4fhQ+Uc8995YPq2wMzNjww2X+vwNt1p00ynrd2yKDJAVN628sBX1hZIdxXdStU9G5W2bd9YHR5L3f/CNmJeY9G8WAAAAAElFTkSuQmCC' - } - - TriggerEvent('esx_phone:addSpecialContact', specialContact.name, specialContact.number, specialContact.base64Icon) -end) - -AddEventHandler('esx:onPlayerDeath', function(data) - OnPlayerDeath() -end) - -RegisterNetEvent('esx_ambulancejob:revive') -AddEventHandler('esx_ambulancejob:revive', function() - local playerPed = PlayerPedId() - local coords = GetEntityCoords(playerPed) - TriggerServerEvent('esx_ambulancejob:setDeathStatus', false) - - DoScreenFadeOut(800) - - while not IsScreenFadedOut() do - Citizen.Wait(50) - end - - local formattedCoords = { - x = ESX.Math.Round(coords.x, 1), - y = ESX.Math.Round(coords.y, 1), - z = ESX.Math.Round(coords.z, 1) - } - - RespawnPed(playerPed, formattedCoords, 0.0) - - StopScreenEffect('DeathFailOut') - DoScreenFadeIn(800) -end) - --- Load unloaded IPLs -if Config.LoadIpl then - RequestIpl('Coroner_Int_on') -- Morgue -end From cacb1baba7872351a8ce7f2a9f848cb97eb9e35f Mon Sep 17 00:00:00 2001 From: LeonAnderson48 <63073120+LeonAnderson48@users.noreply.github.com> Date: Thu, 14 May 2020 17:14:09 +0100 Subject: [PATCH 160/177] Delete main.lua --- client/main.lua | 360 ------------------------------------------------ 1 file changed, 360 deletions(-) delete mode 100644 client/main.lua diff --git a/client/main.lua b/client/main.lua deleted file mode 100644 index 3596a306..00000000 --- a/client/main.lua +++ /dev/null @@ -1,360 +0,0 @@ -local firstSpawn, PlayerLoaded = true, false - -isDead = false -ESX = nil - -Citizen.CreateThread(function() - while ESX == nil do - TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) - Citizen.Wait(0) - end - - while ESX.GetPlayerData().job == nil do - Citizen.Wait(100) - end - - PlayerLoaded = true - ESX.PlayerData = ESX.GetPlayerData() -end) - -RegisterNetEvent('esx:playerLoaded') -AddEventHandler('esx:playerLoaded', function(xPlayer) - ESX.PlayerData = xPlayer - PlayerLoaded = true -end) - -RegisterNetEvent('esx:setJob') -AddEventHandler('esx:setJob', function(job) - ESX.PlayerData.job = job -end) - -AddEventHandler('esx:onPlayerSpawn', function() - isDead = false - - if firstSpawn then - firstSpawn = false - - if Config.AntiCombatLog then - while not PlayerLoaded do - Citizen.Wait(1000) - end - - ESX.TriggerServerCallback('esx_ambulancejob:getDeathStatus', function(shouldDie) - if shouldDie then - ESX.ShowNotification(_U('combatlog_message')) - RemoveItemsAfterRPDeath() - end - end) - end - end -end) - --- Create blips -Citizen.CreateThread(function() - for k,v in pairs(Config.Hospitals) do - local blip = AddBlipForCoord(v.Blip.coords) - - SetBlipSprite(blip, v.Blip.sprite) - SetBlipScale(blip, v.Blip.scale) - SetBlipColour(blip, v.Blip.color) - SetBlipAsShortRange(blip, true) - - BeginTextCommandSetBlipName('STRING') - AddTextComponentSubstringPlayerName(_U('blip_hospital')) - EndTextCommandSetBlipName(blip) - end -end) - --- Disable most inputs when dead -Citizen.CreateThread(function() - while true do - Citizen.Wait(0) - - if isDead then - DisableAllControlActions(0) - EnableControlAction(0, 47, true) - EnableControlAction(0, 245, true) - EnableControlAction(0, 38, true) - else - Citizen.Wait(500) - end - end -end) - -function OnPlayerDeath() - isDead = true - ESX.UI.Menu.CloseAll() - TriggerServerEvent('esx_ambulancejob:setDeathStatus', true) - - StartDeathTimer() - StartDistressSignal() - - StartScreenEffect('DeathFailOut', 0, false) -end - -RegisterNetEvent('esx_ambulancejob:useItem') -AddEventHandler('esx_ambulancejob:useItem', function(itemName) - ESX.UI.Menu.CloseAll() - - if itemName == 'medikit' then - local lib, anim = 'anim@heists@narcotics@funding@gang_idle', 'gang_chatting_idle01' -- TODO better animations - local playerPed = PlayerPedId() - - ESX.Streaming.RequestAnimDict(lib, function() - TaskPlayAnim(playerPed, lib, anim, 8.0, -8.0, -1, 0, 0, false, false, false) - - Citizen.Wait(500) - while IsEntityPlayingAnim(playerPed, lib, anim, 3) do - Citizen.Wait(0) - DisableAllControlActions(0) - end - - TriggerEvent('esx_ambulancejob:heal', 'big', true) - ESX.ShowNotification(_U('used_medikit')) - end) - - elseif itemName == 'bandage' then - local lib, anim = 'anim@heists@narcotics@funding@gang_idle', 'gang_chatting_idle01' -- TODO better animations - local playerPed = PlayerPedId() - - ESX.Streaming.RequestAnimDict(lib, function() - TaskPlayAnim(playerPed, lib, anim, 8.0, -8.0, -1, 0, 0, false, false, false) - - Citizen.Wait(500) - while IsEntityPlayingAnim(playerPed, lib, anim, 3) do - Citizen.Wait(0) - DisableAllControlActions(0) - end - - TriggerEvent('esx_ambulancejob:heal', 'small', true) - ESX.ShowNotification(_U('used_bandage')) - end) - end -end) - -function StartDistressSignal() - Citizen.CreateThread(function() - local timer = Config.BleedoutTimer - - while timer > 0 and isDead do - Citizen.Wait(0) - timer = timer - 30 - - SetTextFont(4) - SetTextScale(0.45, 0.45) - SetTextColour(185, 185, 185, 255) - SetTextDropshadow(0, 0, 0, 0, 255) - SetTextDropShadow() - SetTextOutline() - BeginTextCommandDisplayText('STRING') - AddTextComponentSubstringPlayerName(_U('distress_send')) - EndTextCommandDisplayText(0.175, 0.805) - - if IsControlJustReleased(0, 47) then - SendDistressSignal() - break - end - end - end) -end - -function SendDistressSignal() - local playerPed = PlayerPedId() - local coords = GetEntityCoords(playerPed) - - ESX.ShowNotification(_U('distress_sent')) - TriggerServerEvent('esx_ambulancejob:onPlayerDistress') -end - -function DrawGenericTextThisFrame() - SetTextFont(4) - SetTextScale(0.0, 0.5) - SetTextColour(255, 255, 255, 255) - SetTextDropshadow(0, 0, 0, 0, 255) - SetTextDropShadow() - SetTextOutline() - SetTextCentre(true) -end - -function secondsToClock(seconds) - local seconds, hours, mins, secs = tonumber(seconds), 0, 0, 0 - - if seconds <= 0 then - return 0, 0 - else - local hours = string.format('%02.f', math.floor(seconds / 3600)) - local mins = string.format('%02.f', math.floor(seconds / 60 - (hours * 60))) - local secs = string.format('%02.f', math.floor(seconds - hours * 3600 - mins * 60)) - - return mins, secs - end -end - -function StartDeathTimer() - local canPayFine = false - - if Config.EarlyRespawnFine then - ESX.TriggerServerCallback('esx_ambulancejob:checkBalance', function(canPay) - canPayFine = canPay - end) - end - - local earlySpawnTimer = ESX.Math.Round(Config.EarlyRespawnTimer / 1000) - local bleedoutTimer = ESX.Math.Round(Config.BleedoutTimer / 1000) - - Citizen.CreateThread(function() - -- early respawn timer - while earlySpawnTimer > 0 and isDead do - Citizen.Wait(1000) - - if earlySpawnTimer > 0 then - earlySpawnTimer = earlySpawnTimer - 1 - end - end - - -- bleedout timer - while bleedoutTimer > 0 and isDead do - Citizen.Wait(1000) - - if bleedoutTimer > 0 then - bleedoutTimer = bleedoutTimer - 1 - end - end - end) - - Citizen.CreateThread(function() - local text, timeHeld - - -- early respawn timer - while earlySpawnTimer > 0 and isDead do - Citizen.Wait(0) - text = _U('respawn_available_in', secondsToClock(earlySpawnTimer)) - - DrawGenericTextThisFrame() - - SetTextEntry('STRING') - AddTextComponentString(text) - DrawText(0.5, 0.8) - end - - -- bleedout timer - while bleedoutTimer > 0 and isDead do - Citizen.Wait(0) - text = _U('respawn_bleedout_in', secondsToClock(bleedoutTimer)) - - if not Config.EarlyRespawnFine then - text = text .. _U('respawn_bleedout_prompt') - - if IsControlPressed(0, 38) and timeHeld > 60 then - RemoveItemsAfterRPDeath() - break - end - elseif Config.EarlyRespawnFine and canPayFine then - text = text .. _U('respawn_bleedout_fine', ESX.Math.GroupDigits(Config.EarlyRespawnFineAmount)) - - if IsControlPressed(0, 38) and timeHeld > 60 then - TriggerServerEvent('esx_ambulancejob:payFine') - RemoveItemsAfterRPDeath() - break - end - end - - if IsControlPressed(0, 38) then - timeHeld = timeHeld + 1 - else - timeHeld = 0 - end - - DrawGenericTextThisFrame() - - SetTextEntry('STRING') - AddTextComponentString(text) - DrawText(0.5, 0.8) - end - - if bleedoutTimer < 1 and isDead then - RemoveItemsAfterRPDeath() - end - end) -end - -function RemoveItemsAfterRPDeath() - TriggerServerEvent('esx_ambulancejob:setDeathStatus', false) - - Citizen.CreateThread(function() - DoScreenFadeOut(800) - - while not IsScreenFadedOut() do - Citizen.Wait(10) - end - - ESX.TriggerServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function() - local formattedCoords = { - x = Config.RespawnPoint.coords.x, - y = Config.RespawnPoint.coords.y, - z = Config.RespawnPoint.coords.z - } - - ESX.SetPlayerData('loadout', {}) - RespawnPed(PlayerPedId(), formattedCoords, Config.RespawnPoint.heading) - - StopScreenEffect('DeathFailOut') - DoScreenFadeIn(800) - end) - end) -end - -function RespawnPed(ped, coords, heading) - SetEntityCoordsNoOffset(ped, coords.x, coords.y, coords.z, false, false, false, true) - NetworkResurrectLocalPlayer(coords.x, coords.y, coords.z, heading, true, false) - SetPlayerInvincible(ped, false) - ClearPedBloodDamage(ped) - - TriggerServerEvent('esx:onPlayerSpawn') - TriggerEvent('esx:onPlayerSpawn') - TriggerEvent('playerSpawned') -- compatibility with old scripts, will be removed soon -end - -RegisterNetEvent('esx_phone:loaded') -AddEventHandler('esx_phone:loaded', function(phoneNumber, contacts) - local specialContact = { - name = 'Ambulance', - number = 'ambulance', - base64Icon = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEwAACxMBAJqcGAAABp5JREFUWIW1l21sFNcVhp/58npn195de23Ha4Mh2EASSvk0CPVHmmCEI0RCTQMBKVVooxYoalBVCVokICWFVFVEFeKoUdNECkZQIlAoFGMhIkrBQGxHwhAcChjbeLcsYHvNfsx+zNz+MBDWNrYhzSvdP+e+c973XM2cc0dihFi9Yo6vSzN/63dqcwPZcnEwS9PDmYoE4IxZIj+ciBb2mteLwlZdfji+dXtNU2AkeaXhCGteLZ/X/IS64/RoR5mh9tFVAaMiAldKQUGiRzFp1wXJPj/YkxblbfFLT/tjq9/f1XD0sQyse2li7pdP5tYeLXXMMGUojAiWKeOodE1gqpmNfN2PFeoF00T2uLGKfZzTwhzqbaEmeYWAQ0K1oKIlfPb7t+7M37aruXvEBlYvnV7xz2ec/2jNs9kKooKNjlksiXhJfLqf1PXOIU9M8fmw/XgRu523eTNyhhu6xLjbSeOFC6EX3t3V9PmwBla9Vv7K7u85d3bpqlwVcvHn7B8iVX+IFQoNKdwfstuFtWoFvwp9zj5XL7nRlPXyudjS9z+u35tmuH/lu6dl7+vSVXmDUcpbX+skP65BxOOPJA4gjDicOM2PciejeTwcsYek1hyl6me5nhNnmwPXBhjYuGC699OpzoaAO0PbYJSy5vgt4idOPrJwf6QuX2FO0oOtqIgj9pDU5dCWrMlyvXf86xsGgHyPeLos83Brns1WFXLxxgVBorHpW4vfQ6KhkbUtCot6srns1TLPjNVr7+1J0PepVc92H/Eagkb7IsTWd4ZMaN+yCXv5zLRY9GQ9xuYtQz4nfreWGdH9dNlkfnGq5/kdO88ekwGan1B3mDJsdMxCqv5w2Iq0khLs48vSllrsG/Y5pfojNugzScnQXKBVA8hrX51ddHq0o6wwIlgS8Y7obZdUZVjOYLC6e3glWkBBVHC2RJ+w/qezCuT/2sV6Q5VYpowjvnf/iBJJqvpYBgBS+w6wVB5DLEOiTZHWy36nNheg0jUBs3PoJnMfyuOdAECqrZ3K7KcACGQp89RAtlysCphqZhPtRzYlcPx+ExklJUiq0le5omCfOGFAYn3qFKS/fZAWS7a3Y2wa+GJOEy4US+B3aaPUYJamj4oI5LA/jWQBt5HIK5+JfXzZsJVpXi/ac8+mxWIXWzAG4Wb4g/jscNMp63I4U5FcKaVvsNyFALokSA47Kx8PVk83OabCHZsiqwAKEpjmfUJIkoh/R+L9oTpjluhRkGSPG4A7EkS+Y3HZk0OXYpIVNy01P5yItnptDsvtIwr0SunqoVP1GG1taTHn1CloXm9aLBEIEDl/IS2W6rg+qIFEYR7+OJTesqJqYa95/VKBNOHLjDBZ8sDS2998a0Bs/F//gvu5Z9NivadOc/U3676pEsizBIN1jCYlhClL+ELJDrkobNUBfBZqQfMN305HAgnIeYi4OnYMh7q/AsAXSdXK+eH41sykxd+TV/AsXvR/MeARAttD9pSqF9nDNfSEoDQsb5O31zQFprcaV244JPY7bqG6Xd9K3C3ALgbfk3NzqNE6CdplZrVFL27eWR+UASb6479ULfhD5AzOlSuGFTE6OohebElbcb8fhxA4xEPUgdTK19hiNKCZgknB+Ep44E44d82cxqPPOKctCGXzTmsBXbV1j1S5XQhyHq6NvnABPylu46A7QmVLpP7w9pNz4IEb0YyOrnmjb8bjB129fDBRkDVj2ojFbYBnCHHb7HL+OC7KQXeEsmAiNrnTqLy3d3+s/bvlVmxpgffM1fyM5cfsPZLuK+YHnvHELl8eUlwV4BXim0r6QV+4gD9Nlnjbfg1vJGktbI5UbN/TcGmAAYDG84Gry/MLLl/zKouO2Xukq/YkCyuWYV5owTIGjhVFCPL6J7kLOTcH89ereF1r4qOsm3gjSevl85El1Z98cfhB3qBN9+dLp1fUTco+0OrVMnNjFuv0chYbBYT2HcBoa+8TALyWQOt/ImPHoFS9SI3WyRajgdt2mbJgIlbREplfveuLf/XXemjXX7v46ZxzPlfd8YlZ01My5MUEVdIY5rueYopw4fQHkbv7/rZkTw6JwjyalBCHur9iD9cI2mU0UzD3P9H6yZ1G5dt7Gwe96w07dl5fXj7vYqH2XsNovdTI6KMrlsAXhRyz7/C7FBO/DubdVq4nBLPaohcnBeMr3/2k4fhQ+Uc8995YPq2wMzNjww2X+vwNt1p00ynrd2yKDJAVN628sBX1hZIdxXdStU9G5W2bd9YHR5L3f/CNmJeY9G8WAAAAAElFTkSuQmCC' - } - - TriggerEvent('esx_phone:addSpecialContact', specialContact.name, specialContact.number, specialContact.base64Icon) -end) - -AddEventHandler('esx:onPlayerDeath', function(data) - OnPlayerDeath() -end) - -RegisterNetEvent('esx_ambulancejob:revive') -AddEventHandler('esx_ambulancejob:revive', function() - local playerPed = PlayerPedId() - local coords = GetEntityCoords(playerPed) - TriggerServerEvent('esx_ambulancejob:setDeathStatus', false) - - DoScreenFadeOut(800) - - while not IsScreenFadedOut() do - Citizen.Wait(50) - end - - local formattedCoords = { - x = ESX.Math.Round(coords.x, 1), - y = ESX.Math.Round(coords.y, 1), - z = ESX.Math.Round(coords.z, 1) - } - - RespawnPed(playerPed, formattedCoords, 0.0) - - StopScreenEffect('DeathFailOut') - DoScreenFadeIn(800) -end) - --- Load unloaded IPLs -if Config.LoadIpl then - RequestIpl('Coroner_Int_on') -- Morgue -end From 27b9b8e9aca48cda95bdffc41bb5931fde8dcf77 Mon Sep 17 00:00:00 2001 From: LeonAnderson48 <63073120+LeonAnderson48@users.noreply.github.com> Date: Thu, 14 May 2020 17:16:04 +0100 Subject: [PATCH 161/177] Changed the client/main.lua By changing the main.lua i have made it so that if a player is to combat log and then join back, this will kill them and reset the timer so that they cannot force respawn --- client/main.lua | 360 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 360 insertions(+) create mode 100644 client/main.lua diff --git a/client/main.lua b/client/main.lua new file mode 100644 index 00000000..988e98eb --- /dev/null +++ b/client/main.lua @@ -0,0 +1,360 @@ +local firstSpawn, PlayerLoaded = true, false + +isDead = false +ESX = nil + +Citizen.CreateThread(function() + while ESX == nil do + TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) + Citizen.Wait(0) + end + + while ESX.GetPlayerData().job == nil do + Citizen.Wait(100) + end + + PlayerLoaded = true + ESX.PlayerData = ESX.GetPlayerData() +end) + +RegisterNetEvent('esx:playerLoaded') +AddEventHandler('esx:playerLoaded', function(xPlayer) + ESX.PlayerData = xPlayer + PlayerLoaded = true +end) + +RegisterNetEvent('esx:setJob') +AddEventHandler('esx:setJob', function(job) + ESX.PlayerData.job = job +end) + +AddEventHandler('esx:onPlayerSpawn', function() + isDead = false + + if firstSpawn then + firstSpawn = false + + if Config.AntiCombatLog then + while not PlayerLoaded do + Citizen.Wait(5000) + end + + ESX.TriggerServerCallback('esx_ambulancejob:getDeathStatus', function(shouldDie) + if shouldDie then + Citizen.Wait(10000) + SetEntityHealth(PlayerPedId(), 0) + end + end) + end + end +end) + +-- Create blips +Citizen.CreateThread(function() + for k,v in pairs(Config.Hospitals) do + local blip = AddBlipForCoord(v.Blip.coords) + + SetBlipSprite(blip, v.Blip.sprite) + SetBlipScale(blip, v.Blip.scale) + SetBlipColour(blip, v.Blip.color) + SetBlipAsShortRange(blip, true) + + BeginTextCommandSetBlipName('STRING') + AddTextComponentSubstringPlayerName(_U('blip_hospital')) + EndTextCommandSetBlipName(blip) + end +end) + +-- Disable most inputs when dead +Citizen.CreateThread(function() + while true do + Citizen.Wait(0) + + if isDead then + DisableAllControlActions(0) + EnableControlAction(0, 47, true) + EnableControlAction(0, 245, true) + EnableControlAction(0, 38, true) + else + Citizen.Wait(500) + end + end +end) + +function OnPlayerDeath() + isDead = true + ESX.UI.Menu.CloseAll() + TriggerServerEvent('esx_ambulancejob:setDeathStatus', true) + + StartDeathTimer() + StartDistressSignal() + + StartScreenEffect('DeathFailOut', 0, false) +end + +RegisterNetEvent('esx_ambulancejob:useItem') +AddEventHandler('esx_ambulancejob:useItem', function(itemName) + ESX.UI.Menu.CloseAll() + + if itemName == 'medikit' then + local lib, anim = 'anim@heists@narcotics@funding@gang_idle', 'gang_chatting_idle01' -- TODO better animations + local playerPed = PlayerPedId() + + ESX.Streaming.RequestAnimDict(lib, function() + TaskPlayAnim(playerPed, lib, anim, 8.0, -8.0, -1, 0, 0, false, false, false) + + Citizen.Wait(500) + while IsEntityPlayingAnim(playerPed, lib, anim, 3) do + Citizen.Wait(0) + DisableAllControlActions(0) + end + + TriggerEvent('esx_ambulancejob:heal', 'big', true) + ESX.ShowNotification(_U('used_medikit')) + end) + + elseif itemName == 'bandage' then + local lib, anim = 'anim@heists@narcotics@funding@gang_idle', 'gang_chatting_idle01' -- TODO better animations + local playerPed = PlayerPedId() + + ESX.Streaming.RequestAnimDict(lib, function() + TaskPlayAnim(playerPed, lib, anim, 8.0, -8.0, -1, 0, 0, false, false, false) + + Citizen.Wait(500) + while IsEntityPlayingAnim(playerPed, lib, anim, 3) do + Citizen.Wait(0) + DisableAllControlActions(0) + end + + TriggerEvent('esx_ambulancejob:heal', 'small', true) + ESX.ShowNotification(_U('used_bandage')) + end) + end +end) + +function StartDistressSignal() + Citizen.CreateThread(function() + local timer = Config.BleedoutTimer + + while timer > 0 and isDead do + Citizen.Wait(0) + timer = timer - 30 + + SetTextFont(4) + SetTextScale(0.45, 0.45) + SetTextColour(185, 185, 185, 255) + SetTextDropshadow(0, 0, 0, 0, 255) + SetTextDropShadow() + SetTextOutline() + BeginTextCommandDisplayText('STRING') + AddTextComponentSubstringPlayerName(_U('distress_send')) + EndTextCommandDisplayText(0.175, 0.805) + + if IsControlJustReleased(0, 47) then + SendDistressSignal() + break + end + end + end) +end + +function SendDistressSignal() + local playerPed = PlayerPedId() + local coords = GetEntityCoords(playerPed) + + ESX.ShowNotification(_U('distress_sent')) + TriggerServerEvent('esx_ambulancejob:onPlayerDistress') +end + +function DrawGenericTextThisFrame() + SetTextFont(4) + SetTextScale(0.0, 0.5) + SetTextColour(255, 255, 255, 255) + SetTextDropshadow(0, 0, 0, 0, 255) + SetTextDropShadow() + SetTextOutline() + SetTextCentre(true) +end + +function secondsToClock(seconds) + local seconds, hours, mins, secs = tonumber(seconds), 0, 0, 0 + + if seconds <= 0 then + return 0, 0 + else + local hours = string.format('%02.f', math.floor(seconds / 3600)) + local mins = string.format('%02.f', math.floor(seconds / 60 - (hours * 60))) + local secs = string.format('%02.f', math.floor(seconds - hours * 3600 - mins * 60)) + + return mins, secs + end +end + +function StartDeathTimer() + local canPayFine = false + + if Config.EarlyRespawnFine then + ESX.TriggerServerCallback('esx_ambulancejob:checkBalance', function(canPay) + canPayFine = canPay + end) + end + + local earlySpawnTimer = ESX.Math.Round(Config.EarlyRespawnTimer / 1000) + local bleedoutTimer = ESX.Math.Round(Config.BleedoutTimer / 1000) + + Citizen.CreateThread(function() + -- early respawn timer + while earlySpawnTimer > 0 and isDead do + Citizen.Wait(1000) + + if earlySpawnTimer > 0 then + earlySpawnTimer = earlySpawnTimer - 1 + end + end + + -- bleedout timer + while bleedoutTimer > 0 and isDead do + Citizen.Wait(1000) + + if bleedoutTimer > 0 then + bleedoutTimer = bleedoutTimer - 1 + end + end + end) + + Citizen.CreateThread(function() + local text, timeHeld + + -- early respawn timer + while earlySpawnTimer > 0 and isDead do + Citizen.Wait(0) + text = _U('respawn_available_in', secondsToClock(earlySpawnTimer)) + + DrawGenericTextThisFrame() + + SetTextEntry('STRING') + AddTextComponentString(text) + DrawText(0.5, 0.8) + end + + -- bleedout timer + while bleedoutTimer > 0 and isDead do + Citizen.Wait(0) + text = _U('respawn_bleedout_in', secondsToClock(bleedoutTimer)) + + if not Config.EarlyRespawnFine then + text = text .. _U('respawn_bleedout_prompt') + + if IsControlPressed(0, 38) and timeHeld > 60 then + RemoveItemsAfterRPDeath() + break + end + elseif Config.EarlyRespawnFine and canPayFine then + text = text .. _U('respawn_bleedout_fine', ESX.Math.GroupDigits(Config.EarlyRespawnFineAmount)) + + if IsControlPressed(0, 38) and timeHeld > 60 then + TriggerServerEvent('esx_ambulancejob:payFine') + RemoveItemsAfterRPDeath() + break + end + end + + if IsControlPressed(0, 38) then + timeHeld = timeHeld + 1 + else + timeHeld = 0 + end + + DrawGenericTextThisFrame() + + SetTextEntry('STRING') + AddTextComponentString(text) + DrawText(0.5, 0.8) + end + + if bleedoutTimer < 1 and isDead then + RemoveItemsAfterRPDeath() + end + end) +end + +function RemoveItemsAfterRPDeath() + TriggerServerEvent('esx_ambulancejob:setDeathStatus', false) + + Citizen.CreateThread(function() + DoScreenFadeOut(800) + + while not IsScreenFadedOut() do + Citizen.Wait(10) + end + + ESX.TriggerServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function() + local formattedCoords = { + x = Config.RespawnPoint.coords.x, + y = Config.RespawnPoint.coords.y, + z = Config.RespawnPoint.coords.z + } + + ESX.SetPlayerData('loadout', {}) + RespawnPed(PlayerPedId(), formattedCoords, Config.RespawnPoint.heading) + + StopScreenEffect('DeathFailOut') + DoScreenFadeIn(800) + end) + end) +end + +function RespawnPed(ped, coords, heading) + SetEntityCoordsNoOffset(ped, coords.x, coords.y, coords.z, false, false, false, true) + NetworkResurrectLocalPlayer(coords.x, coords.y, coords.z, heading, true, false) + SetPlayerInvincible(ped, false) + ClearPedBloodDamage(ped) + + TriggerServerEvent('esx:onPlayerSpawn') + TriggerEvent('esx:onPlayerSpawn') + TriggerEvent('playerSpawned') -- compatibility with old scripts, will be removed soon +end + +RegisterNetEvent('esx_phone:loaded') +AddEventHandler('esx_phone:loaded', function(phoneNumber, contacts) + local specialContact = { + name = 'Ambulance', + number = 'ambulance', + base64Icon = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEwAACxMBAJqcGAAABp5JREFUWIW1l21sFNcVhp/58npn195de23Ha4Mh2EASSvk0CPVHmmCEI0RCTQMBKVVooxYoalBVCVokICWFVFVEFeKoUdNECkZQIlAoFGMhIkrBQGxHwhAcChjbeLcsYHvNfsx+zNz+MBDWNrYhzSvdP+e+c973XM2cc0dihFi9Yo6vSzN/63dqcwPZcnEwS9PDmYoE4IxZIj+ciBb2mteLwlZdfji+dXtNU2AkeaXhCGteLZ/X/IS64/RoR5mh9tFVAaMiAldKQUGiRzFp1wXJPj/YkxblbfFLT/tjq9/f1XD0sQyse2li7pdP5tYeLXXMMGUojAiWKeOodE1gqpmNfN2PFeoF00T2uLGKfZzTwhzqbaEmeYWAQ0K1oKIlfPb7t+7M37aruXvEBlYvnV7xz2ec/2jNs9kKooKNjlksiXhJfLqf1PXOIU9M8fmw/XgRu523eTNyhhu6xLjbSeOFC6EX3t3V9PmwBla9Vv7K7u85d3bpqlwVcvHn7B8iVX+IFQoNKdwfstuFtWoFvwp9zj5XL7nRlPXyudjS9z+u35tmuH/lu6dl7+vSVXmDUcpbX+skP65BxOOPJA4gjDicOM2PciejeTwcsYek1hyl6me5nhNnmwPXBhjYuGC699OpzoaAO0PbYJSy5vgt4idOPrJwf6QuX2FO0oOtqIgj9pDU5dCWrMlyvXf86xsGgHyPeLos83Brns1WFXLxxgVBorHpW4vfQ6KhkbUtCot6srns1TLPjNVr7+1J0PepVc92H/Eagkb7IsTWd4ZMaN+yCXv5zLRY9GQ9xuYtQz4nfreWGdH9dNlkfnGq5/kdO88ekwGan1B3mDJsdMxCqv5w2Iq0khLs48vSllrsG/Y5pfojNugzScnQXKBVA8hrX51ddHq0o6wwIlgS8Y7obZdUZVjOYLC6e3glWkBBVHC2RJ+w/qezCuT/2sV6Q5VYpowjvnf/iBJJqvpYBgBS+w6wVB5DLEOiTZHWy36nNheg0jUBs3PoJnMfyuOdAECqrZ3K7KcACGQp89RAtlysCphqZhPtRzYlcPx+ExklJUiq0le5omCfOGFAYn3qFKS/fZAWS7a3Y2wa+GJOEy4US+B3aaPUYJamj4oI5LA/jWQBt5HIK5+JfXzZsJVpXi/ac8+mxWIXWzAG4Wb4g/jscNMp63I4U5FcKaVvsNyFALokSA47Kx8PVk83OabCHZsiqwAKEpjmfUJIkoh/R+L9oTpjluhRkGSPG4A7EkS+Y3HZk0OXYpIVNy01P5yItnptDsvtIwr0SunqoVP1GG1taTHn1CloXm9aLBEIEDl/IS2W6rg+qIFEYR7+OJTesqJqYa95/VKBNOHLjDBZ8sDS2998a0Bs/F//gvu5Z9NivadOc/U3676pEsizBIN1jCYlhClL+ELJDrkobNUBfBZqQfMN305HAgnIeYi4OnYMh7q/AsAXSdXK+eH41sykxd+TV/AsXvR/MeARAttD9pSqF9nDNfSEoDQsb5O31zQFprcaV244JPY7bqG6Xd9K3C3ALgbfk3NzqNE6CdplZrVFL27eWR+UASb6479ULfhD5AzOlSuGFTE6OohebElbcb8fhxA4xEPUgdTK19hiNKCZgknB+Ep44E44d82cxqPPOKctCGXzTmsBXbV1j1S5XQhyHq6NvnABPylu46A7QmVLpP7w9pNz4IEb0YyOrnmjb8bjB129fDBRkDVj2ojFbYBnCHHb7HL+OC7KQXeEsmAiNrnTqLy3d3+s/bvlVmxpgffM1fyM5cfsPZLuK+YHnvHELl8eUlwV4BXim0r6QV+4gD9Nlnjbfg1vJGktbI5UbN/TcGmAAYDG84Gry/MLLl/zKouO2Xukq/YkCyuWYV5owTIGjhVFCPL6J7kLOTcH89ereF1r4qOsm3gjSevl85El1Z98cfhB3qBN9+dLp1fUTco+0OrVMnNjFuv0chYbBYT2HcBoa+8TALyWQOt/ImPHoFS9SI3WyRajgdt2mbJgIlbREplfveuLf/XXemjXX7v46ZxzPlfd8YlZ01My5MUEVdIY5rueYopw4fQHkbv7/rZkTw6JwjyalBCHur9iD9cI2mU0UzD3P9H6yZ1G5dt7Gwe96w07dl5fXj7vYqH2XsNovdTI6KMrlsAXhRyz7/C7FBO/DubdVq4nBLPaohcnBeMr3/2k4fhQ+Uc8995YPq2wMzNjww2X+vwNt1p00ynrd2yKDJAVN628sBX1hZIdxXdStU9G5W2bd9YHR5L3f/CNmJeY9G8WAAAAAElFTkSuQmCC' + } + + TriggerEvent('esx_phone:addSpecialContact', specialContact.name, specialContact.number, specialContact.base64Icon) +end) + +AddEventHandler('esx:onPlayerDeath', function(data) + OnPlayerDeath() +end) + +RegisterNetEvent('esx_ambulancejob:revive') +AddEventHandler('esx_ambulancejob:revive', function() + local playerPed = PlayerPedId() + local coords = GetEntityCoords(playerPed) + TriggerServerEvent('esx_ambulancejob:setDeathStatus', false) + + DoScreenFadeOut(800) + + while not IsScreenFadedOut() do + Citizen.Wait(50) + end + + local formattedCoords = { + x = ESX.Math.Round(coords.x, 1), + y = ESX.Math.Round(coords.y, 1), + z = ESX.Math.Round(coords.z, 1) + } + + RespawnPed(playerPed, formattedCoords, 0.0) + + StopScreenEffect('DeathFailOut') + DoScreenFadeIn(800) +end) + +-- Load unloaded IPLs +if Config.LoadIpl then + RequestIpl('Coroner_Int_on') -- Morgue +end From 1a501c27f21905f0c34736d0366af6418fdeb5d9 Mon Sep 17 00:00:00 2001 From: LeonAnderson48 <63073120+LeonAnderson48@users.noreply.github.com> Date: Thu, 14 May 2020 17:18:22 +0100 Subject: [PATCH 162/177] Update README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 5476caee..ff70c603 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,10 @@ ESX Ambulance Job is an plugin for ESX with features: - Adds death screen, with early respawn timer and bleed out timer - Vehicle garages, revive menu and more for on duty EMS +## What I changed + +- I changed the client/main.lua so that when a player dies and if they combat log, when joining back to your server it will kill them so it doesnt cause the force respawn. + ## Requirements * Auto mode From df425fb56b36ba86ea70f38fe2d00755b5769055 Mon Sep 17 00:00:00 2001 From: Kevin O'Byrne <62954271+TehZombiJesus@users.noreply.github.com> Date: Fri, 3 Jul 2020 12:42:11 -0400 Subject: [PATCH 163/177] Update fr.lua (#226) * Update fr.lua * Update fr.lua * Update fr.lua --- locales/fr.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/locales/fr.lua b/locales/fr.lua index fb750289..f9730423 100644 --- a/locales/fr.lua +++ b/locales/fr.lua @@ -33,7 +33,7 @@ Locales['fr'] = { ['revive_inprogress'] = 'réanimation en cours', ['revive_complete'] = 'vous avez réanimé ~y~%s~s~', ['revive_complete_award'] = 'vous avez réanimé ~y~%s~s~, ~g~$%s~s~', - ['revive_fail_offline'] = 'that player is no longer online', + ['revive_fail_offline'] = 'ce joueur n\'est plus en ligne', ['heal_inprogress'] = 'vous soignez...', ['heal_complete'] = 'vous avez soigné ~y~%s~s~', ['no_players'] = 'aucun joueur à proximité', @@ -43,7 +43,7 @@ Locales['fr'] = { ['boss_actions'] = 'action Patron', -- Misc ['invalid_amount'] = '~r~montant invalide~s~', - ['actions_prompt'] = 'press ~INPUT_CONTEXT~ access the ~y~Ambulance Actions~s~.', + ['actions_prompt'] = 'appuyez sur ~INPUT_CONTEXT~ accédez aux ~y~Actions d\'Ambulance~s~.', ['deposit_amount'] = 'montant du dépôt', ['money_withdraw'] = 'montant du retrait', ['fast_travel'] = 'appuyez sur ~INPUT_CONTEXT~ pour vous déplacer rapidement.', @@ -81,5 +81,5 @@ Locales['fr'] = { ['healed'] = 'vous avez été soigné.', -- Blips ['blip_hospital'] = 'hôpital', - ['blip_dead'] = 'unconscious player', + ['blip_dead'] = 'joueur inconscient', } From 61753c45d297b936268ddf339cdbf3b0d281eb80 Mon Sep 17 00:00:00 2001 From: SamBehner <37122399+SamBehner@users.noreply.github.com> Date: Fri, 3 Jul 2020 12:44:01 -0400 Subject: [PATCH 164/177] Fixed players always being combat logged (#259) Merging a temporary fix for players always being combat logged. --- server/main.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/main.lua b/server/main.lua index 664d7457..042470ee 100644 --- a/server/main.lua +++ b/server/main.lua @@ -288,7 +288,9 @@ ESX.RegisterServerCallback('esx_ambulancejob:getDeathStatus', function(source, c MySQL.Async.fetchScalar('SELECT is_dead FROM users WHERE identifier = @identifier', { ['@identifier'] = xPlayer.identifier }, function(isDead) - if isDead then + isDead = isDead == 1 and true or false + + if isDead == true then print(('[esx_ambulancejob] [^2INFO^7] "%s" attempted combat logging'):format(xPlayer.identifier)) end From 1225eb6379df7ba509f1c39de4ac122225031861 Mon Sep 17 00:00:00 2001 From: BrakingESX247 <67766145+BrakingESX247@users.noreply.github.com> Date: Mon, 20 Jul 2020 14:46:07 +0100 Subject: [PATCH 165/177] Reverting bad fix for combat logging. --- server/main.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/server/main.lua b/server/main.lua index 042470ee..2a171988 100644 --- a/server/main.lua +++ b/server/main.lua @@ -288,9 +288,8 @@ ESX.RegisterServerCallback('esx_ambulancejob:getDeathStatus', function(source, c MySQL.Async.fetchScalar('SELECT is_dead FROM users WHERE identifier = @identifier', { ['@identifier'] = xPlayer.identifier }, function(isDead) - isDead = isDead == 1 and true or false - if isDead == true then + if isDead then print(('[esx_ambulancejob] [^2INFO^7] "%s" attempted combat logging'):format(xPlayer.identifier)) end From e672c3072e3c2926248a2873e9fbc55da7c77463 Mon Sep 17 00:00:00 2001 From: SamBehner <37122399+SamBehner@users.noreply.github.com> Date: Mon, 20 Jul 2020 09:47:30 -0400 Subject: [PATCH 166/177] Stop autorespawning (#260) Probably fixing autorespawning. --- client/main.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/client/main.lua b/client/main.lua index 3596a306..79c5887b 100644 --- a/client/main.lua +++ b/client/main.lua @@ -3,6 +3,12 @@ local firstSpawn, PlayerLoaded = true, false isDead = false ESX = nil +AddEventHandler("onClientMapStart", function() + exports.spawnmanager:spawnPlayer() + Citizen.Wait(5000) + exports.spawnmanager:setAutoSpawn(false) +end) + Citizen.CreateThread(function() while ESX == nil do TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) From 0bf8a02e323f3c9e146669e9e71cff7e19d7a158 Mon Sep 17 00:00:00 2001 From: BrakingESX247 <67766145+BrakingESX247@users.noreply.github.com> Date: Mon, 20 Jul 2020 14:53:03 +0100 Subject: [PATCH 167/177] Check if revive reward is enabled. Co-Authored-By: Rheein --- server/main.lua | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/server/main.lua b/server/main.lua index 2a171988..7dce9a7f 100644 --- a/server/main.lua +++ b/server/main.lua @@ -16,10 +16,16 @@ AddEventHandler('esx_ambulancejob:revive', function(playerId) if xTarget then if deadPlayers[playerId] then - xPlayer.showNotification(_U('revive_complete_award', xTarget.name, Config.ReviveReward)) - xPlayer.addMoney(Config.ReviveReward) - xTarget.triggerEvent('esx_ambulancejob:revive') - deadPlayers[playerId] = nil + if Config.ReviveReward > 0 then + xPlayer.showNotification(_U('revive_complete_award', xTarget.name, Config.ReviveReward)) + xPlayer.addMoney(Config.ReviveReward) + xTarget.triggerEvent('esx_ambulancejob:revive') + deadPlayers[playerId] = nil + else + xPlayer.showNotification(_U('revive_complete', xTarget.name)) + xTarget.triggerEvent('esx_ambulancejob:revive') + deadPlayers[playerId] = nil + end else xPlayer.showNotification(_U('player_not_unconscious')) end From a444c128730078ef18747a83280c43486737849f Mon Sep 17 00:00:00 2001 From: BrakingESX247 <67766145+BrakingESX247@users.noreply.github.com> Date: Mon, 20 Jul 2020 14:57:31 +0100 Subject: [PATCH 168/177] Updating config.lua User-frendlier configuration file. --- config.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/config.lua b/config.lua index 7bb21f18..9993ff39 100644 --- a/config.lua +++ b/config.lua @@ -1,19 +1,19 @@ Config = {} -Config.DrawDistance = 100.0 +Config.DrawDistance = 20.0 -- How close do you need to be in order for the markers to be drawn (in GTA units). Config.Marker = {type = 1, x = 1.5, y = 1.5, z = 0.5, r = 102, g = 0, b = 102, a = 100, rotate = false} -Config.ReviveReward = 700 -- revive reward, set to 0 if you don't want it enabled -Config.AntiCombatLog = true -- enable anti-combat logging? -Config.LoadIpl = true -- disable if you're using fivem-ipl or other IPL loaders +Config.ReviveReward = 700 -- Revive reward, set to 0 if you don't want it enabled +Config.AntiCombatLog = true -- Enable anti-combat logging? (Removes Items when a player logs back after intentionally logging out while dead.) +Config.LoadIpl = true -- Disable if you're using fivem-ipl or other IPL loaders -Config.Locale = 'fr' +Config.Locale = 'en' Config.EarlyRespawnTimer = 60000 * 1 -- time til respawn is available Config.BleedoutTimer = 60000 * 10 -- time til the player bleeds out -Config.EnablePlayerManagement = false +Config.EnablePlayerManagement = false -- Enable society managing (If you are using esx_society). Config.RemoveWeaponsAfterRPDeath = true Config.RemoveCashAfterRPDeath = true From 0d158eed9b1d0c5bd14eed8bba10f0a744498fa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Richard=20L=C3=B6fwenberg?= Date: Thu, 6 Aug 2020 16:25:13 +0200 Subject: [PATCH 169/177] Spelling fixes sv.lua Added sv_esx_ambulancejob.sql --- locales/sv.lua | 8 +++---- localization/sv_esx_ambulancejob.sql | 33 ++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 localization/sv_esx_ambulancejob.sql diff --git a/locales/sv.lua b/locales/sv.lua index b0d736aa..67b20624 100644 --- a/locales/sv.lua +++ b/locales/sv.lua @@ -32,7 +32,7 @@ Locales['sv'] = { -- Action Menu ['revive_inprogress'] = 'en återupplivning har börjats', ['revive_complete'] = 'du har återupplivat ~y~%s~s~, bra jobbat!', - ['revive_complete_award'] = 'du har återupplivat ~y~%s~s~ och tjärnat ~g~%s SEK~s~ för dina tjänster, bra jobbat!', + ['revive_complete_award'] = 'du har återupplivat ~y~%s~s~ och tjänat ~g~%s SEK~s~ för dina tjänster, bra jobbat!', ['revive_fail_offline'] = 'den spelaren har lämnat servern', ['heal_inprogress'] = 'du behandlar patienten!', ['heal_complete'] = 'du har behandlat ~y~%s~s~', @@ -64,7 +64,7 @@ Locales['sv'] = { ['alert_ambulance'] = 'ambulanssamtal', -- Death ['respawn_available_in'] = 'respawn tillgänglig om ~b~%s:%s~s~', - ['respawn_bleedout_in'] = 'du kommer att blöda ut om ~b~%s:%s~s~\n', + ['respawn_bleedout_in'] = 'du kommer att förblöda om ~b~%s:%s~s~\n', ['respawn_bleedout_prompt'] = 'håll [~b~E~s~] för att respawna', ['respawn_bleedout_fine'] = 'håll [~b~E~s~] för att respawna, kostar ~g~%s SEK~s~', ['respawn_bleedout_fine_msg'] = 'du betalade ~r~%s SEK~s~ för att respawna.', @@ -74,9 +74,9 @@ Locales['sv'] = { -- Revive ['revive_help'] = 'återuppliva en spelare', -- Item - ['used_medikit'] = 'du har använt ~y~1x~s~ ~b~Medecinkit~s~', + ['used_medikit'] = 'du har använt ~y~1x~s~ ~b~Medicinkit~s~', ['used_bandage'] = 'du har använt ~y~1x~s~ ~b~Bandage~s~', - ['not_enough_medikit'] = 'du har inget ~b~Medecinkit~s~.', + ['not_enough_medikit'] = 'du har inget ~b~Medicinkit~s~.', ['not_enough_bandage'] = 'du har inget ~b~Bandage~s~.', ['healed'] = 'dina skador har blivit behandlade.', -- Blips diff --git a/localization/sv_esx_ambulancejob.sql b/localization/sv_esx_ambulancejob.sql new file mode 100644 index 00000000..ae1989c6 --- /dev/null +++ b/localization/sv_esx_ambulancejob.sql @@ -0,0 +1,33 @@ +USE `es_extended`; + +INSERT INTO `addon_account` (name, label, shared) VALUES + ('society_ambulance', 'Sjukvård', 1) +; + +INSERT INTO `addon_inventory` (name, label, shared) VALUES + ('society_ambulance', 'Sjukvård', 1) +; + +INSERT INTO `datastore` (name, label, shared) VALUES + ('society_ambulance', 'Sjukvård', 1) +; + +INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_female) VALUES + ('ambulance',0,'ambulance','Undersköterska',20,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), + ('ambulance',1,'doctor','Ambulanssjuksköterska',40,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), + ('ambulance',2,'chief_doctor','Läkare',60,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), + ('ambulance',3,'boss','Överläkare',80,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}') +; + +INSERT INTO `jobs` (name, label) VALUES + ('ambulance','Sjukvårdare') +; + +INSERT INTO `items` (name, label, weight) VALUES + ('bandage','Bandage', 2), + ('medikit','Förstahjälpen kit', 2) +; + +ALTER TABLE `users` + ADD `is_dead` TINYINT(1) NULL DEFAULT '0' +; From 1f721d16d20c89118c765580ac4077070cf6b44f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Richard=20L=C3=B6fwenberg?= Date: Tue, 25 Aug 2020 21:11:08 +0200 Subject: [PATCH 170/177] Changed medikit to have the "official" swedish name + small spelling fix --- locales/sv.lua | 8 ++++---- localization/sv_esx_ambulancejob.sql | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/locales/sv.lua b/locales/sv.lua index 67b20624..872aa10e 100644 --- a/locales/sv.lua +++ b/locales/sv.lua @@ -40,7 +40,7 @@ Locales['sv'] = { ['player_not_unconscious'] = 'spelaren är inte medvetslös!', ['player_not_conscious'] = 'spelaren är inte vid medvetande!', -- Boss Menu - ['boss_actions'] = 'chef meny', + ['boss_actions'] = 'chefsmeny', -- Misc ['invalid_amount'] = '~r~Ogiltig mängd', ['actions_prompt'] = 'tryck ~INPUT_CONTEXT~ för att öppna menyn.', @@ -50,7 +50,7 @@ Locales['sv'] = { ['open_pharmacy'] = 'tryck på ~INPUT_CONTEXT~ för att öppna apoteket.', ['pharmacy_menu_title'] = 'apotek', ['pharmacy_take'] = 'ta %s', - ['medikit'] = 'medicinkit', + ['medikit'] = 'akutväska', ['bandage'] = 'bandage', ['max_item'] = 'du har redan tillräckligt mycket på dig.', -- F6 Menu @@ -74,9 +74,9 @@ Locales['sv'] = { -- Revive ['revive_help'] = 'återuppliva en spelare', -- Item - ['used_medikit'] = 'du har använt ~y~1x~s~ ~b~Medicinkit~s~', + ['used_medikit'] = 'du har använt ~y~1x~s~ ~b~Akutväska~s~', ['used_bandage'] = 'du har använt ~y~1x~s~ ~b~Bandage~s~', - ['not_enough_medikit'] = 'du har inget ~b~Medicinkit~s~.', + ['not_enough_medikit'] = 'du har ingen ~b~Akutväska~s~.', ['not_enough_bandage'] = 'du har inget ~b~Bandage~s~.', ['healed'] = 'dina skador har blivit behandlade.', -- Blips diff --git a/localization/sv_esx_ambulancejob.sql b/localization/sv_esx_ambulancejob.sql index ae1989c6..ea22777f 100644 --- a/localization/sv_esx_ambulancejob.sql +++ b/localization/sv_esx_ambulancejob.sql @@ -25,7 +25,7 @@ INSERT INTO `jobs` (name, label) VALUES INSERT INTO `items` (name, label, weight) VALUES ('bandage','Bandage', 2), - ('medikit','Förstahjälpen kit', 2) + ('medikit','Akutväska', 2) ; ALTER TABLE `users` From 4bb34cf8e42bd03373a86df3d9ccf454481401b7 Mon Sep 17 00:00:00 2001 From: Tijn Date: Mon, 5 Oct 2020 01:11:39 +0200 Subject: [PATCH 171/177] Add nl.lua (#279) * Create nl.lua * Update fxmanifest.lua * Update nl.lua --- fxmanifest.lua | 2 ++ locales/nl.lua | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+) create mode 100644 locales/nl.lua diff --git a/fxmanifest.lua b/fxmanifest.lua index ba925897..a06b05ca 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -17,6 +17,7 @@ server_scripts { 'locales/sv.lua', 'locales/pl.lua', 'locales/cs.lua', + 'locales/nl.lua', 'config.lua', 'server/main.lua' } @@ -31,6 +32,7 @@ client_scripts { 'locales/sv.lua', 'locales/pl.lua', 'locales/cs.lua', + 'locales/nl.lua', 'config.lua', 'client/main.lua', 'client/job.lua', diff --git a/locales/nl.lua b/locales/nl.lua new file mode 100644 index 00000000..91b54447 --- /dev/null +++ b/locales/nl.lua @@ -0,0 +1,85 @@ +Locales['nl'] = { + -- Cloakroom + ['cloakroom'] = 'Kleedkamer', + ['ems_clothes_civil'] = 'Burgerkleding', + ['ems_clothes_ems'] = 'Ambulance Kleding', + -- Vehicles + ['ambulance'] = 'Ambulance', + ['helicopter_prompt'] = 'Druk op ~INPUT_CONTEXT~ om de ~y~Lifeliners~s~ te beheren.', + ['garage_prompt'] = 'Druk op ~INPUT_CONTEXT~ om de ~y~Garage~s~ te openen.', + ['garage_title'] = 'Garage', + ['garage_stored'] = 'In Garage', + ['garage_notstored'] = 'Niet In Garage', + ['garage_storing'] = 'We proberen je voertuig op te bergen, zorg dat er niemand in de buurt is.', + ['garage_has_stored'] = 'Je voertuig is in de garage gezet', + ['garage_has_notstored'] = 'Er zijn geen voertuigen in de buurt gevonden die van jou zijn', + ['garage_notavailable'] = 'Je voertuig staat niet in de garage.', + ['garage_blocked'] = 'Er is geen spawnplek beschikbaar!', + ['garage_empty'] = 'Er staat geen voertuig in je garage.', + ['garage_released'] = 'Je voertuig is uit de garage gehaald.', + ['garage_store_nearby'] = 'Er zijn geen voertuigen in de buurt.', + ['garage_storeditem'] = 'Open garage', + ['garage_storeitem'] = 'Zet voertuig in de garage', + ['garage_buyitem'] = 'Voertuigwinkel', + ['shop_item'] = '€%s', + ['vehicleshop_title'] = 'Voertuigwinkel', + ['vehicleshop_confirm'] = 'Wil je dit voertuig kopen?', + ['vehicleshop_bought'] = 'Je hebt een ~y~%s~s~ gekocht voor ~g~€%s~s~', + ['vehicleshop_money'] = 'Je kan dit voertuig niet betalen', + ['vehicleshop_awaiting_model'] = 'Het voertuig is aan het ~g~DOWNLOADEN & LADEN~s~, even geduld', + ['confirm_no'] = 'Nee', + ['confirm_yes'] = 'Ja', + -- Action Menu + ['revive_inprogress'] = 'Reanimatie is in gang gezet!', + ['revive_complete'] = 'Je hebt ~y~%s~s~ gereanimeerd', + ['revive_complete_award'] = 'Je hebt ~y~%s~s~ gereanimeerd en ~g~€%s~s~ verdient!', + ['revive_fail_offline'] = 'Deze speler is niet langer online', + ['heal_inprogress'] = 'Je wordt genezen!', + ['heal_complete'] = 'Je hebt ~y~%s~s~ genezen', + ['no_players'] = 'Geen spelers in de buurt', + ['player_not_unconscious'] = 'Deze persoon is niet bewusteloos!', + ['player_not_conscious'] = 'Deze persoon is bewusteloos!', + -- Boss Menu + ['boss_actions'] = 'Manager Acties', + -- Misc + ['invalid_amount'] = '~r~Ongeldig aantal', + ['actions_prompt'] = 'Druk op ~INPUT_CONTEXT~ om de ~y~Ambulance Acties~s~ te bekijken.', + ['deposit_amount'] = 'Bedrag om te storten', + ['money_withdraw'] = 'Bedrag om op te nemen', + ['fast_travel'] = 'Druk op ~INPUT_CONTEXT~ om snel te reizen.', + ['open_pharmacy'] = 'Druk op ~INPUT_CONTEXT~ om de apotheek te openen.', + ['pharmacy_menu_title'] = 'Apotheek', + ['pharmacy_take'] = 'Pak %s', + ['medikit'] = 'Spoedkoffer', + ['bandage'] = 'Verbanddoos', + ['max_item'] = 'Je draagt al genoeg bij je.', + -- F6 Menu + ['ems_menu'] = 'Ambulance Menu', + ['ems_menu_title'] = 'Ambulance - Menu', + ['ems_menu_revive'] = 'Reanimeer speler', + ['ems_menu_putincar'] = 'Zet in voertuig', + ['ems_menu_small'] = 'Behandel kleine verwondingen', + ['ems_menu_big'] = 'Behandel grote verwondingen', + -- Phone + ['alert_ambulance'] = 'alert Ambulance', + -- Death + ['respawn_available_in'] = 'Respawn beschikbaar in ~b~%s minuten en %s seconden~s~', + ['respawn_bleedout_in'] = 'Je zal doodbloeden in ~b~%s minuten %s seconden~s~\n', + ['respawn_bleedout_prompt'] = 'Houd [~b~E~s~] ingedrukt om te respawnen', + ['respawn_bleedout_fine'] = 'Houd [~b~E~s~] ingedrukt om te respawnen voor ~g~€%s~s~', + ['respawn_bleedout_fine_msg'] = 'Je hebt ~r~€%s~s~ betaald om te respawnen.', + ['distress_send'] = 'Druk op [~b~G~s~] om een noodsignaal te verzenden', + ['distress_sent'] = 'Noodsignaal verzonden naar alle beschikbare eenheden!', + ['combatlog_message'] = 'Je bent gerespawned omdat je uitgelogt bent terwijl je dood was.', + -- Revive + ['revive_help'] = 'Revive een speler', + -- Item + ['used_medikit'] = 'Je hebt ~y~1~s~ spoedkoffer gebruikt', + ['used_bandage'] = 'Je hebt ~y~1~s~ verbandkoffer gebruikt', + ['not_enough_medikit'] = 'Je hebt geen ~b~spoedkoffer~s~ bij.', + ['not_enough_bandage'] = 'Je hebt geen ~b~verbandkoffer~s~ bij.', + ['healed'] = 'Je bent behandeld.', + -- Blips + ['blip_hospital'] = 'Ziekenhuis', + ['blip_dead'] = 'Bewusteloze speler', +} From 28eaf93c06fcb07c557e7bfa0a33c3a91735972f Mon Sep 17 00:00:00 2001 From: FunnyBuddys Date: Thu, 29 Oct 2020 20:36:01 +0100 Subject: [PATCH 172/177] Added german language file --- locales/de.lua | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 locales/de.lua diff --git a/locales/de.lua b/locales/de.lua new file mode 100644 index 00000000..3da9bbdf --- /dev/null +++ b/locales/de.lua @@ -0,0 +1,85 @@ +Locales['de'] = { + -- Cloakroom + ['cloakroom'] = 'Umkleide', + ['ems_clothes_civil'] = 'Zivil', + ['ems_clothes_ems'] = 'Uniform', + -- Vehicles + ['ambulance'] = 'Rettungsdienst', + ['helicopter_prompt'] = 'Drücke ~INPUT_CONTEXT~ um auf das ~y~Helikopter-Menü~s~ zuzugreifen.', + ['garage_prompt'] = 'Drücke ~INPUT_CONTEXT~ um auf das ~y~Fahrzeug-Menü~s~ zuzugreifen.', + ['garage_title'] = 'Fahrzeugmenü', + ['garage_stored'] = 'gelagert', + ['garage_notstored'] = 'nicht in der Garage', + ['garage_storing'] = 'Wir versuchen das Fahrzeug einzulagern. Bitte stelle sicher, dass sich kein Spieler in der Nähe des Fahrzeugs befindet.', + ['garage_has_stored'] = 'Das Fahrzeug wurde in deiner Garage eingelagert.', + ['garage_has_notstored'] = 'Es wurde kein Fahrzeug in der Nähe gefunden, dass dir gehört.', + ['garage_notavailable'] = 'Dein Fahrzeug ist nicht in der Garage.', + ['garage_blocked'] = 'Es existieren keine verfügbaren Spawnpoints!', + ['garage_empty'] = 'Du hast keine Fahrzeuge in deiner Garage.', + ['garage_released'] = 'Dein Fahrzeug wurde aus der Garage gefahren.', + ['garage_store_nearby'] = 'Es sind keine Fahrzeuge in der Nähe.', + ['garage_storeditem'] = 'Öffne Garage', + ['garage_storeitem'] = 'Fahrzeug in der Garage einlagern', + ['garage_buyitem'] = 'Fahrzeug-Shop', + ['shop_item'] = '$%s', + ['vehicleshop_title'] = 'Fahrzeug-Shop', + ['vehicleshop_confirm'] = 'Du möchstest dieses Fahrzeug kaufen?', + ['vehicleshop_bought'] = 'Du hast dir einen ~y~%s~s~ für ~g~$%s~s~ gekauft!', + ['vehicleshop_money'] = 'Du kannst dir dieses Fahrzeug nicht leisten!', + ['vehicleshop_awaiting_model'] = 'Dieses Fahrzeug ~g~LÄDT~s~ bitte warte', + ['confirm_no'] = 'Nein', + ['confirm_yes'] = 'Ja', + -- Action Menu + ['revive_inprogress'] = 'Eine Wiederbelebung findet statt!', + ['revive_complete'] = 'Du hast ~y~%s~s~ wiederbelebt', + ['revive_complete_award'] = 'Du hast ~y~%s~s~ wiederbelebt und dabei ~g~$%s~s~ erhalten!', + ['revive_fail_offline'] = 'Dieser Spieler ist nicht länger online', + ['heal_inprogress'] = 'Du heilst!', + ['heal_complete'] = 'yDu hast ~y~%s~s~ geheilt!', + ['no_players'] = 'Keine Spieler in der Nähe', + ['player_not_unconscious'] = 'Diese Spieler ist nicht bewusstlos!', + ['player_not_conscious'] = 'Dieser Spieler ist nicht bei Bewusstsein!', + -- Boss Menu + ['boss_actions'] = 'Chef-Aktionen', + -- Misc + ['invalid_amount'] = '~r~Ungültige Menge', + ['actions_prompt'] = 'Drücke ~INPUT_CONTEXT~ um das ~y~Rettungsdienst-Menü~s~ zu öffnen.', + ['deposit_amount'] = 'Menge deponieren', + ['money_withdraw'] = 'Menge abheben', + ['fast_travel'] = 'Drücke ~INPUT_CONTEXT~ zu schnellreisen.', + ['open_pharmacy'] = 'Drücke ~INPUT_CONTEXT~ um die Apotheke zu öffnen.', + ['pharmacy_menu_title'] = 'Apotheke', + ['pharmacy_take'] = 'Nimm %s', + ['medikit'] = 'Medikit', + ['bandage'] = 'Verbände', + ['max_item'] = 'Du trägst bereits genug.', + -- F6 Menu + ['ems_menu'] = 'Rettungsdienst-Menü', + ['ems_menu_title'] = 'Rettungsdienst-Menü', + ['ems_menu_revive'] = 'Spieler wiederbeleben', + ['ems_menu_putincar'] = 'In Fahrzeug stecken', + ['ems_menu_small'] = 'Kleine Wunden behandeln', + ['ems_menu_big'] = 'Ernsthafte Verletzungen behandeln', + -- Phone + ['alert_ambulance'] = 'Rettungsdienst alarmieren', + -- Death + ['respawn_available_in'] = 'Respawn in ~b~%s Minuten %s Sekunden~s~ verfügbar', + ['respawn_bleedout_in'] = 'Du wirst in ~b~%s Minuten %s Sekunden~s~ ausbluten\n', + ['respawn_bleedout_prompt'] = 'Drücke [~b~E~s~] um zu respawnen', + ['respawn_bleedout_fine'] = 'Drücke [~b~E~s~] um für ~g~$%s~s~ zu respawnen', + ['respawn_bleedout_fine_msg'] = 'Du hast ~r~$%s~s~ bezahlt, um zu respawnen.', + ['distress_send'] = 'Drücke [~b~G~s~] um ein Notsignal zu senden', + ['distress_sent'] = 'Notsignal wurde an den Rettungsdienst übermittelt!', + ['combatlog_message'] = 'Du wurdest respawnt, da du den Server verlassen hast, als du gestorben bist.', + -- Revive + ['revive_help'] = 'Belebe einen Spieler wieder', + -- Item + ['used_medikit'] = 'Du hast ~y~ein~s~ Medikit verwendet', + ['used_bandage'] = 'Du hast ~y~einen~s~ Verband verwendet', + ['not_enough_medikit'] = 'Du hast keine ~b~Medikits~s~.', + ['not_enough_bandage'] = 'Du hast keine ~b~Verbände~s~.', + ['healed'] = 'Du wurdest behandelt.', + -- Blips + ['blip_hospital'] = 'Krankenhaus', + ['blip_dead'] = 'Bewusstloser Spieler', +} From b3d2ec4aa55f366bc15e19110df669f3a529f572 Mon Sep 17 00:00:00 2001 From: ItsManueh <47420352+ItsManueh@users.noreply.github.com> Date: Sun, 1 Nov 2020 14:19:08 +0100 Subject: [PATCH 173/177] Language to Spanish fully translated to full --- locales/es.lua | 136 +++++++++++++++++++++++++------------------------ 1 file changed, 69 insertions(+), 67 deletions(-) diff --git a/locales/es.lua b/locales/es.lua index e231db54..91f95c6c 100644 --- a/locales/es.lua +++ b/locales/es.lua @@ -1,85 +1,87 @@ +-- Traducción by https://github.com/ItsManueh + Locales['es'] = { -- Cloakroom ['cloakroom'] = 'Guardarropa', ['ems_clothes_civil'] = 'Camiseta', ['ems_clothes_ems'] = 'Equipo de ambulancia', -- Vehicles - ['ambulance'] = 'ambulance', - ['helicopter_prompt'] = 'press ~INPUT_CONTEXT~ to access the ~y~Helicopter Actions~s~.', - ['garage_prompt'] = 'press ~INPUT_CONTEXT~ to access the ~y~Vehicle Actions~s~.', - ['garage_title'] = 'vehicle Actions', - ['garage_stored'] = 'stored', - ['garage_notstored'] = 'not in garage', - ['garage_storing'] = 'we\'re attempting to remove the vehicle, make sure no players are around it.', - ['garage_has_stored'] = 'the vehicle has been stored in your garage', - ['garage_has_notstored'] = 'no nearby owned vehicles were found', - ['garage_notavailable'] = 'your vehicle is not stored in the garage.', - ['garage_blocked'] = 'there\'s no available spawn points!', - ['garage_empty'] = 'you dont have any vehicles in your garage.', - ['garage_released'] = 'your vehicle has been released from the garage.', - ['garage_store_nearby'] = 'there is no nearby vehicles.', - ['garage_storeditem'] = 'open garage', - ['garage_storeitem'] = 'store vehicle in garage', - ['garage_buyitem'] = 'vehicle shop', + ['ambulance'] = 'Ambulancia', + ['helicopter_prompt'] = 'Presiona ~INPUT_CONTEXT~ para acceder al ~y~Acciones de helicópteros~s~.', + ['garage_prompt'] = 'Presiona ~INPUT_CONTEXT~ para acceder al ~y~Acciones de vehículos~s~.', + ['garage_title'] = 'Acciones de vehículos', + ['garage_stored'] = 'Almacenado', + ['garage_notstored'] = 'No en el garaje', + ['garage_storing'] = 'Estamos intentando retirar el vehículo, asegúrese de que no haya jugadores a su alrededor.', + ['garage_has_stored'] = 'El vehículo se ha guardado en su garaje', + ['garage_has_notstored'] = 'No se encontraron vehículos de propiedad cercana', + ['garage_notavailable'] = 'Su vehículo no está guardado en el garaje.', + ['garage_blocked'] = '¡No hay puntos de generación disponibles!', + ['garage_empty'] = 'No tiene ningún vehículo en su garaje.', + ['garage_released'] = 'Su vehículo ha sido sacado del garaje.', + ['garage_store_nearby'] = 'No hay vehículos cercanos.', + ['garage_storeditem'] = 'Garaje abierto', + ['garage_storeitem'] = 'Almacenar vehículo en garaje', + ['garage_buyitem'] = 'Tienda de vehículos', ['shop_item'] = '$%s', - ['vehicleshop_title'] = 'vehicle Shop', - ['vehicleshop_confirm'] = 'do you want to buy this vehicle?', - ['vehicleshop_bought'] = 'you have bought ~y~%s~s~ for ~g~$%s~s~', - ['vehicleshop_money'] = 'you cannot afford that vehicle', - ['vehicleshop_awaiting_model'] = 'the vehicle is currently ~g~DOWNLOADING & LOADING~s~ please wait', - ['confirm_no'] = 'no', - ['confirm_yes'] = 'yes', + ['vehicleshop_title'] = 'Tienda de vehículos', + ['vehicleshop_confirm'] = '¿Quieres comprar este vehículo?', + ['vehicleshop_bought'] = 'Usted ha comprado ~y~%s~s~ para ~g~$%s~s~', + ['vehicleshop_money'] = 'No puedes pagar ese vehículo', + ['vehicleshop_awaiting_model'] = 'El vehículo está actualmente ~g~DESCARGANDO & CARGANDO~s~ por favor espere.', + ['confirm_no'] = 'No', + ['confirm_yes'] = 'Si', -- Action Menu - ['revive_inprogress'] = 'reanimación en curso', - ['revive_complete'] = 'has sido reanimado ~y~%s~s~', - ['revive_complete_award'] = 'has sido reanimado ~y~%s~s~, ~g~$%s~s~', - ['revive_fail_offline'] = 'that player is no longer online', - ['heal_inprogress'] = 'you are healing!', - ['heal_complete'] = 'you have healed ~y~%s~s~', - ['no_players'] = 'ningún jugador cerca', - ['player_not_unconscious'] = 'n\'estás inconsciente', - ['player_not_conscious'] = 'that player is not conscious!', + ['revive_inprogress'] = 'Reanimación en curso', + ['revive_complete'] = 'Has sido reanimado ~y~%s~s~', + ['revive_complete_award'] = 'Has sido reanimado ~y~%s~s~, ~g~$%s~s~', + ['revive_fail_offline'] = 'Ese jugador ya no está en línea', + ['heal_inprogress'] = '!Te estas curando!', + ['heal_complete'] = 'Te has curado ~y~%s~s~', + ['no_players'] = 'Ningún jugador cerca', + ['player_not_unconscious'] = 'n\'Estás inconsciente', + ['player_not_conscious'] = '¡Ese jugador no está consciente!', -- Boss Menu - ['boss_actions'] = 'boss Actions', + ['boss_actions'] = 'Acciones del jefe', -- Misc - ['invalid_amount'] = '~r~cantidad no válida', - ['actions_prompt'] = 'press ~INPUT_CONTEXT~ access the ~y~Ambulance Actions~s~.', - ['deposit_amount'] = 'cantidad de fianza depositada', - ['money_withdraw'] = 'cantidad de fianza retirada', - ['fast_travel'] = 'Press ~INPUT_CONTEXT~ to fast travel.', - ['open_pharmacy'] = 'Press ~INPUT_CONTEXT~ to open the pharmacy.', - ['pharmacy_menu_title'] = 'Pharmacy', - ['pharmacy_take'] = 'take %s', - ['medikit'] = 'medikit', - ['bandage'] = 'bandage', - ['max_item'] = 'You are already carrying enough on yourself.', + ['invalid_amount'] = '~r~Cantidad no válida', + ['actions_prompt'] = 'Presiona ~INPUT_CONTEXT~ acceder al ~y~Acciones de ambulancia~s~.', + ['deposit_amount'] = 'Cantidad de fianza depositada', + ['money_withdraw'] = 'Cantidad de fianza retirada', + ['fast_travel'] = 'Presiona ~INPUT_CONTEXT~ para viajar rápido.', + ['open_pharmacy'] = 'Presiona ~INPUT_CONTEXT~ para abrir la farmacia.', + ['pharmacy_menu_title'] = 'Farmacia', + ['pharmacy_take'] = 'tomar %s', + ['medikit'] = 'Kit médico', + ['bandage'] = 'Vendas', + ['max_item'] = 'Ya has ocupado el máximo número de items disponibles.', -- F6 Menu - ['ems_menu'] = 'ayuda ciudadana', - ['ems_menu_title'] = 'ambulancia - Ayuda Ciudadana', - ['ems_menu_revive'] = 'reanimar', - ['ems_menu_putincar'] = 'meter en el vehículo', - ['ems_menu_small'] = 'heal small wounds', - ['ems_menu_big'] = 'treat serious injuries', + ['ems_menu'] = 'Ayuda ciudadana', + ['ems_menu_title'] = 'Ambulancia - Ayuda Ciudadana', + ['ems_menu_revive'] = 'Reanimar', + ['ems_menu_putincar'] = 'Meter en el vehículo', + ['ems_menu_small'] = 'Curar pequeñas heridas', + ['ems_menu_big'] = 'Tratar lesiones graves', -- Phone ['alert_ambulance'] = 'Alerta de ambulancia', -- Death - ['respawn_available_in'] = 'respawn available in ~b~%s minutes %s seconds~s~', - ['respawn_bleedout_in'] = 'you will bleed out in ~b~%s minutes %s seconds~s~\n', - ['respawn_bleedout_prompt'] = 'hold [~b~E~s~] to respawn', - ['respawn_bleedout_fine'] = 'hold [~b~E~s~] to respawn for ~g~$%s~s~', - ['respawn_bleedout_fine_msg'] = 'you paid ~r~$%s~s~ to respawn.', - ['distress_send'] = 'press [~b~G~s~] to send distress signal', - ['distress_sent'] = 'distress signal has been sent to available units!', - ['combatlog_message'] = 'you have been force-respawned because you\'ve previously left the server when dead.', + ['respawn_available_in'] = 'Reaparición disponible en ~b~%s minutes %s seconds~s~', + ['respawn_bleedout_in'] = 'te desangrarás en ~b~%s minutes %s seconds~s~\n', + ['respawn_bleedout_prompt'] = 'Mantén [~b~E~s~] reaparecer', + ['respawn_bleedout_fine'] = 'Mantén [~b~E~s~] para reaparecer ~g~$%s~s~', + ['respawn_bleedout_fine_msg'] = 'Tu pagaste ~r~$%s~s~ para reaparecer.', + ['distress_send'] = 'Presiona [~b~G~s~] para enviar señal de socorro', + ['distress_sent'] = 'Se ha enviado una señal de socorro a las unidades disponibles.', + ['combatlog_message'] = 'Ha sido reaparecido a la fuerza porque anteriormente abandonó el servidor cuando estaba muerto.', -- Revive - ['revive_help'] = 'reviver un jugador', + ['revive_help'] = 'Revivir un jugador', -- Item - ['used_medikit'] = 'You have used ~y~1x~s~ medikit', - ['used_bandage'] = 'You have used ~y~1x~s~ bandage', - ['not_enough_medikit'] = 'You do not have ~b~medikit~s~.', - ['not_enough_bandage'] = 'You do not have ~b~bandage~s~.', - ['healed'] = 'you have been treated.', + ['used_medikit'] = 'Has usado ~y~1x~s~ Kit médico', + ['used_bandage'] = 'Has usado ~y~1x~s~ Vendas', + ['not_enough_medikit'] = 'Usted no tiene ~b~Kit médico~s~.', + ['not_enough_bandage'] = 'Usted no tiene ~b~Vendas~s~.', + ['healed'] = 'Has sido tratado.', -- Blips - ['blip_hospital'] = 'hospital', - ['blip_dead'] = 'unconscious player', + ['blip_hospital'] = 'Hospital', + ['blip_dead'] = 'Jugador inconsciente', } From ab4e6d361bfbcf388997166765ca2229e315fdcc Mon Sep 17 00:00:00 2001 From: FunnyBuddys Date: Sat, 14 Nov 2020 14:59:13 +0100 Subject: [PATCH 174/177] Add German --- fxmanifest.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/fxmanifest.lua b/fxmanifest.lua index a06b05ca..33a6469d 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -16,6 +16,7 @@ server_scripts { 'locales/es.lua', 'locales/sv.lua', 'locales/pl.lua', + 'locales/de.lua', 'locales/cs.lua', 'locales/nl.lua', 'config.lua', From 4d0c04566577e4f59b27832302b71aef1a2bda03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C3=BCrkay=20Tanr=C4=B1kulu?= Date: Sat, 19 Dec 2020 23:10:17 +0300 Subject: [PATCH 175/177] Turkish translation implemented --- fxmanifest.lua | 2 + locales/tr.lua | 85 ++++++++++++++++++++++++++++ localization/tr_esx_ambulancejob.sql | 33 +++++++++++ 3 files changed, 120 insertions(+) create mode 100644 locales/tr.lua create mode 100644 localization/tr_esx_ambulancejob.sql diff --git a/fxmanifest.lua b/fxmanifest.lua index a06b05ca..1a078075 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -18,6 +18,7 @@ server_scripts { 'locales/pl.lua', 'locales/cs.lua', 'locales/nl.lua', + 'locales/tr.lua', 'config.lua', 'server/main.lua' } @@ -33,6 +34,7 @@ client_scripts { 'locales/pl.lua', 'locales/cs.lua', 'locales/nl.lua', + 'locales/tr.lua', 'config.lua', 'client/main.lua', 'client/job.lua', diff --git a/locales/tr.lua b/locales/tr.lua new file mode 100644 index 00000000..024bda63 --- /dev/null +++ b/locales/tr.lua @@ -0,0 +1,85 @@ +Locales['tr'] = { + -- Cloakroom + ['cloakroom'] = 'soyunma Odası', + ['ems_clothes_civil'] = 'sivil Kıyafetler', + ['ems_clothes_ems'] = 'acil Servis Kıyafetleri', + -- Vehicles + ['ambulance'] = 'medikal', + ['helicopter_prompt'] = '~y~Helikopter~s~ için ~INPUT_CONTEXT~ tuşuna basın.', + ['garage_prompt'] = '~y~Araba Garajı~s~ için ~INPUT_CONTEXT~ tuşuna basın', + ['garage_title'] = 'araba Garajı', + ['garage_stored'] = 'garaja koyuldu', + ['garage_notstored'] = 'garajda değil', + ['garage_storing'] = 'arabayı çıkarmaya çalışıyoruz, etrafta oyuncu olmadığından emin olun.', + ['garage_has_stored'] = 'araba garaja koyuldu', + ['garage_has_notstored'] = 'yakında sahibi olunan araba yok', + ['garage_notavailable'] = 'araba garajda değil', + ['garage_blocked'] = 'kullanılabilir spawn noktası yok!', + ['garage_empty'] = 'garajda araba yok', + ['garage_released'] = 'arabanız garajdan çıkarıldı.', + ['garage_store_nearby'] = 'yakınlarda araba yok', + ['garage_storeditem'] = 'garajdaki arabalar', + ['garage_storeitem'] = 'arabayı garaja koy', + ['garage_buyitem'] = 'araba galerisi', + ['shop_item'] = '%s TL', + ['vehicleshop_title'] = 'araba Galerisi', + ['vehicleshop_confirm'] = 'bu arabayı almak istiyor musun?', + ['vehicleshop_bought'] = '~g~%s~s~ liraya ~y~%s~s~ alındı', + ['vehicleshop_money'] = 'bu araca paranız yetmiyor', + ['vehicleshop_awaiting_model'] = 'bu araba şuanda ~g~İNDİRME & YÜKLEME~s~ yapıyor', + ['confirm_no'] = 'hayır', + ['confirm_yes'] = 'evet', + -- Action Menu + ['revive_inprogress'] = 'Canlanma sürüyor!', + ['revive_complete'] = '~y~%s~s~ canlandırıldı', + ['revive_complete_award'] = '~y~%s~s~ canlandırıldın ve ~g~$%s~s~ kazandın!', + ['revive_fail_offline'] = 'bu oyuncu artık online değil', + ['heal_inprogress'] = 'iyileştiriliyorsun!', + ['heal_complete'] = '~y~%s~s~ iyileştirildi', + ['no_players'] = 'yakınlarda oyuncu yok', + ['player_not_unconscious'] = 'bu oyuncunun bilinci yerinde!', + ['player_not_conscious'] = 'bu oyuncunun bilinci yerinde değil!', + -- Boss Menu + ['boss_actions'] = 'baş Hekim', + -- Misc + ['invalid_amount'] = '~r~Hatalı miktar', + ['actions_prompt'] = '~y~Kıyafet Değiştirmek~s~ için ~INPUT_CONTEXT~ tuşuna basın.', + ['deposit_amount'] = 'bırakılacak miktar', + ['money_withdraw'] = 'alınacak miktar', + ['fast_travel'] = '~INPUT_CONTEXT~ tuşuna basarak hızlı yolculuk edebilirsiniz.', + ['open_pharmacy'] = '~y~Eczane~s~ için ~INPUT_CONTEXT~ tuşuna basın.', + ['pharmacy_menu_title'] = 'eczane', + ['pharmacy_take'] = 'al %s', + ['medikit'] = 'sağlık kiti', + ['bandage'] = 'bandaj', + ['max_item'] = 'zaten yeterince üzerinde var', + -- F6 Menu + ['ems_menu'] = 'EMS Menu', + ['ems_menu_title'] = 'medikal - EMS Menu', + ['ems_menu_revive'] = 'oyuncuyu Canlandır', + ['ems_menu_putincar'] = 'araca koy', + ['ems_menu_small'] = 'küçük yaraları tedavi et', + ['ems_menu_big'] = 'ciddi yaraları tedavi et', + -- Phone + ['alert_ambulance'] = 'hastane Acil Durum', + -- Death + ['respawn_available_in'] = 'yeniden canlanmana ~b~%s dakika %s saniye~s~ kaldı', + ['respawn_bleedout_in'] = 'kanama ~b~%s dakika %s saniye~s~ boyunca devam edecek\n', + ['respawn_bleedout_prompt'] = 'yeniden canlanma için [~b~E~s~] basılı tut', + ['respawn_bleedout_fine'] = '~g~%s~s~ lira karşılığında canlanma için [~b~E~s~] basılı tut', + ['respawn_bleedout_fine_msg'] = 'yeniden doğmak için ~r~$%s~s~ ödediniz.', + ['distress_send'] = 'acile sinyal göndermek için [~b~G~s~] basın', + ['distress_sent'] = 'acil durum sinyali gönderildi!', + ['combatlog_message'] = 'daha önce öldüğünüzde sunucudan ayrıldığınız için zorunlu olarak yeniden doğdunuz.', + -- Revive + ['revive_help'] = 'oyuncuyu canlandır', + -- Item + ['used_medikit'] = '~y~1x~s~ sağlık kiti kullanıldı.', + ['used_bandage'] = '~y~1x~s~ bandaj kullanıldı.', + ['not_enough_medikit'] = '~b~sağlık kiti~s~ yok.', + ['not_enough_bandage'] = '~b~bandaj~s~. yok', + ['healed'] = 'tedavi görüldü.', + -- Blips + ['blip_hospital'] = 'hastane', + ['blip_dead'] = 'bilinci kapalı oyuncu', + } diff --git a/localization/tr_esx_ambulancejob.sql b/localization/tr_esx_ambulancejob.sql new file mode 100644 index 00000000..d6c253d7 --- /dev/null +++ b/localization/tr_esx_ambulancejob.sql @@ -0,0 +1,33 @@ +USE `es_extended`; + +INSERT INTO `addon_account` (name, label, shared) VALUES + ('society_ambulance', 'EMS', 1) +; + +INSERT INTO `addon_inventory` (name, label, shared) VALUES + ('society_ambulance', 'EMS', 1) +; + +INSERT INTO `datastore` (name, label, shared) VALUES + ('society_ambulance', 'EMS', 1) +; + +INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_female) VALUES + ('ambulance',0,'ambulance','Acil Tıp Teknisyeni',20,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), + ('ambulance',1,'doctor','Doktor',40,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), + ('ambulance',2,'chief_doctor','Kdemli Doktor',60,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'), + ('ambulance',3,'boss','Baş Hekim',80,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}') +; + +INSERT INTO `jobs` (name, label) VALUES + ('ambulance','EMS') +; + +INSERT INTO `items` (name, label, weight) VALUES + ('bandage','Bandaj', 2), + ('medikit','Sağlık Kiti', 2) +; + +ALTER TABLE `users` + ADD `is_dead` TINYINT(1) NULL DEFAULT '0' +; From 2931d8d98f8bd970ad05ee10bf38d23940e29098 Mon Sep 17 00:00:00 2001 From: Christopher Wong Date: Sun, 17 Jan 2021 01:17:21 +0800 Subject: [PATCH 176/177] Fix patient blip not removed after revival --- server/main.lua | 2 -- 1 file changed, 2 deletions(-) diff --git a/server/main.lua b/server/main.lua index 7dce9a7f..de785173 100644 --- a/server/main.lua +++ b/server/main.lua @@ -20,11 +20,9 @@ AddEventHandler('esx_ambulancejob:revive', function(playerId) xPlayer.showNotification(_U('revive_complete_award', xTarget.name, Config.ReviveReward)) xPlayer.addMoney(Config.ReviveReward) xTarget.triggerEvent('esx_ambulancejob:revive') - deadPlayers[playerId] = nil else xPlayer.showNotification(_U('revive_complete', xTarget.name)) xTarget.triggerEvent('esx_ambulancejob:revive') - deadPlayers[playerId] = nil end else xPlayer.showNotification(_U('player_not_unconscious')) From d2a55d34e42b958c5f86615f052de4144f4bdce9 Mon Sep 17 00:00:00 2001 From: ArkSeyonet <31637812+ArkSeyonet@users.noreply.github.com> Date: Mon, 1 Feb 2021 14:07:57 -0600 Subject: [PATCH 177/177] Update README.md --- README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.md b/README.md index ff70c603..5476caee 100644 --- a/README.md +++ b/README.md @@ -5,10 +5,6 @@ ESX Ambulance Job is an plugin for ESX with features: - Adds death screen, with early respawn timer and bleed out timer - Vehicle garages, revive menu and more for on duty EMS -## What I changed - -- I changed the client/main.lua so that when a player dies and if they combat log, when joining back to your server it will kill them so it doesnt cause the force respawn. - ## Requirements * Auto mode