mirror of
https://github.com/ND-Framework/ND_Core.git
synced 2026-08-17 05:56:01 +01:00
Small change when selecting a character
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.
This commit is contained in:
@@ -100,10 +100,8 @@ end)
|
|||||||
|
|
||||||
-- Selecting a player from the iu.
|
-- Selecting a player from the iu.
|
||||||
RegisterNUICallback("setMainCharacter", function(data)
|
RegisterNUICallback("setMainCharacter", function(data)
|
||||||
NDCore.Functions.GetCharacters(function(characters)
|
local characters = NDCore.Functions.GetCharacters()
|
||||||
NDCore.SelectedCharacter = characters[data.id]
|
for _, spawn in pairs(config.spawns[characters[data.id].job]) do
|
||||||
end)
|
|
||||||
for _, spawn in pairs(config.spawns[NDCore.SelectedCharacter.job]) do
|
|
||||||
SendNUIMessage({
|
SendNUIMessage({
|
||||||
type = "setSpawns",
|
type = "setSpawns",
|
||||||
x = spawn.x,
|
x = spawn.x,
|
||||||
@@ -112,7 +110,7 @@ RegisterNUICallback("setMainCharacter", function(data)
|
|||||||
name = spawn.name
|
name = spawn.name
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
TriggerServerEvent("ND:setCharacterOnline", NDCore.SelectedCharacter.id)
|
TriggerServerEvent("ND:setCharacterOnline", data.id)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- Creating a character from the ui.
|
-- Creating a character from the ui.
|
||||||
@@ -189,4 +187,4 @@ RegisterCommand(config.changeCharacterCommand, function()
|
|||||||
end, false)
|
end, false)
|
||||||
|
|
||||||
-- chat suggestions
|
-- chat suggestions
|
||||||
TriggerEvent("chat:addSuggestion", "/" .. config.changeCharacterCommand, "Switch your framework character.")
|
TriggerEvent("chat:addSuggestion", "/" .. config.changeCharacterCommand, "Switch your framework character.")
|
||||||
|
|||||||
Reference in New Issue
Block a user