@@ -57,23 +57,20 @@ GetPlayerJob = function(Player)
5757end
5858
5959if Config .AdminCommand .enable then
60- for k , group in pairs (Config .AdminCommand .groups ) do
61- ExecuteCommand ((' add_ace group.%s command.%s allow' ):format (group , Config .AdminCommand .command ))
62- end
60+ local allowedGroups = Config .AdminCommand .groups
61+
62+ for i = 1 , # allowedGroups do
63+ ExecuteCommand ((' add_ace group.%s command.%s allow' ):format (allowedGroups [i ], Config .AdminCommand .command ))
64+ end
6365
64- local isAceAllowed = function (source )
65- for k , group in pairs (Config .AdminCommand .groups ) do
66- if IsPlayerAceAllowed (source , (' command.%s' ):format (group )) then
67- return true
68- end
69- end
70- return false
66+ local isAceAllowed = function (playerId , command )
67+ return IsPlayerAceAllowed (playerId , (' command.%s' ):format (command ))
7168 end
7269
7370 RegisterCommand (Config .AdminCommand .command , function (source , args , rawCommand )
7471 local src = source
7572
76- if not isAceAllowed (src ) then
73+ if not isAceAllowed (src , Config . AdminCommand . command ) then
7774 return Config .Notification (src , ' You don\' t have permission to do that!' , ' error' )
7875 end
7976
@@ -86,12 +83,12 @@ RegisterNetEvent('msk_enginetoggle:addTempKey', function(plate)
8683 local playerId = source
8784 plate = tostring (plate )
8885
89- if Config .VehicleKeys .script == ' VehicleKeyChain' then
90- exports [" VehicleKeyChain" ]:AddTempKey (playerId , plate )
91- elseif Config .VehicleKeys .script == ' vehicle_keys' then
92- exports [" vehicle_keys" ]:giveVehicleKeysToPlayerId (playerId , plate , ' temporary' )
93- elseif Config .VehicleKeys .script == ' msk_vehiclekeys' then
86+ if Config .VehicleKeys .script == ' msk_vehiclekeys' then
9487 exports [" msk_vehiclekeys" ]:AddKey ({source = playerId }, plate , ' temporary' )
88+ elseif Config .VehicleKeys .script == ' VehicleKeyChain' then
89+ exports [" VehicleKeyChain" ]:AddTempKey (playerId , plate )
90+ elseif Config .VehicleKeys .script == ' vehicles_keys' then
91+ exports [" vehicles_keys" ]:giveVehicleKeysToPlayerId (playerId , plate , ' temporary' )
9592 elseif Config .VehicleKeys .script == ' okokGarage' then
9693 TriggerEvent (" okokGarage:GiveKeys" , plate , playerId )
9794 else
@@ -114,7 +111,7 @@ RegisterNetEvent('msk_enginetoggle:enteredVehicle', function(plate, seat, netId,
114111
115112 local result = MySQL .query .await ((' SELECT * FROM %s WHERE %s = @owner AND plate = @plate' ):format (VEHICLE_TABLE_NAME , OWNER_COLUMN_NAME ), {
116113 [' @owner' ] = identifier ,
117- [' @plate' ] = MSK .Trim (plate , true )
114+ [' @plate' ] = MSK .String . Trim (plate )
118115 })
119116
120117 if result and result [1 ] then
0 commit comments