From 372774b8e4376d854b6ca53d9e2d6519e2ad4516 Mon Sep 17 00:00:00 2001 From: Mycroft Date: Tue, 6 Apr 2021 19:31:26 +0100 Subject: [PATCH 1/6] kashacters changes --- client/main.lua | 84 ++++++++++++++++++++++++++++++-------------- config.lua | 1 + server/functions.lua | 4 +-- 3 files changed, 60 insertions(+), 29 deletions(-) diff --git a/client/main.lua b/client/main.lua index 1ab413e2..737384c4 100644 --- a/client/main.lua +++ b/client/main.lua @@ -1,15 +1,23 @@ local isPaused, isDead, pickups = false, false, {} -Citizen.CreateThread(function() - while true do - Citizen.Wait(0) +if not Config.UseKashacters then + Citizen.CreateThread(function() - if NetworkIsPlayerActive(PlayerId()) then - TriggerServerEvent('esx:onPlayerJoined') - break - end - end -end) + while true do + Citizen.Wait(0) + + if NetworkIsPlayerActive(PlayerId()) then + TriggerServerEvent('esx:onPlayerJoined') + break + end + end + end) +else + RegisterNetEvent('esx:kashloaded') + AddEventHandler('esx:kashloaded', function() + TriggerServerEvent('esx:onPlayerJoined') + end) +end RegisterNetEvent('esx:playerLoaded') AddEventHandler('esx:playerLoaded', function(playerData) @@ -22,7 +30,7 @@ AddEventHandler('esx:playerLoaded', function(playerData) RequestModel(defaultModel) while not HasModelLoaded(defaultModel) do - Citizen.Wait(10) + Citizen.Wait(25) end SetPlayerModel(PlayerId(), defaultModel) @@ -60,26 +68,48 @@ AddEventHandler('esx:playerLoaded', function(playerData) }) end - ESX.Game.Teleport(PlayerPedId(), { - x = playerData.coords.x, - y = playerData.coords.y, - z = playerData.coords.z + 0.25, - heading = playerData.coords.heading + local wait = 4000 +if Config.UseKashacters then +--[[ + ESX.Game.Teleport(PlayerPedId(), { + x = playerData.coords.x, + y = playerData.coords.y, + z = playerData.coords.z + 0.25, + heading = playerData.coords.heading + }, function() + end) +]]-- +TriggerServerEvent('esx:onPlayerSpawn') +TriggerEvent('esx:onPlayerSpawn') +TriggerEvent('playerSpawned') -- compatibility with old scripts, will be removed soon +TriggerEvent('esx:restoreLoadout') + +Citizen.Wait(0) +ShutdownLoadingScreen() +FreezeEntityPosition(PlayerPedId(), false) +DoScreenFadeIn(0) +StartServerSyncLoops() +TriggerEvent('esx:loadingScreenOff') + + else + ESX.Game.Teleport(PlayerPedId(), { + x = playerData.coords.x, + y = playerData.coords.y, + z = playerData.coords.z + 0.25, + heading = playerData.coords.heading }, function() - TriggerServerEvent('esx:onPlayerSpawn') - TriggerEvent('esx:onPlayerSpawn') - TriggerEvent('playerSpawned') -- compatibility with old scripts, will be removed soon - TriggerEvent('esx:restoreLoadout') + TriggerServerEvent('esx:onPlayerSpawn') + TriggerEvent('esx:onPlayerSpawn') + TriggerEvent('playerSpawned') -- compatibility with old scripts, will be removed soon + TriggerEvent('esx:restoreLoadout') - Citizen.Wait(4000) - ShutdownLoadingScreen() - ShutdownLoadingScreenNui() - FreezeEntityPosition(PlayerPedId(), false) - DoScreenFadeIn(10000) - StartServerSyncLoops() + Citizen.Wait(3000) + ShutdownLoadingScreen() + FreezeEntityPosition(PlayerPedId(), false) + DoScreenFadeIn(10000) + StartServerSyncLoops() + TriggerEvent('esx:loadingScreenOff') end) - - TriggerEvent('esx:loadingScreenOff') end) RegisterNetEvent('esx:setMaxWeight') diff --git a/config.lua b/config.lua index 93e400db..85b95982 100644 --- a/config.lua +++ b/config.lua @@ -14,3 +14,4 @@ Config.EnableHud = true -- enable the default hud? Display current jo Config.MaxWeight = 24 -- the max inventory weight without backpack Config.PaycheckInterval = 7 * 60000 -- how often to recieve pay checks in milliseconds Config.EnableDebug = false +Config.UseKashacters = false \ No newline at end of file diff --git a/server/functions.lua b/server/functions.lua index eca0a20d..866f8b7b 100644 --- a/server/functions.lua +++ b/server/functions.lua @@ -211,10 +211,10 @@ end ESX.StartDBSync = function() function saveData() ESX.SavePlayers() - SetTimeout(10 * 60 * 1000, saveData) + SetTimeout(15 * 60 * 1000, saveData) end - SetTimeout(10 * 60 * 1000, saveData) + SetTimeout(15 * 60 * 1000, saveData) end ESX.GetPlayers = function() From 10360436297e08e4a6d269ed523a45ee9188c259 Mon Sep 17 00:00:00 2001 From: Mycroft Date: Tue, 6 Apr 2021 22:56:56 +0100 Subject: [PATCH 2/6] d --- client/main.lua | 53 ++++++++++++++++++++++++++----------------------- server/main.lua | 38 +++++++++++++++++++++++++---------- 2 files changed, 56 insertions(+), 35 deletions(-) diff --git a/client/main.lua b/client/main.lua index 737384c4..ab53309f 100644 --- a/client/main.lua +++ b/client/main.lua @@ -1,7 +1,12 @@ local isPaused, isDead, pickups = false, false, {} -if not Config.UseKashacters then - Citizen.CreateThread(function() +if Config.UseKashacters then + RegisterNetEvent('esx:kashloaded') + AddEventHandler('esx:kashloaded', function() + TriggerServerEvent('esx:onPlayerJoined') + end) +else + Citizen.CreateThread(function() while true do Citizen.Wait(0) @@ -12,11 +17,6 @@ if not Config.UseKashacters then end end end) -else - RegisterNetEvent('esx:kashloaded') - AddEventHandler('esx:kashloaded', function() - TriggerServerEvent('esx:onPlayerJoined') - end) end RegisterNetEvent('esx:playerLoaded') @@ -25,6 +25,7 @@ AddEventHandler('esx:playerLoaded', function(playerData) ESX.PlayerData = playerData -- check if player is coming from loading screen +if not Config.UseKashacters then if GetEntityModel(PlayerPedId()) == GetHashKey('PLAYER_ZERO') then local defaultModel = GetHashKey('a_m_y_stbla_02') RequestModel(defaultModel) @@ -38,6 +39,7 @@ AddEventHandler('esx:playerLoaded', function(playerData) SetPedRandomComponentVariation(PlayerPedId(), true) SetModelAsNoLongerNeeded(defaultModel) end + end -- freeze the player FreezeEntityPosition(PlayerPedId(), true) @@ -68,7 +70,6 @@ AddEventHandler('esx:playerLoaded', function(playerData) }) end - local wait = 4000 if Config.UseKashacters then --[[ ESX.Game.Teleport(PlayerPedId(), { @@ -89,28 +90,30 @@ ShutdownLoadingScreen() FreezeEntityPosition(PlayerPedId(), false) DoScreenFadeIn(0) StartServerSyncLoops() -TriggerEvent('esx:loadingScreenOff') - else - ESX.Game.Teleport(PlayerPedId(), { - x = playerData.coords.x, - y = playerData.coords.y, - z = playerData.coords.z + 0.25, - heading = playerData.coords.heading +else + ESX.Game.Teleport(PlayerPedId(), { + x = playerData.coords.x, + y = playerData.coords.y, + z = playerData.coords.z + 0.25, + heading = playerData.coords.heading }, function() - TriggerServerEvent('esx:onPlayerSpawn') - TriggerEvent('esx:onPlayerSpawn') - TriggerEvent('playerSpawned') -- compatibility with old scripts, will be removed soon - TriggerEvent('esx:restoreLoadout') + TriggerServerEvent('esx:onPlayerSpawn') + TriggerEvent('esx:onPlayerSpawn') + TriggerEvent('playerSpawned') -- compatibility with old scripts, will be removed soon + TriggerEvent('esx:restoreLoadout') - Citizen.Wait(3000) - ShutdownLoadingScreen() - FreezeEntityPosition(PlayerPedId(), false) - DoScreenFadeIn(10000) - StartServerSyncLoops() - TriggerEvent('esx:loadingScreenOff') + Citizen.Wait(4000) + ShutdownLoadingScreen() + ShutdownLoadingScreenNui() + FreezeEntityPosition(PlayerPedId(), false) + DoScreenFadeIn(10000) + StartServerSyncLoops() end) + TriggerEvent('esx:loadingScreenOff') end) +end + RegisterNetEvent('esx:setMaxWeight') AddEventHandler('esx:setMaxWeight', function(newMaxWeight) ESX.PlayerData.maxWeight = newMaxWeight end) diff --git a/server/main.lua b/server/main.lua index 5a1f7ac3..ed629189 100644 --- a/server/main.lua +++ b/server/main.lua @@ -13,12 +13,21 @@ end) function onPlayerJoined(playerId) local identifier - for k,v in ipairs(GetPlayerIdentifiers(playerId)) do - if string.match(v, 'license:') then - identifier = string.sub(v, 9) - break - end + if not Config.UseKashacters then + for k,v in ipairs(GetPlayerIdentifiers(playerId)) do + if string.match(v, 'license:') then + identifier = string.sub(v, 9) + break + end + end + else + for k,v in ipairs(GetPlayerIdentifiers(playerId)) do + if string.match(v, 'license:') then + identifier = v + break + end end +end if identifier then if ESX.GetPlayerFromIdentifier(identifier) then @@ -55,11 +64,20 @@ AddEventHandler('playerConnecting', function(name, setCallback, deferrals) local playerId, identifier = source Citizen.Wait(100) - for k,v in ipairs(GetPlayerIdentifiers(playerId)) do - if string.match(v, 'license:') then - identifier = string.sub(v, 9) - break - end + if not Config.UseKashacters then + for k,v in ipairs(GetPlayerIdentifiers(playerId)) do + if string.match(v, 'license:') then + identifier = string.sub(v, 9) + break + end + end + else + for k,v in ipairs(GetPlayerIdentifiers(playerId)) do + if string.match(v, 'license:') then + identifier = v + break + end + end end if identifier then From c31f1c62b1f9c84e1770109efd4bfa8f50476b94 Mon Sep 17 00:00:00 2001 From: Mycroft Date: Tue, 6 Apr 2021 22:57:03 +0100 Subject: [PATCH 3/6] Revert "d" This reverts commit 10360436297e08e4a6d269ed523a45ee9188c259. --- client/main.lua | 53 +++++++++++++++++++++++-------------------------- server/main.lua | 38 ++++++++++------------------------- 2 files changed, 35 insertions(+), 56 deletions(-) diff --git a/client/main.lua b/client/main.lua index ab53309f..737384c4 100644 --- a/client/main.lua +++ b/client/main.lua @@ -1,12 +1,7 @@ local isPaused, isDead, pickups = false, false, {} -if Config.UseKashacters then - RegisterNetEvent('esx:kashloaded') - AddEventHandler('esx:kashloaded', function() - TriggerServerEvent('esx:onPlayerJoined') - end) -else - Citizen.CreateThread(function() +if not Config.UseKashacters then + Citizen.CreateThread(function() while true do Citizen.Wait(0) @@ -17,6 +12,11 @@ else end end end) +else + RegisterNetEvent('esx:kashloaded') + AddEventHandler('esx:kashloaded', function() + TriggerServerEvent('esx:onPlayerJoined') + end) end RegisterNetEvent('esx:playerLoaded') @@ -25,7 +25,6 @@ AddEventHandler('esx:playerLoaded', function(playerData) ESX.PlayerData = playerData -- check if player is coming from loading screen -if not Config.UseKashacters then if GetEntityModel(PlayerPedId()) == GetHashKey('PLAYER_ZERO') then local defaultModel = GetHashKey('a_m_y_stbla_02') RequestModel(defaultModel) @@ -39,7 +38,6 @@ if not Config.UseKashacters then SetPedRandomComponentVariation(PlayerPedId(), true) SetModelAsNoLongerNeeded(defaultModel) end - end -- freeze the player FreezeEntityPosition(PlayerPedId(), true) @@ -70,6 +68,7 @@ if not Config.UseKashacters then }) end + local wait = 4000 if Config.UseKashacters then --[[ ESX.Game.Teleport(PlayerPedId(), { @@ -90,30 +89,28 @@ ShutdownLoadingScreen() FreezeEntityPosition(PlayerPedId(), false) DoScreenFadeIn(0) StartServerSyncLoops() +TriggerEvent('esx:loadingScreenOff') -else - ESX.Game.Teleport(PlayerPedId(), { - x = playerData.coords.x, - y = playerData.coords.y, - z = playerData.coords.z + 0.25, - heading = playerData.coords.heading + else + ESX.Game.Teleport(PlayerPedId(), { + x = playerData.coords.x, + y = playerData.coords.y, + z = playerData.coords.z + 0.25, + heading = playerData.coords.heading }, function() - TriggerServerEvent('esx:onPlayerSpawn') - TriggerEvent('esx:onPlayerSpawn') - TriggerEvent('playerSpawned') -- compatibility with old scripts, will be removed soon - TriggerEvent('esx:restoreLoadout') + TriggerServerEvent('esx:onPlayerSpawn') + TriggerEvent('esx:onPlayerSpawn') + TriggerEvent('playerSpawned') -- compatibility with old scripts, will be removed soon + TriggerEvent('esx:restoreLoadout') - Citizen.Wait(4000) - ShutdownLoadingScreen() - ShutdownLoadingScreenNui() - FreezeEntityPosition(PlayerPedId(), false) - DoScreenFadeIn(10000) - StartServerSyncLoops() + Citizen.Wait(3000) + ShutdownLoadingScreen() + FreezeEntityPosition(PlayerPedId(), false) + DoScreenFadeIn(10000) + StartServerSyncLoops() + TriggerEvent('esx:loadingScreenOff') end) - TriggerEvent('esx:loadingScreenOff') end) -end - RegisterNetEvent('esx:setMaxWeight') AddEventHandler('esx:setMaxWeight', function(newMaxWeight) ESX.PlayerData.maxWeight = newMaxWeight end) diff --git a/server/main.lua b/server/main.lua index ed629189..5a1f7ac3 100644 --- a/server/main.lua +++ b/server/main.lua @@ -13,21 +13,12 @@ end) function onPlayerJoined(playerId) local identifier - if not Config.UseKashacters then - for k,v in ipairs(GetPlayerIdentifiers(playerId)) do - if string.match(v, 'license:') then - identifier = string.sub(v, 9) - break - end - end - else - for k,v in ipairs(GetPlayerIdentifiers(playerId)) do - if string.match(v, 'license:') then - identifier = v - break - end + for k,v in ipairs(GetPlayerIdentifiers(playerId)) do + if string.match(v, 'license:') then + identifier = string.sub(v, 9) + break + end end -end if identifier then if ESX.GetPlayerFromIdentifier(identifier) then @@ -64,20 +55,11 @@ AddEventHandler('playerConnecting', function(name, setCallback, deferrals) local playerId, identifier = source Citizen.Wait(100) - if not Config.UseKashacters then - for k,v in ipairs(GetPlayerIdentifiers(playerId)) do - if string.match(v, 'license:') then - identifier = string.sub(v, 9) - break - end - end - else - for k,v in ipairs(GetPlayerIdentifiers(playerId)) do - if string.match(v, 'license:') then - identifier = v - break - end - end + for k,v in ipairs(GetPlayerIdentifiers(playerId)) do + if string.match(v, 'license:') then + identifier = string.sub(v, 9) + break + end end if identifier then From 4546c3d04ccccabc4fcd5e1e1fcfbe42cffcbd82 Mon Sep 17 00:00:00 2001 From: Mycroft Date: Tue, 6 Apr 2021 22:57:06 +0100 Subject: [PATCH 4/6] Revert "kashacters changes" This reverts commit 372774b8e4376d854b6ca53d9e2d6519e2ad4516. --- client/main.lua | 84 ++++++++++++++------------------------------ config.lua | 1 - server/functions.lua | 4 +-- 3 files changed, 29 insertions(+), 60 deletions(-) diff --git a/client/main.lua b/client/main.lua index 737384c4..1ab413e2 100644 --- a/client/main.lua +++ b/client/main.lua @@ -1,23 +1,15 @@ local isPaused, isDead, pickups = false, false, {} -if not Config.UseKashacters then - Citizen.CreateThread(function() +Citizen.CreateThread(function() + while true do + Citizen.Wait(0) - while true do - Citizen.Wait(0) - - if NetworkIsPlayerActive(PlayerId()) then - TriggerServerEvent('esx:onPlayerJoined') - break - end - end - end) -else - RegisterNetEvent('esx:kashloaded') - AddEventHandler('esx:kashloaded', function() - TriggerServerEvent('esx:onPlayerJoined') - end) -end + if NetworkIsPlayerActive(PlayerId()) then + TriggerServerEvent('esx:onPlayerJoined') + break + end + end +end) RegisterNetEvent('esx:playerLoaded') AddEventHandler('esx:playerLoaded', function(playerData) @@ -30,7 +22,7 @@ AddEventHandler('esx:playerLoaded', function(playerData) RequestModel(defaultModel) while not HasModelLoaded(defaultModel) do - Citizen.Wait(25) + Citizen.Wait(10) end SetPlayerModel(PlayerId(), defaultModel) @@ -68,48 +60,26 @@ AddEventHandler('esx:playerLoaded', function(playerData) }) end - local wait = 4000 -if Config.UseKashacters then ---[[ - ESX.Game.Teleport(PlayerPedId(), { - x = playerData.coords.x, - y = playerData.coords.y, - z = playerData.coords.z + 0.25, - heading = playerData.coords.heading - }, function() - end) -]]-- -TriggerServerEvent('esx:onPlayerSpawn') -TriggerEvent('esx:onPlayerSpawn') -TriggerEvent('playerSpawned') -- compatibility with old scripts, will be removed soon -TriggerEvent('esx:restoreLoadout') - -Citizen.Wait(0) -ShutdownLoadingScreen() -FreezeEntityPosition(PlayerPedId(), false) -DoScreenFadeIn(0) -StartServerSyncLoops() -TriggerEvent('esx:loadingScreenOff') - - else - ESX.Game.Teleport(PlayerPedId(), { - x = playerData.coords.x, - y = playerData.coords.y, - z = playerData.coords.z + 0.25, - heading = playerData.coords.heading + ESX.Game.Teleport(PlayerPedId(), { + x = playerData.coords.x, + y = playerData.coords.y, + z = playerData.coords.z + 0.25, + heading = playerData.coords.heading }, function() - TriggerServerEvent('esx:onPlayerSpawn') - TriggerEvent('esx:onPlayerSpawn') - TriggerEvent('playerSpawned') -- compatibility with old scripts, will be removed soon - TriggerEvent('esx:restoreLoadout') + TriggerServerEvent('esx:onPlayerSpawn') + TriggerEvent('esx:onPlayerSpawn') + TriggerEvent('playerSpawned') -- compatibility with old scripts, will be removed soon + TriggerEvent('esx:restoreLoadout') - Citizen.Wait(3000) - ShutdownLoadingScreen() - FreezeEntityPosition(PlayerPedId(), false) - DoScreenFadeIn(10000) - StartServerSyncLoops() - TriggerEvent('esx:loadingScreenOff') + Citizen.Wait(4000) + ShutdownLoadingScreen() + ShutdownLoadingScreenNui() + FreezeEntityPosition(PlayerPedId(), false) + DoScreenFadeIn(10000) + StartServerSyncLoops() end) + + TriggerEvent('esx:loadingScreenOff') end) RegisterNetEvent('esx:setMaxWeight') diff --git a/config.lua b/config.lua index 85b95982..93e400db 100644 --- a/config.lua +++ b/config.lua @@ -14,4 +14,3 @@ Config.EnableHud = true -- enable the default hud? Display current jo Config.MaxWeight = 24 -- the max inventory weight without backpack Config.PaycheckInterval = 7 * 60000 -- how often to recieve pay checks in milliseconds Config.EnableDebug = false -Config.UseKashacters = false \ No newline at end of file diff --git a/server/functions.lua b/server/functions.lua index 866f8b7b..eca0a20d 100644 --- a/server/functions.lua +++ b/server/functions.lua @@ -211,10 +211,10 @@ end ESX.StartDBSync = function() function saveData() ESX.SavePlayers() - SetTimeout(15 * 60 * 1000, saveData) + SetTimeout(10 * 60 * 1000, saveData) end - SetTimeout(15 * 60 * 1000, saveData) + SetTimeout(10 * 60 * 1000, saveData) end ESX.GetPlayers = function() From cf5dd2b45d1d4b86fdafc8f1394b37193ed80cea Mon Sep 17 00:00:00 2001 From: Mycroft Date: Sun, 11 Apr 2021 16:00:23 +0100 Subject: [PATCH 5/6] Update README.md --- README.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 4fca8643..56483d88 100644 --- a/README.md +++ b/README.md @@ -43,16 +43,23 @@ ESX was initially developed by Gizz back in 2017 for his friend as the were crea ``` cd resources -git clone https://github.com/ESX-Org/es_extended [essential]/es_extended +git clone https://github.com/esx-framework/es_extended.git +cd es_extended +git checkout legacy git clone https://github.com/ESX-Org/esx_menu_default [esx]/[ui]/esx_menu_default git clone https://github.com/ESX-Org/esx_menu_dialog [esx]/[ui]/esx_menu_dialog git clone https://github.com/ESX-Org/esx_menu_list [esx]/[ui]/esx_menu_list ``` +### Plume ESX: + +PlumeESX is a full featured (13 jobs) and highly configurable yet lightweight ESX v1.2 base that can be easily extendable. +Forum Thread: https://forum.cfx.re/t/recipe-plumeesx-full-base-2021/1964029 +YouTube Tutorial: https://www.youtube.com/watch?v=iGfwUCO0RZQ ### Manually -- Download https://github.com/ESX-Org/es_extended/releases/latest -- Put it in the `resource/[essential]` directory +- Download https://github.com/esx-framework/es_extended/tree/legacy +- Put it in the `resource/[esx]` directory - Download https://github.com/ESX-Org/esx_menu_default/releases/latest - Put it in the `resource/[esx]/[ui]` directory - Download https://github.com/ESX-Org/esx_menu_dialog/releases/latest From 2877cd2520271cdeb9a730208cf3166435997402 Mon Sep 17 00:00:00 2001 From: Mycroft Date: Sun, 11 Apr 2021 16:02:51 +0100 Subject: [PATCH 6/6] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 56483d88..27c66d25 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ YouTube Tutorial: https://www.youtube.com/watch?v=iGfwUCO0RZQ ### Manually -- Download https://github.com/esx-framework/es_extended/tree/legacy +- Download https://github.com/esx-framework/es_extended/releases/tag/v1-final - Put it in the `resource/[esx]` directory - Download https://github.com/ESX-Org/esx_menu_default/releases/latest - Put it in the `resource/[esx]/[ui]` directory