mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-09-04 08:13:21 +00:00
Update 1.4.1: bug fixes
Fixed Ambulancejob, Fix giving Items,Start Replacing `GetDistanceBetweenCoords` with Vector Maths
This commit is contained in:
@@ -850,7 +850,7 @@ ESX.ShowInventory = function()
|
||||
players[GetPlayerServerId(playerNearby)] = true
|
||||
end
|
||||
|
||||
Core.TriggerServerCallback('esx:getPlayerNames', function(returnedPlayers)
|
||||
ESX.TriggerServerCallback('esx:getPlayerNames', function(returnedPlayers)
|
||||
for playerId,playerName in pairs(returnedPlayers) do
|
||||
table.insert(elements, {
|
||||
label = playerName,
|
||||
|
||||
@@ -251,6 +251,7 @@ AddEventHandler('esx:spawnVehicle', function(vehicle)
|
||||
TriggerEvent('chat:addMessage', { args = { '^1SYSTEM', 'Invalid vehicle model.' } })
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx:createPickup')
|
||||
AddEventHandler('esx:createPickup', function(pickupId, label, coords, type, name, components, tintIndex)
|
||||
local function setObjectProperties(object)
|
||||
@@ -350,13 +351,16 @@ end)
|
||||
if Config.EnableHud then
|
||||
Citizen.CreateThread(function()
|
||||
local isPaused = false
|
||||
local time = 500
|
||||
while true do
|
||||
Citizen.Wait(300)
|
||||
Citizen.Wait(time)
|
||||
|
||||
if IsPauseMenuActive() and not isPaused then
|
||||
time = 100
|
||||
isPaused = true
|
||||
ESX.UI.HUD.SetDisplay(0.0)
|
||||
elseif not IsPauseMenuActive() and isPaused then
|
||||
time = 100
|
||||
isPaused = false
|
||||
ESX.UI.HUD.SetDisplay(1.0)
|
||||
end
|
||||
|
||||
@@ -81,7 +81,7 @@ RegisterServerEvent('esx:triggerServerCallback')
|
||||
AddEventHandler('esx:triggerServerCallback', function(name, requestId, ...)
|
||||
local playerId = source
|
||||
|
||||
Core.TriggerServerCallback(name, requestId, playerId, function(...)
|
||||
ESX.TriggerServerCallback(name, requestId, playerId, function(...)
|
||||
TriggerClientEvent('esx:serverCallback', playerId, requestId, ...)
|
||||
end, ...)
|
||||
end)
|
||||
|
||||
@@ -155,7 +155,7 @@ ESX.RegisterServerCallback = function(name, cb)
|
||||
Core.ServerCallbacks[name] = cb
|
||||
end
|
||||
|
||||
Core.TriggerServerCallback = function(name, requestId, source, cb, ...)
|
||||
ESX.TriggerServerCallback = function(name, requestId, source, cb, ...)
|
||||
if Core.ServerCallbacks[name] then
|
||||
Core.ServerCallbacks[name](source, cb, ...)
|
||||
else
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"version": "legacy",
|
||||
"commit" : "1.4",
|
||||
"commit" : "1.4.1",
|
||||
"changelog": "\n- Changed to Oxmysql + optimisation"
|
||||
}
|
||||
|
||||
@@ -26,14 +26,14 @@ AddEventHandler('esx:onPlayerSpawn', function()
|
||||
if firstSpawn then
|
||||
firstSpawn = false
|
||||
|
||||
if Config.AntiCombatLog then
|
||||
if Config.SaveDeathStatus then
|
||||
while not ESX.PlayerLoaded do
|
||||
Citizen.Wait(1000)
|
||||
end
|
||||
|
||||
ESX.TriggerServerCallback('esx_ambulancejob:getDeathStatus', function(shouldDie)
|
||||
if shouldDie then
|
||||
Citizen.Wait(5000)
|
||||
Citizen.Wait(1000)
|
||||
SetEntityHealth(PlayerPedId(), 0)
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -5,7 +5,7 @@ Config.DrawDistance = 20.0 -- How close do you need to be in order
|
||||
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? (Removes Items when a player logs back after intentionally logging out while dead.)
|
||||
Config.SaveDeathStatus = true -- Save Death Status?
|
||||
Config.LoadIpl = true -- Disable if you're using fivem-ipl or other IPL loaders
|
||||
|
||||
Config.Locale = 'en'
|
||||
|
||||
@@ -71,7 +71,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!',
|
||||
['combatlog_message'] = 'you have been force-respawned because you\'ve previously left the server when dead.',
|
||||
-- Revive
|
||||
['revive_help'] = 'elvytä pelaaja',
|
||||
-- Item
|
||||
|
||||
@@ -291,13 +291,13 @@ end)
|
||||
|
||||
ESX.RegisterServerCallback('esx_ambulancejob:getDeathStatus', function(source, cb)
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
|
||||
MySQL.scalar('SELECT is_dead FROM users WHERE identifier = ?', {xPlayer.identifier}, function(isDead)
|
||||
if isDead then
|
||||
print(('[esx_ambulancejob] [^2INFO^7] "%s" attempted combat logging'):format(xPlayer.identifier))
|
||||
end
|
||||
|
||||
cb(isDead)
|
||||
if isDead == 1 then
|
||||
cb(true)
|
||||
else
|
||||
cb(false)
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ Citizen.CreateThread(function()
|
||||
isInATMMarker = false
|
||||
|
||||
for k,v in pairs(Config.ATMLocations) do
|
||||
if GetDistanceBetweenCoords(coords, v.x, v.y, v.z, true) < 1.0 then
|
||||
if #(coords - vector3(v.x, v.y, v.z)) < 1.0 then
|
||||
isInATMMarker, canSleep = true, false
|
||||
break
|
||||
end
|
||||
|
||||
@@ -85,7 +85,7 @@ Citizen.CreateThread(function()
|
||||
local currentZone, currentZoneNum
|
||||
|
||||
for i=1, #Config.Zones.BoatShops, 1 do
|
||||
local distance = GetDistanceBetweenCoords(coords, Config.Zones.BoatShops[i].Outside, true)
|
||||
local distance = #(coords - Config.Zones.BoatShops[i].Outside)
|
||||
|
||||
if distance < Config.DrawDistance then
|
||||
DrawMarker(Config.MarkerType, Config.Zones.BoatShops[i].Outside, 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, 100, false, true, 2, false, nil, nil, false)
|
||||
@@ -100,7 +100,7 @@ Citizen.CreateThread(function()
|
||||
end
|
||||
|
||||
for i=1, #Config.Zones.Garages, 1 do
|
||||
local distance = GetDistanceBetweenCoords(coords, Config.Zones.Garages[i].GaragePos, true)
|
||||
local distance = #(coords - Config.Zones.Garages[i].GaragePos)
|
||||
|
||||
if distance < Config.DrawDistance then
|
||||
DrawMarker(Config.MarkerType, Config.Zones.Garages[i].GaragePos, 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, 100, false, true, 2, false, nil, nil, false)
|
||||
@@ -113,7 +113,7 @@ Citizen.CreateThread(function()
|
||||
currentZoneNum = i
|
||||
end
|
||||
|
||||
distance = GetDistanceBetweenCoords(coords, Config.Zones.Garages[i].StorePos, true)
|
||||
distance = #(coords - Config.Zones.Garages[i].StorePos)
|
||||
|
||||
if distance < Config.DrawDistance then
|
||||
DrawMarker(Config.MarkerType, Config.Zones.Garages[i].StorePos, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Config.StoreMarker.x, Config.StoreMarker.y, Config.StoreMarker.z, Config.StoreMarker.r, Config.StoreMarker.g, Config.StoreMarker.b, 100, false, true, 2, false, nil, nil, false)
|
||||
|
||||
@@ -220,7 +220,7 @@ Citizen.CreateThread(function()
|
||||
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(v.Type ~= -1 and #(coords - vector3(v.Pos.x, v.Pos.y, v.Pos.z)) < 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, v.Color.r, v.Color.g, v.Color.b, 100, false, true, 2, false, false, false, false)
|
||||
end
|
||||
end
|
||||
@@ -238,7 +238,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) < v.Size.x) then
|
||||
if( #(coords - vector3(v.Pos.x, v.Pos.y, v.Pos.z)) < v.Size.x) then
|
||||
isInMarker = true
|
||||
currentZone = k
|
||||
end
|
||||
@@ -335,7 +335,7 @@ Citizen.CreateThread(function()
|
||||
LastCheckPoint = CurrentCheckPoint
|
||||
end
|
||||
|
||||
local distance = GetDistanceBetweenCoords(coords, Config.CheckPoints[nextCheckPoint].Pos.x, Config.CheckPoints[nextCheckPoint].Pos.y, Config.CheckPoints[nextCheckPoint].Pos.z, true)
|
||||
local distance = #(coords - vector3(Config.CheckPoints[nextCheckPoint].Pos.x, Config.CheckPoints[nextCheckPoint].Pos.y, Config.CheckPoints[nextCheckPoint].Pos.z))
|
||||
|
||||
if distance <= 100.0 then
|
||||
DrawMarker(1, Config.CheckPoints[nextCheckPoint].Pos.x, Config.CheckPoints[nextCheckPoint].Pos.y, Config.CheckPoints[nextCheckPoint].Pos.z, 0.0, 0.0, 0.0, 0, 0.0, 0.0, 1.5, 1.5, 1.5, 102, 204, 102, 100, false, true, 2, false, false, false, false)
|
||||
|
||||
@@ -3,11 +3,12 @@ local wasOpen = false
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
local time = 800
|
||||
local playerPed = PlayerPedId()
|
||||
local coords = GetEntityCoords(playerPed)
|
||||
|
||||
if GetDistanceBetweenCoords(coords, Config.CircleZones.DrugDealer.coords, true) < 0.5 then
|
||||
if #(coords - Config.CircleZones.DrugDealer.coords) < 0.5 then
|
||||
time = 2
|
||||
if not menuOpen then
|
||||
ESX.ShowHelpNotification(_U('dealer_prompt'))
|
||||
|
||||
@@ -24,7 +25,7 @@ Citizen.CreateThread(function()
|
||||
ESX.UI.Menu.CloseAll()
|
||||
end
|
||||
|
||||
Citizen.Wait(500)
|
||||
Citizen.Wait(time)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -7,7 +7,7 @@ Citizen.CreateThread(function()
|
||||
Citizen.Wait(500)
|
||||
local coords = GetEntityCoords(PlayerPedId())
|
||||
|
||||
if GetDistanceBetweenCoords(coords, Config.CircleZones.WeedField.coords, true) < 50 then
|
||||
if #(coords - Config.CircleZones.WeedField.coords) < 50 then
|
||||
SpawnWeedPlants()
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user