diff --git a/[esx]/es_extended/client/functions.lua b/[esx]/es_extended/client/functions.lua index 81446761..4f031504 100644 --- a/[esx]/es_extended/client/functions.lua +++ b/[esx]/es_extended/client/functions.lua @@ -680,18 +680,18 @@ function ESX.Game.GetVehicleProperties(vehicle) customPrimaryColor = {GetVehicleCustomPrimaryColour(vehicle)} end - local customXenonColorR, customXenonColorG, customXenonColorB = GetVehicleXenonLightsCustomColor(vehicle) - local customXenonColor = nil - if customXenonColorR and customXenonColorG and customXenonColorB then - customXenonColor = {customXenonColorR, customXenonColorG, customXenonColorB} - end - - local hasCustomSecondaryColor = GetIsVehicleSecondaryColourCustom(vehicle) - local customSecondaryColor = nil - if hasCustomSecondaryColor then - customSecondaryColor = {GetVehicleCustomSecondaryColour(vehicle)} - end - local extras = {} + local hasCustomXenonColor, customXenonColorR, customXenonColorG, customXenonColorB = GetVehicleXenonLightsCustomColor(vehicle) + local customXenonColor = nil + if hasCustomXenonColor then + customXenonColor = {customXenonColorR, customXenonColorG, customXenonColorB} + end + + local hasCustomSecondaryColor = GetIsVehicleSecondaryColourCustom(vehicle) + local customSecondaryColor = nil + if hasCustomSecondaryColor then + customSecondaryColor = {GetVehicleCustomSecondaryColour(vehicle)} + end + local extras = {} for extraId = 0, 12 do if DoesExtraExist(vehicle, extraId) then diff --git a/[esx]/es_extended/client/main.lua b/[esx]/es_extended/client/main.lua index c7ce21af..b613f741 100644 --- a/[esx]/es_extended/client/main.lua +++ b/[esx]/es_extended/client/main.lua @@ -13,6 +13,10 @@ CreateThread(function() end end) +RegisterNetEvent("esx:requestModel", function(model) + ESX.Streaming.RequestModel(model) +end) + RegisterNetEvent('esx:playerLoaded') AddEventHandler('esx:playerLoaded', function(xPlayer, isNew, skin) ESX.PlayerData = xPlayer diff --git a/[esx]/es_extended/server/classes/player.lua b/[esx]/es_extended/server/classes/player.lua index c50b7c00..73634829 100644 --- a/[esx]/es_extended/server/classes/player.lua +++ b/[esx]/es_extended/server/classes/player.lua @@ -19,6 +19,12 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory, if Config.Multichar then self.license = 'license'.. identifier:sub(identifier:find(':'), identifier:len()) else self.license = 'license:'..identifier end ExecuteCommand(('add_principal identifier.%s group.%s'):format(self.license, self.group)) + + Player(self.source).state:set("identifier", self.identifier, true) + Player(self.source).state:set("license", self.license, true) + Player(self.source).state:set("job", self.job, true) + Player(self.source).state:set("group", self.group, true) + Player(self.source).state:set("name", self.name, true) function self.triggerEvent(eventName, ...) TriggerClientEvent(eventName, self.source, ...) @@ -78,6 +84,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory, function self.setGroup(newGroup) ExecuteCommand(('remove_principal identifier.%s group.%s'):format(self.license, self.group)) self.group = newGroup + Player(self.source).state:set("group", self.group, true) ExecuteCommand(('add_principal identifier.%s group.%s'):format(self.license, self.group)) end @@ -87,6 +94,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory, function self.set(k, v) self.variables[k] = v + Player(self.source).state:set(k, v, true) end function self.get(k) @@ -170,6 +178,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory, function self.setName(newName) self.name = newName + Player(self.source).state:set("name", self.name, true) end function self.setAccountMoney(accountName, money, reason) @@ -360,6 +369,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory, TriggerEvent('esx:setJob', self.source, self.job, lastJob) self.triggerEvent('esx:setJob', self.job) + Player(self.source).state:set("job", self.job, true) else print(('[es_extended] [^3WARNING^7] Ignoring invalid ^5.setJob()^7 usage for ID: ^5%s^7, Job: ^5%s^7'):format(self.source, job)) end diff --git a/[esx]/es_extended/server/onesync.lua b/[esx]/es_extended/server/onesync.lua index 424f6ea8..67a629d1 100644 --- a/[esx]/es_extended/server/onesync.lua +++ b/[esx]/es_extended/server/onesync.lua @@ -62,23 +62,21 @@ end ---@param Properties table ---@param cb function function ESX.OneSync.SpawnVehicle(model, coords, heading, Properties, cb) - model = type(model) == 'string' and joaat(model) or model - Properties = Properties or {} - local vector = type(coords) == "vector3" and coords or vec(coords.x, coords.y, coords.z) - CreateThread(function() - local player = nil - for _, playerId in ipairs(GetPlayers()) do - ESX.GetVehicleType(model, playerId, function(Type) - local SpawnedEntity = CreateVehicleServerSetter(model, Type, vector, heading) - Wait(250) - local NetworkId = NetworkGetNetworkIdFromEntity(SpawnedEntity) - Properties.NetId = NetworkId - Entity(SpawnedEntity).state:set('VehicleProperties', Properties, true) - cb(NetworkId) - end) - break - end - end) + model = type(model) == 'string' and joaat(model) or model + Properties = Properties or {} + local vector = type(coords) == "vector3" and coords or vec(coords.x, coords.y, coords.z) + TriggerClientEvent("esx:requestModel", -1, model) + CreateThread(function() + local xPlayer = ESX.OneSync.GetClosestPlayer(vector, 200) + ESX.GetVehicleType(model, xPlayer.id, function(Type) + local SpawnedEntity = CreateVehicleServerSetter(model, Type, vector, heading) + Wait(250) + local NetworkId = NetworkGetNetworkIdFromEntity(SpawnedEntity) + Properties.NetId = NetworkId + Entity(SpawnedEntity).state:set('VehicleProperties', Properties, true) + cb(NetworkId) + end) + end) end diff --git a/[esx]/esx_identity/README.md b/[esx]/esx_identity/README.md index c73c4330..f4053cad 100644 --- a/[esx]/esx_identity/README.md +++ b/[esx]/esx_identity/README.md @@ -2,13 +2,13 @@ A Core Resource that Allows the player to Pick their characters, Name, Gender, Height and Date-of-birth. - + # Infomation ## Requirements - [esx_skin](./../esx_skin/README.md) +[esx_skin](./../esx_skin/README.md) ## Commands diff --git a/[esx]/esx_identity/client/main.lua b/[esx]/esx_identity/client/main.lua index 13e3d532..9b7dd31a 100644 --- a/[esx]/esx_identity/client/main.lua +++ b/[esx]/esx_identity/client/main.lua @@ -10,12 +10,12 @@ end) RegisterNetEvent('esx_identity:setPlayerData', function(data) SetTimeout(1, function() - ESX.SetPlayerData("name", ('%s %s'):format(data.firstName, data.lastName)) - ESX.SetPlayerData('firstName', data.firstName) - ESX.SetPlayerData('lastName', data.lastName) - ESX.SetPlayerData('dateofbirth', data.dateOfBirth) - ESX.SetPlayerData('sex', data.sex) - ESX.SetPlayerData('height', data.height) + ESX.SetPlayerData("name", ('%s %s'):format(data.firstName, data.lastName)) + ESX.SetPlayerData('firstName', data.firstName) + ESX.SetPlayerData('lastName', data.lastName) + ESX.SetPlayerData('dateofbirth', data.dateOfBirth) + ESX.SetPlayerData('sex', data.sex) + ESX.SetPlayerData('height', data.height) end) end) diff --git a/[esx]/esx_identity/esx_identity.sql b/[esx]/esx_identity/esx_identity.sql index 026ba5da..15f55f6c 100644 --- a/[esx]/esx_identity/esx_identity.sql +++ b/[esx]/esx_identity/esx_identity.sql @@ -1,9 +1,7 @@ - - ALTER TABLE `users` ADD COLUMN `firstname` VARCHAR(16) NULL DEFAULT NULL, ADD COLUMN `lastname` VARCHAR(16) NULL DEFAULT NULL, ADD COLUMN `dateofbirth` VARCHAR(10) NULL DEFAULT NULL, ADD COLUMN `sex` VARCHAR(1) NULL DEFAULT NULL, ADD COLUMN `height` INT NULL DEFAULT NULL -; +; \ No newline at end of file diff --git a/[esx]/esx_identity/fxmanifest.lua b/[esx]/esx_identity/fxmanifest.lua index 7d3db1c9..2295a063 100644 --- a/[esx]/esx_identity/fxmanifest.lua +++ b/[esx]/esx_identity/fxmanifest.lua @@ -6,10 +6,12 @@ description 'ESX Identity' lua54 'yes' version '1.8.5' -shared_script '@es_extended/imports.lua' +shared_scripts { + '@es_extended/imports.lua', + '@es_extended/locale.lua', +} server_scripts { - '@es_extended/locale.lua', '@oxmysql/lib/MySQL.lua', 'locales/*.lua', 'config.lua', @@ -17,7 +19,6 @@ server_scripts { } client_scripts { - '@es_extended/locale.lua', 'locales/*.lua', 'config.lua', 'client/main.lua' @@ -31,4 +32,4 @@ files { 'html/css/style.css', } -dependency 'es_extended' +dependency 'es_extended' \ No newline at end of file diff --git a/[esx]/esx_identity/html/index.html b/[esx]/esx_identity/html/index.html index 4960eee5..d9ca6d93 100644 --- a/[esx]/esx_identity/html/index.html +++ b/[esx]/esx_identity/html/index.html @@ -1,23 +1,24 @@ - + +
- - + - + + +