Skip to content

Commit

Permalink
feat(server/commands): Use ox_lib v3 format
Browse files Browse the repository at this point in the history
  • Loading branch information
TheiLLeniumStudios committed Feb 26, 2023
1 parent fd0fb3b commit a5fde35
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 11 deletions.
5 changes: 2 additions & 3 deletions server/framework/esx/migrate.lua
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,7 @@ local function convertSkinToNewFormat(oldSkin, gender)
return skin
end


lib.addCommand("admin", "migrateskins", function(source)
lib.addCommand("migrateskins", { help = "Migrate skins", restricted = "group.admin" }, function(source)
local users = Database.Users.GetAll()
local convertedSkins = 0
if users then
Expand All @@ -154,4 +153,4 @@ lib.addCommand("admin", "migrateskins", function(source)
type = "success",
position = Config.NotifyOptions.position
})
end, nil, "Migrate skins to illenium-appearance")
end)
13 changes: 11 additions & 2 deletions server/framework/qb/migrate.lua
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,16 @@ RegisterNetEvent("illenium-appearance:server:migrate-qb-clothing-skin", function
})
end)

lib.addCommand("god", "migrateskins", function(source, args)
lib.addCommand("migrateskins", {
help = "Migrate skins",
params = {
{
name = "resourceName",
type = "string",
},
},
restricted = "group.god"
}, function(source, args)
local resourceName = args.resourceName
if resourceName == "fivem-appearance" then
MigrateFivemAppearance(source)
Expand All @@ -85,4 +94,4 @@ lib.addCommand("god", "migrateskins", function(source, args)
position = Config.NotifyOptions.position
})
end
end, {"resourceName:string"}, "Migrate skins")
end)
23 changes: 17 additions & 6 deletions server/server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,18 @@ RegisterNetEvent("illenium-appearance:server:ResetRoutingBucket", function()
end)

if Config.EnablePedMenu then
lib.addCommand(Config.PedMenuGroup, "pedmenu", function(source, args)
lib.addCommand("pedmenu", {
help = _L("commands.pedmenu.title"),
params = {
{
name = "playerID",
type = "number",
help = "Target player's server id",
optional = true
},
},
restricted = Config.PedMenuGroup
}, function(source, args)
local target = source
if args.playerID then
local citizenID = Framework.GetPlayerID(args.playerID)
Expand All @@ -319,15 +330,15 @@ if Config.EnablePedMenu then
end
end
TriggerClientEvent("illenium-appearance:client:openClothingShopMenu", target, true)
end, {"playerID:?number"}, _L("commands.pedmenu.title"))
end)
end

lib.addCommand(false, "reloadskin", function(source)
lib.addCommand("reloadskin", { help = _L("commands.reloadskin.title") }, function(source)
TriggerClientEvent("illenium-appearance:client:reloadSkin", source)
end, nil, _L("commands.reloadskin.title"))
end)

lib.addCommand(false, "clearstuckprops", function(source)
lib.addCommand("clearstuckprops", { help = _L("commands.clearstuckprops.title") }, function(source)
TriggerClientEvent("illenium-appearance:client:ClearStuckProps", source)
end, nil, _L("commands.clearstuckprops.title"))
end)

lib.versionCheck("iLLeniumStudios/illenium-appearance")

0 comments on commit a5fde35

Please sign in to comment.