Skip to content

Commit

Permalink
Merge pull request esx-framework#1363 from esx-framework/dev
Browse files Browse the repository at this point in the history
📄 1.10.6 Release
  • Loading branch information
Gellipapa authored Jun 16, 2024
2 parents 41d050a + 9fcfc57 commit a42ab16
Show file tree
Hide file tree
Showing 59 changed files with 513 additions and 233 deletions.
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

esx-legacy
Copyright (C) 2015-2023 Jérémie N'gadi
Copyright (C) 2015-2024 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
Expand All @@ -652,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:

esx-legacy Copyright (C) 2015-2023 Jérémie N'gadi
esx-legacy Copyright (C) 2015-2024 Jérémie N'gadi
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
Expand Down
6 changes: 3 additions & 3 deletions [core]/cron/LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

cron
Copyright (C) 2015-2023 Jérémie N'gadi
Copyright (C) 2015-2024 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
Expand All @@ -652,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:

cron Copyright (C) 2015-2023 Jérémie N'gadi
cron Copyright (C) 2015-2024 Jérémie N'gadi
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
Expand All @@ -671,4 +671,4 @@ 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
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
2 changes: 1 addition & 1 deletion [core]/cron/fxmanifest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ fx_version 'adamant'

game 'gta5'
author 'ESX-Framework'
description 'cron'
description 'Allows resources to Run tasks at specific intervals.'
lua54 'yes'
version '1.10.5'

Expand Down
6 changes: 3 additions & 3 deletions [core]/es_extended/LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

es_extended
Copyright (C) 2015-2023 Jérémie N'gadi
Copyright (C) 2015-2024 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
Expand All @@ -652,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:

