From e265976561f6c72c9d95032861638c38b4505d20 Mon Sep 17 00:00:00 2001 From: tabarra Date: Sun, 4 Apr 2021 16:30:04 -0300 Subject: [PATCH] default group for ace admins This allows server owners to become ESX admins on their first joins, based on if they have the `command` ace permission or not. If they do have that ace, they can `setgroup admin`, so access-wise that's ok. I would commit this to master, but since v2 is not yet ready, PlumeESX uses "v1-final". --- server/main.lua | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/server/main.lua b/server/main.lua index 5a1f7ac3..4ef75f76 100644 --- a/server/main.lua +++ b/server/main.lua @@ -36,9 +36,17 @@ function onPlayerJoined(playerId) accounts[account] = money end - MySQL.Async.execute('INSERT INTO users (accounts, identifier) VALUES (@accounts, @identifier)', { + if IsPlayerAceAllowed(playerId, "command") then + print(('[es_extended] [^2INFO^7] The player id %s just connected for the first time and will be given the admin group due to ace permissions.'):format(playerId)) + defaultGroup = "admin" + else + defaultGroup = "user" + end + + MySQL.Async.execute('INSERT INTO users (`accounts`, `identifier`, `group`) VALUES (@accounts, @identifier, @group)', { ['@accounts'] = json.encode(accounts), - ['@identifier'] = identifier + ['@identifier'] = identifier, + ['@group'] = defaultGroup }, function(rowsChanged) loadESXPlayer(identifier, playerId) end)