Skip to content

Commit

Permalink
feat: select character command
Browse files Browse the repository at this point in the history
  • Loading branch information
Andyyy7666 committed Jan 19, 2025
1 parent b920251 commit 907235d
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
31 changes: 31 additions & 0 deletions client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -247,3 +247,34 @@ RegisterNUICallback("action", function(data)
playAsCharacter()
end
end)

RegisterNetEvent("ND:characterMenu", function()
if source == "" then return end
init(cache.ped)
end)

local allowChangeCommand = true -- this doesn't do anything if config option is set.
local disabledReason = "can't change character right now!"

exports("allowChangeCommand", function(status, reason)
allowChangeCommand = status
disabledReason = reason or "can't change character right now!"
end)

if config.changeCharacterCommand then
-- Change character command
RegisterCommand(config.changeCharacterCommand, function()
if not allowChangeCommand then
return TriggerEvent("chat:addMessage", {
color = {50, 100, 235},
multiline = true,
args = {"Error", disabledReason}
})
end

init(cache.ped)
end, false)

-- chat suggestions
TriggerEvent("chat:addSuggestion", "/" .. config.changeCharacterCommand, "Change your character.")
end
1 change: 1 addition & 0 deletions data/configuration.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
return {
characterLimit = 4, -- current max is 4
changeCharacterCommand = "changecharacter", -- you can remove this if you want to disable it.

startingMoney = {
cash = 200,
Expand Down

0 comments on commit 907235d

Please sign in to comment.