Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
wildesPepega authored Jun 28, 2024
1 parent f866541 commit e77cbba
Show file tree
Hide file tree
Showing 17 changed files with 409 additions and 259 deletions.
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 @@ -505,10 +505,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 @@ -574,21 +574,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 @@ -1126,8 +1120,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
24 changes: 7 additions & 17 deletions [core]/es_extended/client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function ESX.SpawnPlayer(skin, coords, cb)
end
FreezeEntityPosition(playerPed, false)
NetworkResurrectLocalPlayer(coords.x, coords.y, coords.z, coords.heading, true, true, false)
TriggerEvent("playerSpawned", coords)
TriggerEvent('playerSpawned', coords)
cb()
end

Expand Down Expand Up @@ -211,6 +211,7 @@ AddEventHandler("esx:playerLoaded", function(xPlayer, _, skin)
StartServerSyncLoops()
end)


RegisterNetEvent("esx:onPlayerLogout")
AddEventHandler("esx:onPlayerLogout", function()
ESX.PlayerLoaded = false
Expand Down Expand Up @@ -270,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 @@ -377,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
13 changes: 10 additions & 3 deletions [core]/es_extended/client/modules/actions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,13 @@ 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 not ESX.PlayerLoaded do Wait(200) end
while true do
ESX.SetPlayerData("coords", GetEntityCoords(playerPed))
if playerPed ~= PlayerPedId() then
Expand Down Expand Up @@ -66,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 @@ -81,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 @@ -89,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

57 changes: 32 additions & 25 deletions [core]/es_extended/config.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Config = {}
Config.Locale = GetConvar("esx:locale", "en")

Config.OxInventory = GetResourceState("ox_inventory") ~= "missing"
Config.OxInventory = GetResourceState("ox_inventory") ~= 'missing'

Config.Accounts = {
bank = {
Expand All @@ -22,13 +22,12 @@ Config.StartingAccountMoney = { bank = 50000 }

Config.StartingInventoryItems = false -- table/false

--Config.StartingInventoryItems = {
-- bread = 1,
-- water = 1
--}

Config.DefaultSpawns = { -- If you want to have more spawn positions and select them randomly uncomment commented code or add more locations
{ x = 222.2027, y = -864.0162, z = 30.2922, heading = 1.0 },
--{x = 224.9865, y = -865.0871, z = 30.2922, heading = 1.0},
--{x = 227.8436, y = -866.0400, z = 30.2922, heading = 1.0},
--{x = 230.6051, y = -867.1450, z = 30.2922, heading = 1.0},
--{x = 233.5459, y = -868.2626, z = 30.2922, heading = 1.0}
}

Config.AdminGroups = {
Expand All @@ -39,33 +38,33 @@ 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 = false
Config.Identity = true -- Select a characters identity data before they have loaded in (this happens by default with multichar)
Config.Multichar = GetResourceState("esx_multicharacter") ~= "missing"
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 = true -- Player will no longer regenerate health
Config.DisableVehicleRewards = true -- Disables Player Recieving weapons from vehicles
Config.DisableNPCDrops = true -- stops NPCs from dropping weapons on death
Config.DisableDispatchServices = true -- Disable Dispatch services
Config.DisableScenarios = true -- Disable Scenarios
Config.DisableHealthRegeneration = false -- Player will no longer regenerate health
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
Config.DisableWeaponWheel = false -- Disables default weapon wheel
Config.DisableAimAssist = true -- disables AIM assist (mainly on controllers)
Config.DisableVehicleSeatShuff = true -- Disables vehicle seat shuff
Config.DisableAimAssist = false -- disables AIM assist (mainly on controllers)
Config.DisableVehicleSeatShuff = false -- Disables vehicle seat shuff
Config.DisableDisplayAmmo = false -- Disable ammunition display
Config.RemoveHudComponents = {
[1] = true, --WANTED_STARS,
[1] = false, --WANTED_STARS,
[2] = false, --WEAPON_ICON
[3] = true, --CASH
[4] = true, --MP_CASH
[3] = false, --CASH
[4] = false, --MP_CASH
[5] = false, --MP_MESSAGE
[6] = false, --VEHICLE_NAME
[7] = false, -- AREA_NAME
Expand All @@ -77,14 +76,22 @@ Config.RemoveHudComponents = {
[13] = false, --CASH_CHANGE
[14] = false, --RETICLE
[15] = false, --SUBTITLE_TEXT
[16] = true, --RADIO_STATIONS
[17] = true, --SAVING_GAME,
[18] = true, --GAME_STREAM
[16] = false, --RADIO_STATIONS
[17] = false, --SAVING_GAME,
[18] = false, --GAME_STREAM
[19] = false, --WEAPON_WHEEL
[20] = false, --WEAPON_WHEEL_STATS
[21] = false, --HUD_COMPONENTS
[22] = false, --HUD_WEAPONS
}

Config.SpawnVehMaxUpgrades = true
Config.CustomAIPlates = "PEEPO"
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 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.
-- A string shorter than 8 characters will be padded on the right.
Loading

0 comments on commit e77cbba

Please sign in to comment.