Skip to content

Commit 3de6402

Browse files
committedDec 11, 2024
localize across the board and fix anything that i forgot to localize.
1 parent 46e9f74 commit 3de6402

5 files changed

+21
-12
lines changed
 

‎sv_ace_perms.lua

+6-4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ if not Config.AcePermsEnabled then return end
33
local pairs = pairs
44
local tostring = tostring
55

6+
local _GetIdentifiersTable = GetIdentifiersTable
7+
local _getRoles = getRoles
68
local _ExecuteCommand = ExecuteCommand
79
local _GetPlayerName = GetPlayerName
810

@@ -18,7 +20,7 @@ local permissionAdd = "add_ace identifier.%s \"%s\" allow"
1820
local permissionRemove = "remove_ace identifier.%s \"%s\" allow"
1921

2022
local function applyPermissions(source)
21-
local identifiers = GetIdentifiersTable(source)
23+
local identifiers = _GetIdentifiersTable(source)
2224
local license, discord = identifiers.license, identifiers.discord
2325

2426
for _, v in pairs(groupsToRemove) do
@@ -31,7 +33,7 @@ local function applyPermissions(source)
3133

3234
if not discord then return end
3335

34-
local roles = getRoles(source)
36+
local roles = _getRoles(source)
3537
if roles == nil then return end
3638

3739
local name = _GetPlayerName(source) or ""
@@ -41,14 +43,14 @@ local function applyPermissions(source)
4143
local permissionInformation = permissions[tostring(v)]
4244

4345
if not groupInformation then goto skipGroupInformation end
44-
ExecuteCommand(groupAdd:format(license, groupInformation))
46+
_ExecuteCommand(groupAdd:format(license, groupInformation))
4547
Log("Granted \"" .. groupInformation.. "\" to " .. name .. " (" .. license .. ").")
4648
::skipGroupInformation::
4749

4850
if not permissionInformation then goto skipPermissionInformation end
4951
Log("Granting permission set for role ID: " .. v .. ".")
5052
for _, v2 in pairs(permissionInformation) do
51-
ExecuteCommand(permissionAdd:format(license, v2))
53+
_ExecuteCommand(permissionAdd:format(license, v2))
5254
Log("Granted \"" .. v2.. "\" to " .. name .. " (" .. license .. ") due to them having the role ID: " .. v .. ".")
5355
end
5456
::skipPermissionInformation::

‎sv_chat_tags.lua

+5-3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ local tonumber = tonumber
66
local find = string.find
77
local insert = table.insert
88

9+
local _GetIdentifiersTable = GetIdentifiersTable
10+
local _getRoles = getRoles
911
local _IsPlayerAceAllowed = IsPlayerAceAllowed
1012
local _TriggerClientEvent = TriggerClientEvent
1113

@@ -17,14 +19,14 @@ local playerSelectedRole = {}
1719
local playerStaffChatStatus = {}
1820

1921
local function syncTags(source)
20-
local identifiers = GetIdentifiersTable(source)
22+
local identifiers = _GetIdentifiersTable(source)
2123

2224
local rolesAllowed = {}
2325
local highestRole, highestRoleIndex = nil, nil
2426
local roles = nil
2527

2628
if identifiers.discord then
27-
roles = getRoles(source)
29+
roles = _getRoles(source)
2830
end
2931

3032
for i = 1, #RoleList do
@@ -48,7 +50,7 @@ local function syncTags(source)
4850
end
4951

5052
local function sendMessage(source, message)
51-
TriggerClientEvent("chat:addMessage", source, {
53+
_TriggerClientEvent("chat:addMessage", source, {
5254
color = {255, 0, 0},
5355
multiline = true,
5456
args = {"Server", tostring(message)}

‎sv_deferrals.lua

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
if not Config.DiscordRequired then return end
22

3+
local _GetIdentifiersTable = GetIdentifiersTable
4+
35
local GuildRequired = Config.GuildRequired
46

57
AddEventHandler("playerConnecting", function(_, _, deferrals)
68
deferrals.defer()
79
Wait(0)
810

9-
local identifiers = GetIdentifiersTable(source)
11+
local identifiers = _GetIdentifiersTable(source)
1012
local discord = identifiers.discord
1113

1214
if not discord then

‎sv_discord_api.lua

+4-3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ local tostring = tostring
55
local encode = json.encode
66
local decode = json.decode
77

8+
local _GetIdentifiersTable = GetIdentifiersTable
89
local _PerformHttpRequest = PerformHttpRequest
910
local _Wait = Citizen.Wait
1011

@@ -34,7 +35,7 @@ local function DiscordRequest(endpoint, method, jsondata)
3435
end
3536

3637
function isInGuild(user)
37-
local identifiers = GetIdentifiersTable(user)
38+
local identifiers = _GetIdentifiersTable(user)
3839
if not identifiers.discord then return false end
3940

4041
local endpoint = ("guilds/%s/members/%s"):format(GuildID, identifiers.discord)
@@ -44,7 +45,7 @@ function isInGuild(user)
4445
end
4546

4647
function getRoles(user)
47-
local identifiers = GetIdentifiersTable(user)
48+
local identifiers = _GetIdentifiersTable(user)
4849
if not identifiers.discord then return {} end
4950

5051
local endpoint = ("guilds/%s/members/%s"):format(GuildID, identifiers.discord)
@@ -56,7 +57,7 @@ function getRoles(user)
5657
end
5758

5859
function isRolePresent(user, role)
59-
local identifiers = GetIdentifiersTable(user)
60+
local identifiers = _GetIdentifiersTable(user)
6061
if not identifiers.discord then return false end
6162

6263
local endpoint = ("guilds/%s/members/%s"):format(GuildID, identifiers.discord)

‎sv_utility.lua

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ local gsub = string.gsub
77
local gmatch = string.gmatch
88
local insert = table.insert
99

10+
local _GetPlayerIdentifiers = GetPlayerIdentifiers
11+
1012
cachedIdentifiers = {}
1113

1214
function Log(message)
@@ -17,7 +19,7 @@ function GetIdentifiersTable(player)
1719
if cachedIdentifiers[player] then return cachedIdentifiers[player] end
1820
local data = {}
1921

20-
for _, v in pairs(GetPlayerIdentifiers(player))do
22+
for _, v in pairs(_GetPlayerIdentifiers(player))do
2123
if sub(v, 1, len("license:")) == "license:" then
2224
data.license = v
2325
elseif sub(v, 1, len("discord:")) == "discord:" then

0 commit comments

Comments
 (0)
Please sign in to comment.