es_extended Copyright (C) 2015-2023 Jérémie N'gadi
es_extended Copyright (C) 2015-2024 Jérémie N'gadi
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
Expand All @@ -671,4 +671,4 @@ 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
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
28 changes: 11 additions & 17 deletions [core]/es_extended/client/functions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -507,10 +507,10 @@ function ESX.Game.GetClosestEntity(entities, isPlayerEntities, coords, modelFilt

if modelFilter then
filteredEntities = {}

for _, entity in pairs(entities) do
if modelFilter[GetEntityModel(entity)] then
filteredEntities[#filteredEntities + 1] = entity
for currentEntityIndex = 1, #entities do
if modelFilter[GetEntityModel(entities[currentEntityIndex])] then
filteredEntities[#filteredEntities + 1] = entities[currentEntityIndex]
end
end
end
Expand Down Expand Up @@ -576,21 +576,15 @@ function ESX.Game.GetVehicleProperties(vehicle)
end

local doorsBroken, windowsBroken, tyreBurst = {}, {}, {}
local numWheels = tostring(GetVehicleNumberOfWheels(vehicle))

local TyresIndex = { -- Wheel index list according to the number of vehicle wheels.
["2"] = { 0, 4 }, -- Bike and cycle.
["3"] = { 0, 1, 4, 5 }, -- Vehicle with 3 wheels (get for wheels because some 3 wheels vehicles have 2 wheels on front and one rear or the reverse).
["4"] = { 0, 1, 4, 5 }, -- Vehicle with 4 wheels.
["6"] = { 0, 1, 2, 3, 4, 5 }, -- Vehicle with 6 wheels.
}

if TyresIndex[numWheels] then
for _, idx in pairs(TyresIndex[numWheels]) do
tyreBurst[tostring(idx)] = IsVehicleTyreBurst(vehicle, idx, false)
end
local wheel_count = GetVehicleNumberOfWheels(vehicle);

for wheel_index = 0, wheel_count - 1 do
tyreBurst[tostring(wheel_index)] = IsVehicleTyreBurst(vehicle, wheel_index, false)
end


for windowId = 0, 7 do -- 13
RollUpWindow(vehicle, windowId) --fix when you put the car away with the window down
windowsBroken[tostring(windowId)] = not IsVehicleWindowIntact(vehicle, windowId)
Expand Down Expand Up @@ -1128,8 +1122,8 @@ function ESX.ShowInventory()
{ unselectable = true, icon = "fas fa-users", title = "Nearby Players" },
}

for _, playerNearby in ipairs(playersNearby) do
players[GetPlayerServerId(playerNearby)] = true
for currentNearbyPlayerIndex = 1, #playersNearby do
players[GetPlayerServerId(playersNearby[currentNearbyPlayerIndex])] = true
end

ESX.TriggerServerCallback("esx:getPlayerNames", function(returnedPlayers)
Expand Down
25 changes: 7 additions & 18 deletions [core]/es_extended/client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function ESX.SpawnPlayer(skin, coords, cb)
p:resolve()
end)
Citizen.Await(p)

local playerPed = PlayerPedId()
FreezeEntityPosition(playerPed, true)
SetEntityCoordsNoOffset(playerPed, coords.x, coords.y, coords.z, false, false, false, true)
Expand Down Expand Up @@ -56,7 +56,7 @@ AddEventHandler("esx:playerLoaded", function(xPlayer, _, skin)
while not DoesEntityExist(ESX.PlayerData.ped) do
Wait(20)
end

ESX.PlayerLoaded = true

local metadata = ESX.PlayerData.metadata
Expand Down Expand Up @@ -271,29 +271,13 @@ AddEventHandler("esx:restoreLoadout", function()
end
end)

-- Credit: https://github.com/LukeWasTakenn, https://github.com/LukeWasTakenn/luke_garages/blob/master/client/client.lua#L331-L352
AddStateBagChangeHandler("VehicleProperties", nil, function(bagName, _, value)
if not value then
return
end

local netId = bagName:gsub("entity:", "")
local timer = GetGameTimer()
while not NetworkDoesEntityExistWithNetworkId(tonumber(netId)) do
Wait(0)
if GetGameTimer() - timer > 10000 then
return
end
end

local vehicle = NetToVeh(tonumber(netId))
local timer2 = GetGameTimer()
while NetworkGetEntityOwner(vehicle) ~= PlayerId() do
Wait(0)
if GetGameTimer() - timer2 > 10000 then
return
end
end

ESX.Game.SetVehicleProperties(vehicle, value)
end)
Expand Down Expand Up @@ -378,6 +362,11 @@ AddEventHandler("esx:setJob", function(Job)
ESX.SetPlayerData("job", Job)
end)

RegisterNetEvent("esx:setGroup")
AddEventHandler("esx:setGroup", function(group)
ESX.SetPlayerData("group", group)
end)

if not Config.OxInventory then
RegisterNetEvent("esx:createPickup")
AddEventHandler("esx:createPickup", function(pickupId, label, coords, itemType, name, components, tintIndex)
Expand Down
9 changes: 9 additions & 0 deletions [core]/es_extended/client/modules/actions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ local function GetData(vehicle)
return displayName, netId
end

local function ToggleVehicleStatus(inVehicle, seat)
ESX.SetPlayerData("vehicle", inVehicle)
ESX.SetPlayerData("seat", seat)
end

CreateThread(function()
while not ESX.PlayerLoaded do Wait(200) end
while true do
Expand Down Expand Up @@ -64,11 +69,13 @@ CreateThread(function()
isEnteringVehicle = true
TriggerEvent("esx:enteringVehicle", vehicle, plate, seat, netId)
TriggerServerEvent("esx:enteringVehicle", plate, seat, netId)
ToggleVehicleStatus(vehicle, seat)
elseif not DoesEntityExist(GetVehiclePedIsTryingToEnter(playerPed)) and not IsPedInAnyVehicle(playerPed, true) and isEnteringVehicle then
-- vehicle entering aborted
TriggerEvent("esx:enteringVehicleAborted")
TriggerServerEvent("esx:enteringVehicleAborted")
isEnteringVehicle = false
ToggleVehicleStatus(false, false)
elseif IsPedInAnyVehicle(playerPed, false) then
-- suddenly appeared in a vehicle, possible teleport
isEnteringVehicle = false
Expand All @@ -79,6 +86,7 @@ CreateThread(function()
current.displayName, current.netId = GetData(current.vehicle)
TriggerEvent("esx:enteredVehicle", current.vehicle, current.plate, current.seat, current.displayName, current.netId)
TriggerServerEvent("esx:enteredVehicle", current.plate, current.seat, current.displayName, current.netId)
ToggleVehicleStatus(current.vehicle, current.seat)
end
elseif isInVehicle then
if not IsPedInAnyVehicle(playerPed, false) or IsPlayerDead(PlayerId()) then
Expand All @@ -87,6 +95,7 @@ CreateThread(function()
TriggerServerEvent("esx:exitedVehicle", current.plate, current.seat, current.displayName, current.netId)
isInVehicle = false
current = {}
ToggleVehicleStatus(false,false)
end
end
Wait(200)
Expand Down
33 changes: 33 additions & 0 deletions [core]/es_extended/common/functions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,36 @@ end
function ESX.Round(value, numDecimalPlaces)
return ESX.Math.Round(value, numDecimalPlaces)
end

function ESX.ValidateType(value, ...)
local types = { ... }
if #types == 0 then return true end

local mapType = {}
for i = 1, #types, 1 do
local validateType = types[i]
assert(type(validateType) == "string", "bad argument types, only expected string") -- should never use anyhing else than string
mapType[validateType] = true
end

local valueType = type(value)

local matches = mapType[valueType] ~= nil

if not matches then
local requireTypes = table.concat(types, " or ")
local errorMessage = ("bad value (%s expected, got %s)"):format(requireTypes, valueType)

return false, errorMessage
end

return true
end

function ESX.AssertType(...)
local matches, errorMessage = ESX.ValidateType(...)

assert(matches, errorMessage)

return matches
end
6 changes: 6 additions & 0 deletions [core]/es_extended/common/modules/math.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,9 @@ function ESX.Math.Trim(value)
return nil
end
end

function ESX.Math.Random(minRange, maxRange)
math.randomseed(GetGameTimer())
return math.random(minRange or 1, maxRange or 10)
end

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
exports("getSharedObject", function()
return ESX
end)

AddEventHandler("esx:getSharedObject", function()
local Invoke = GetInvokingResource()
print(("[^1ERROR^7] Resource ^5%s^7 Used the ^5getSharedObject^7 Event, this event ^1no longer exists!^7 Visit https://documentation.esx-framework.org/tutorials/tutorials-esx/sharedevent for how to fix!"):format(Invoke))
end)
exports("getSharedObject", function()
return ESX
end)

AddEventHandler("esx:getSharedObject", function()
local Invoke = GetInvokingResource()
print(("[^1ERROR^7] Resource ^5%s^7 Used the ^5getSharedObject^7 Event, this event ^1no longer exists!^7 Visit https://documentation.esx-framework.org/tutorials/tutorials-esx/sharedevent for how to fix!"):format(Invoke))
end)
12 changes: 6 additions & 6 deletions [core]/es_extended/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,21 @@ Config.AdminGroups = {
Config.EnablePaycheck = true -- enable paycheck
Config.LogPaycheck = false -- Logs paychecks to a nominated Discord channel via webhook (default is false)
Config.EnableSocietyPayouts = false -- pay from the society account that the player is employed at? Requirement: esx_society
Config.MaxWeight = 24 -- the max inventory weight without backpack
Config.PaycheckInterval = 7 * 60000 -- how often to recieve pay checks in milliseconds
Config.MaxWeight = 24 -- the max inventory weight without a backpack
Config.PaycheckInterval = 7 * 60000 -- how often to receive paychecks in milliseconds
Config.EnableDebug = false -- Use Debug options?
Config.EnableDefaultInventory = true -- Display the default Inventory ( F2 )
Config.EnableWantedLevel = false -- Use Normal GTA wanted Level?
Config.EnablePVP = true -- Allow Player to player combat

Config.Multichar = GetResourceState("esx_multicharacter") ~= "missing"
Config.Identity = true -- Select a characters identity data before they have loaded in (this happens by default with multichar)
Config.Identity = true -- Select a character identity data before they have loaded in (this happens by default with multichar)
Config.DistanceGive = 4.0 -- Max distance when giving items, weapons etc.

Config.AdminLogging = false -- Logs the usage of certain commands by those with group.admin ace permissions (default is false)

Config.DisableHealthRegeneration = false -- Player will no longer regenerate health
Config.DisableVehicleRewards = false -- Disables Player Recieving weapons from vehicles
Config.DisableVehicleRewards = false -- Disables Player Receiving weapons from vehicles
Config.DisableNPCDrops = false -- stops NPCs from dropping weapons on death
Config.DisableDispatchServices = false -- Disable Dispatch services
Config.DisableScenarios = false -- Disable Scenarios
Expand Down Expand Up @@ -85,12 +85,12 @@ Config.RemoveHudComponents = {
[22] = false, --HUD_WEAPONS
}

Config.SpawnVehMaxUpgrades = true -- admin vehicles spawn with max vehcle settings
Config.SpawnVehMaxUpgrades = true -- admin vehicles spawn with max vehicle settings
Config.CustomAIPlates = "........" -- Custom plates for AI vehicles
-- Pattern string format
--1 will lead to a random number from 0-9.
--A will lead to a random letter from A-Z.
-- . will lead to a random letter or number, with 50% probability of being either.
-- . will lead to a random letter or number, with a 50% probability of being either.
--^1 will lead to a literal 1 being emitted.
--^A will lead to a literal A being emitted.
--Any other character will lead to said character being emitted.
Expand Down
13 changes: 6 additions & 7 deletions [core]/es_extended/fxmanifest.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
fx_version 'cerulean'

game 'gta5'
description 'ES Extended'
description 'The Core resource that provides the functionalities for all other resources.'
lua54 'yes'
version '1.10.5'

Expand All @@ -11,6 +11,9 @@ shared_scripts {

'config.lua',
'config.weapons.lua',

'common/modules/*.lua',
'common/*.lua',
}

server_scripts {
Expand All @@ -27,10 +30,9 @@ server_scripts {
'server/main.lua',
'server/commands.lua',

'common/modules/*.lua',
'common/functions.lua',
'server/modules/actions.lua',
'server/modules/npwd.lua'
'server/modules/npwd.lua',
'server/modules/createJob.lua'
}

client_scripts {
Expand All @@ -41,9 +43,6 @@ client_scripts {

'client/main.lua',

'common/modules/*.lua',
'common/functions.lua',

'common/functions.lua',
'client/modules/actions.lua',
'client/modules/death.lua',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ Core.PlayerFunctionOverrides.OxInventory = {
return function(newWeight)
self.maxWeight = newWeight
self.triggerEvent("esx:setMaxWeight", self.maxWeight)
return Inventory.Set(self.source, "maxWeight", newWeight)
return Inventory.SetMaxWeight(self.source, newWeight)
end
end,

Expand Down
Loading

0 comments on commit a42ab16

Please sign in to comment.