-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v.1.0.2: Add the ability to configure admins and disable the check fo…
…r them
- Loading branch information
Showing
2 changed files
with
37 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
local ace_perm = "admin" | ||
local debug = false | ||
|
||
function ProcessAces() | ||
if GetNumPlayerIndices() > 0 then -- don't do it when there aren't any players | ||
for i=0, GetNumPlayerIndices()-1 do -- loop through all players | ||
player = tonumber(GetPlayerFromIndex(i)) | ||
Citizen.Wait(0) | ||
if IsPlayerAceAllowed(player, ace_perm) then | ||
TriggerClientEvent("sendAcePermissionToClient", player, true) | ||
if debug then print("[DEBUG][" .. GetCurrentResourceName() .. "] ^5Syncronising player aces, sending to client...^0") end | ||
end | ||
end | ||
end | ||
end | ||
|
||
Citizen.CreateThread(function() | ||
while true do | ||
ProcessAces() | ||
Citizen.Wait(60000) -- lets check every minute | ||
end | ||
end) | ||
|
||
AddEventHandler("onResourceStart", function(name) | ||
if name == GetCurrentResourceName() then | ||
ProcessAces() | ||
if debug then print("[DEBUG][" .. GetCurrentResourceName() .. "] ^6Resource [ " .. GetCurrentResourceName() .. " ] was (re)started, syncing aces to all players.^0") end | ||
end | ||
end) |