From 4b2d95059c5c402473c173aa0707ebfc894e5811 Mon Sep 17 00:00:00 2001 From: Mycroft Date: Wed, 28 Apr 2021 21:42:12 +0100 Subject: [PATCH] Updates --- README.md | 6 ++---- client/main.lua | 3 +++ config.lua | 16 ++++++++++------ fxmanifest.lua | 2 +- server/commands.lua | 13 +++++-------- server/functions.lua | 9 +++++++++ server/main.lua | 35 ++++++++++++++++++++++++----------- version.json | 5 +++++ 8 files changed, 59 insertions(+), 30 deletions(-) create mode 100644 version.json diff --git a/README.md b/README.md index 27c66d25..e57318b4 100644 --- a/README.md +++ b/README.md @@ -43,9 +43,7 @@ ESX was initially developed by Gizz back in 2017 for his friend as the were crea ``` cd resources -git clone https://github.com/esx-framework/es_extended.git -cd es_extended -git checkout legacy +git clone https://github.com/esx-framework/es_extended.git --branch 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 @@ -93,7 +91,7 @@ start esx_menu_dialog es_extended - ESX framework for FiveM -Copyright (C) 2015-2020 Jérémie N'gadi +Copyright (C) 2015-2021 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/client/main.lua b/client/main.lua index 0e82470e..18904766 100644 --- a/client/main.lua +++ b/client/main.lua @@ -5,6 +5,7 @@ Citizen.CreateThread(function() Citizen.Wait(0) if NetworkIsPlayerActive(PlayerId()) then + if not Config.UseMulticharacter end TriggerServerEvent('esx:onPlayerJoined') break end @@ -39,8 +40,10 @@ AddEventHandler('esx:playerLoaded', function(playerData) NetworkSetFriendlyFireOption(true) -- disable wanted level +if not Config.EnableWantedLevel then ClearPlayerWantedLevel(PlayerId()) SetMaxWantedLevel(0) +end if Config.EnableHud then for k,v in ipairs(playerData.accounts) do diff --git a/config.lua b/config.lua index 7dce64fd..f778c00e 100644 --- a/config.lua +++ b/config.lua @@ -7,11 +7,15 @@ Config.Accounts = { money = _U('account_money') } -Config.StartingAccountMoney = {bank = 50000} +Config.StartingAccountMoney = {bank = 50000} -Config.EnableSocietyPayouts = false -- pay from the society account that the player is employed at? Requirement: esx_society -Config.EnableHud = true -- enable the default hud? Display current job and accounts (black, bank & cash) -Config.MaxWeight = 24 -- the max inventory weight without backpack -Config.PaycheckInterval = 7 * 60000 -- how often to recieve pay checks in milliseconds -Config.EnableDebug = false -- Use Debug options? +Config.EnableSocietyPayouts = false -- pay from the society account that the player is employed at? Requirement: esx_society +Config.EnableHud = true -- enable the default hud? Display current job and accounts (black, bank & cash) +Config.MaxWeight = 24 -- the max inventory weight without backpack +Config.PaycheckInterval = 7 * 60000 -- how often to recieve pay checks 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.DisableSuperadmin = true -- Disable the use of superadmin +Config.UseMulticharacter = false -- WIP, ADDS multicharacter features + diff --git a/fxmanifest.lua b/fxmanifest.lua index 0f1c2f78..663669a4 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -4,7 +4,7 @@ game 'gta5' description 'ES Extended' -version '1.2.0' +version 'legacy' server_scripts { '@async/async.lua', diff --git a/server/commands.lua b/server/commands.lua index 7abecfb6..51ddd400 100644 --- a/server/commands.lua +++ b/server/commands.lua @@ -20,6 +20,7 @@ end, true, {help = _U('command_setjob'), validate = true, arguments = { }}) ESX.RegisterCommand('car', 'admin', function(xPlayer, args, showError) + if not args.car then args.car = "baller2" end xPlayer.triggerEvent('esx:spawnVehicle', args.car) end, false, {help = _U('command_car'), validate = false, arguments = { {name = 'car', help = _U('command_car_car'), type = 'any'} @@ -124,6 +125,8 @@ end, true, {help = _U('command_clearloadout'), validate = true, arguments = { }}) ESX.RegisterCommand('setgroup', 'admin', function(xPlayer, args, showError) + if not args.playerId then args.playerId = xPlayer.source end + if Config.DisableSuperadmin and args.group == "superadmin" then args.group = "admin" end args.playerId.setGroup(args.group) end, true, {help = _U('command_setgroup'), validate = true, arguments = { {name = 'playerId', help = _U('commandgeneric_playerid'), type = 'player'}, @@ -141,19 +144,13 @@ ESX.RegisterCommand('saveall', 'admin', function(xPlayer, args, showError) end, true, {help = _U('command_saveall')}) ESX.RegisterCommand('currentgroup', {"user", "admin"}, function(xPlayer, args, showError) - TriggerClientEvent('chatMessage', xPlayer.source, "You are currently: "..xPlayer.getGroup())) + print("You are currently: ".. xPlayer.getGroup()) end, true) ESX.RegisterCommand('getcoords', "admin", function(xPlayer, args, showError) - print("".. xPlayer.getName().. ": "xPlayer.getCoords(true)) + print("".. xPlayer.getName().. ": ".. xPlayer.getCoords(true)) end, true) -ESX.RegisterCommand('tpm', "admin", function(xPlayer, args, showError) - TriggerEvent("esx:admin:tpm", xPlayer.source, args.playerid) -end, true, {help = _U('command_save'), validate = true, arguments = { - {name = 'playerId', help = _U('commandgeneric_playerid'), type = 'player'} -}})) - ESX.RegisterCommand('getplayers', "admin", function(xPlayer, args, showError) local xAll = ESX.GetPlayers() print("^2"..#xAll.." ^3online player(s)^0") diff --git a/server/functions.lua b/server/functions.lua index eca0a20d..d10fc007 100644 --- a/server/functions.lua +++ b/server/functions.lua @@ -284,3 +284,12 @@ ESX.DoesJobExist = function(job, grade) return false end + +ESX.GetPlayerIdentifier = function(playerId) + local identifiers = GetPlayerIdentifiers(playerId) + for _,id in ipairs(identifiers) do + if id:find(Config.IdentifierPrefix) then + return id:gsub(string.format("%s:","licence"),"") + end + end +end \ No newline at end of file diff --git a/server/main.lua b/server/main.lua index 4ef75f76..f276466d 100644 --- a/server/main.lua +++ b/server/main.lua @@ -1,6 +1,6 @@ Citizen.CreateThread(function() SetMapName('San Andreas') - SetGameType('Roleplay') + SetGameType('ESX Roleplay') end) RegisterNetEvent('esx:onPlayerJoined') @@ -10,13 +10,23 @@ AddEventHandler('esx:onPlayerJoined', function() end end) +if Config.UseMulticharacter then +AddEventHandler("esx:overwriteIdentifierMethod",function(ref) + ESX.GetPlayerIdentifier = ref +end) +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 + if Config.UseMulticharacter then + local identifier = ESX.GetPlayerIdentifier(playerId) + else + for k,v in ipairs(GetPlayerIdentifiers(playerId)) do + if string.match(v, 'license:') then + identifier = string.sub(v, 9) + break + end end end @@ -63,13 +73,17 @@ 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 + + if Config.UseMulticharacter then + local identifier = ESX.GetPlayerIdentifier(playerId) + else + 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 deferrals.done(('There was an error loading your character!\nError code: identifier-active\n\nThis error is caused by a player on this server who has the same identifier as you have. Make sure you are not playing on the same Rockstar account.\n\nYour Rockstar identifier: %s'):format(identifier)) @@ -81,7 +95,6 @@ AddEventHandler('playerConnecting', function(name, setCallback, deferrals) end end) - function loadESXPlayer(identifier, playerId) local tasks = {} diff --git a/version.json b/version.json new file mode 100644 index 00000000..98331ca6 --- /dev/null +++ b/version.json @@ -0,0 +1,5 @@ +{ + "version": "legacy", + "commit" : "1", + "changelog": "Performance Improvements; Config Updates; Bug Fixes" +}