Skip to content

Commit

Permalink
refactor: standardized configuration
Browse files Browse the repository at this point in the history
* refactor: standardized configuration

* fix: error

---------

Co-authored-by: BerkieBb <[email protected]>
  • Loading branch information
mafewtm and BerkieBb authored Feb 11, 2024
1 parent b46477d commit 5f0719f
Show file tree
Hide file tree
Showing 6 changed files with 142 additions and 132 deletions.
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"Lua.diagnostics.globals": [
"lib",
"cache",
"MySQL"
]
}
106 changes: 0 additions & 106 deletions config.lua

This file was deleted.

106 changes: 106 additions & 0 deletions config/server.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
return {
commandPerms = {
useMenu = 'group.mod',
noclip = 'group.mod',
names = 'group.mod',
blips = 'group.mod',
setModel = 'group.admin',
dev = 'group.admin',
},

eventPerms = {
playerOptionsGeneral = 'group.mod',
kick = 'group.mod',
ban = 'group.admin',
changePerms = 'group.admin',
changePlayerData = 'group.admin',
giveAllWeapons = 'group.admin',
getRadioList = 'group.mod',
useMenu = 'group.mod',
clothingMenu = 'group.admin',
},

weaponList = {
pistol = {
'weapon_pistol',
'weapon_pistol_mk2',
'weapon_combatpistol',
'weapon_appistol',
'weapon_stungun',
'weapon_pistol50',
'weapon_snspistol',
'weapon_heavypistol',
'weapon_vintagepistol',
'weapon_flaregun',
'weapon_marksmanpistol',
'weapon_revolver',
'weapon_revolver_mk2',
'weapon_doubleaction',
'weapon_snspistol_mk2',
'weapon_raypistol',
'weapon_ceramicpistol',
'weapon_navyrevolver',
'weapon_gadgetpistol',
},
smg = {
'weapon_microsmg',
'weapon_smg',
'weapon_smg_mk2',
'weapon_assaultsmg',
'weapon_combatpdw',
'weapon_machinepistol',
'weapon_minismg',
'weapon_raycarbine',
},
shotgun = {
'weapon_pumpshotgun',
'weapon_sawnoffshotgun',
'weapon_assaultshotgun',
'weapon_bullpupshotgun',
'weapon_musket',
'weapon_heavyshotgun',
'weapon_dbshotgun',
'weapon_autoshotgun',
'weapon_pumpshotgun_mk2',
'weapon_combatshotgun',
},
assault = {
'weapon_assaultrifle',
'weapon_assaultrifle_mk2',
'weapon_carbinerifle',
'weapon_carbinerifle_mk2',
'weapon_advancedrifle',
'weapon_specialcarbine',
'weapon_bullpuprifle',
'weapon_compactrifle',
'weapon_specialcarbine_mk2',
'weapon_bullpuprifle_mk2',
'weapon_militaryrifle',
},
lmg = {
'weapon_mg',
'weapon_combatmg',
'weapon_gusenberg',
'weapon_combatmg_mk2',
},
sniper = {
'weapon_sniperrifle',
'weapon_heavysniper',
'weapon_marksmanrifle',
'weapon_remotesniper',
'weapon_heavysniper_mk2',
'weapon_marksmanrifle_mk2',
},
heavy = {
'weapon_rpg',
'weapon_grenadelauncher',
'weapon_grenadelauncher_smoke',
'weapon_minigun',
'weapon_firework',
'weapon_railgun',
'weapon_hominglauncher',
'weapon_compactlauncher',
'weapon_rayminigun',
},
},
}
4 changes: 2 additions & 2 deletions fxmanifest.lua
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
fx_version 'cerulean'
game 'gta5'

description 'qbx_adminmenu'
repository 'https://github.com/Qbox-project/qbx_adminmenu'
version '1.0.0'
description 'https://github.com/Qbox-project'

ox_lib 'locale'

shared_scripts {
'@ox_lib/init.lua',
'@qbx_core/modules/utils.lua',
'config.lua',
}

server_scripts {
Expand Down
20 changes: 11 additions & 9 deletions server/commands.lua
Original file line number Diff line number Diff line change
@@ -1,34 +1,36 @@
local config = require 'config.server'.commandPerms

lib.addCommand('admin', {
help = 'Opens Adminmenu',
restricted = 'admin',
restricted = config.useMenu,
}, function(source)
TriggerClientEvent('qbx_admin:client:openMenu', source)
end)

lib.addCommand('noclip', {
help = 'Toggle NoClip',
restricted = 'admin',
restricted = config.noclip,
}, function(source)
TriggerClientEvent('qbx_admin:client:noclip', source)
end)

lib.addCommand('names', {
help = 'Toggle Player Names',
restricted = 'admin',
restricted = config.names,
}, function(source)
TriggerClientEvent('qbx_admin:client:names', source)
end)

lib.addCommand('blips', {
help = 'Toggle Player Blips',
restricted = 'admin',
restricted = config.blips,
}, function(source)
TriggerClientEvent('qbx_admin:client:blips', source)
end)

lib.addCommand('setmodel', {
help = 'Sets your model to the given model',
restricted = 'admin',
restricted = config.setModel,
params = {
{name = 'model', help = 'NPC Model', type = 'string'},
{name = 'id', help = 'Player ID', type = 'number', optional = true},
Expand All @@ -43,28 +45,28 @@ end)

lib.addCommand('vec2', {
help = 'Copy vector2 to clipboard (Admin only)',
restricted = 'admin',
restricted = config.dev,
}, function(source)
TriggerClientEvent('qbx_admin:client:copyToClipboard', source, 'coords2')
end)

lib.addCommand('vec3', {
help = 'Copy vector3 to clipboard (Admin only)',
restricted = 'admin',
restricted = config.dev,
}, function(source)
TriggerClientEvent('qbx_admin:client:copyToClipboard', source, 'coords3')
end)

lib.addCommand('vec4', {
help = 'Copy vector4 to clipboard (Admin only)',
restricted = 'admin',
restricted = config.dev,
}, function(source)
TriggerClientEvent('qbx_admin:client:copyToClipboard', source, 'coords4')
end)

lib.addCommand('heading', {
help = 'Copy heading to clipboard (Admin only)',
restricted = 'admin',
restricted = config.dev,
}, function(source)
TriggerClientEvent('qbx_admin:client:copyToClipboard', source, 'heading')
end)
Loading

0 comments on commit 5f0719f

Please sign in to comment.