From 9dc3383cb3a80216a309ce701cffef7ef1f88b6f Mon Sep 17 00:00:00 2001 From: Andyyy7666 <86536434+Andyyy7666@users.noreply.github.com> Date: Sun, 17 Jul 2022 07:22:52 +0200 Subject: [PATCH] Small change when selecting a character MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since the triggered server event triggers a client even that updates the selected character on the client in ND_Core I didn’t need to use a callback to update the selected character. --- ND_CharacterSelection/source/client.lua | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/ND_CharacterSelection/source/client.lua b/ND_CharacterSelection/source/client.lua index 00d27cd..65c1f04 100644 --- a/ND_CharacterSelection/source/client.lua +++ b/ND_CharacterSelection/source/client.lua @@ -100,10 +100,8 @@ end) -- Selecting a player from the iu. RegisterNUICallback("setMainCharacter", function(data) - NDCore.Functions.GetCharacters(function(characters) - NDCore.SelectedCharacter = characters[data.id] - end) - for _, spawn in pairs(config.spawns[NDCore.SelectedCharacter.job]) do + local characters = NDCore.Functions.GetCharacters() + for _, spawn in pairs(config.spawns[characters[data.id].job]) do SendNUIMessage({ type = "setSpawns", x = spawn.x, @@ -112,7 +110,7 @@ RegisterNUICallback("setMainCharacter", function(data) name = spawn.name }) end - TriggerServerEvent("ND:setCharacterOnline", NDCore.SelectedCharacter.id) + TriggerServerEvent("ND:setCharacterOnline", data.id) end) -- Creating a character from the ui. @@ -189,4 +187,4 @@ RegisterCommand(config.changeCharacterCommand, function() end, false) -- chat suggestions -TriggerEvent("chat:addSuggestion", "/" .. config.changeCharacterCommand, "Switch your framework character.") \ No newline at end of file +TriggerEvent("chat:addSuggestion", "/" .. config.changeCharacterCommand, "Switch your framework character.")