Skip to content

Commit

Permalink
Update v2.6.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Musiker15 committed Oct 17, 2024
1 parent bdfc060 commit 560bbef
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion fxmanifest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ games { 'gta5' }
author 'Musiker15 - MSK Scripts'
name 'msk_core'
description 'Functions for MSK Scripts'
version '2.6.2'
version '2.6.3'

lua54 'yes'

Expand Down
12 changes: 10 additions & 2 deletions server/functions/ace.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,16 @@ MSK.IsAceAllowed = function(playerId, command)
end
exports('IsAceAllowed', MSK.IsAceAllowed)

MSK.IsPrincipalAceAllowed = function(restricted, ace)
return IsPrincipalAceAllowed(restricted, ace)
MSK.IsPrincipalAceAllowed = function(principal, ace)
if not MSK.String.StartsWith(principal, 'group.') and not MSK.String.StartsWith(principal, 'player.') then
if type(principal) == 'string' then
principal = 'group.'..principal
elseif tonumber(principal) then
principal = 'player.'..tostring(principal)
end
end

return IsPrincipalAceAllowed(principal, ace)
end
exports('IsPrincipalAceAllowed', MSK.IsPrincipalAceAllowed)

Expand Down
4 changes: 2 additions & 2 deletions server/functions/commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,13 @@ MSK.RegisterCommand = function(commandName, callback, properties, ...)
if restricted then
local ace = ('command.%s'):format(commandName)

if type(restricted) == 'string' and not IsPrincipalAceAllowed(restricted, ace) then
if type(restricted) == 'string' and not MSK.IsPrincipalAceAllowed(restricted, ace) then
MSK.AddAce(restricted, ace)
elseif type(restricted) == 'table' then
for i = 1, #restricted do
local res = restricted[i]

if not IsPrincipalAceAllowed(res, ace) then
if not MSK.IsPrincipalAceAllowed(res, ace) then
MSK.AddAce(res, ace)
end
end
Expand Down

0 comments on commit 560bbef

Please sign in to comment.