RegisterCommand('admin.onduty', function(source, args, rawCommand)
if source == 0 or IsPlayerAceAllowed(source, "admin.onduty") then
admin = not admin
local str = nil
if admin then
ExecuteCommand('ToggleAdminMenu')
str = "^2 Staff On-Duty"
else
ExecuteCommand('UnToggleAdminMenu')
str = "^1 Off-Duty Staff"
end
TriggerEvent('chatMessage', "^1[SYSTEM]:^0 You're Now"..str.."^0.")
else
TriggerEvent("chatMessage", "", {255,255,255}, "^1You're Not Authorised To Use This Command!")
end
end, true)
But for some reason i have removed my permissions for this command in my server.cfg but the server still thinks i have permission for the command.
I could be wrong here, as I’m not too familiar with Ace, but I don’t believe you need the true in your RegisterCommand(), andIsPlayerAceAllowed(), as you’re running the same check twice, which is kinda pointless.
As for your issue, have you restarted the server? Because I believe once you execute an Ace permission, unless you deny it, it stays for the rest of the session.
Yeah i have tried restarting the server as well, no success.
I had added end, true) to see if i needed to add that for it to work which had not worked.
I’ve now removed the end, true) since i’m running the if source == 0 or blah blah, i’m kinda confused on why it wouldn’t be fetching the permissions, it’s running the script as if no permissions are needed to run the command
RegisterCommand('admin.onduty', function(source, args, rawCommand)
if isAdmin then
admin = not admin
local str = nil
if admin then
ExecuteCommand('ToggleAdminMenu')
str = "^2 Staff On-Duty"
else
ExecuteCommand('UnToggleAdminMenu')
str = "^1 Off-Duty Staff"
end
TriggerEvent('chatMessage', "^1[SYSTEM]:^0 You're Now"..str.."^0.")
else
TriggerEvent("chatMessage", "", {255,255,255}, "^1You're Not Authorised To Use This Command!")
end
end)
Now and have it running the checks in client.lua and server.lua.
Didn’t work for me, bloody ACE perms, i’m going to try to stick to ACE Perms so i don’t have a thousand scripts for different commands, however thank you anyway sir.
-- Admin Menu Stuff
RegisterCommand('admin.onduty', function(source, args, rawCommand)
if allowedToUse2 then
admin = not admin
local str = nil
if admin then
ExecuteCommand('ToggleAdminMenu')
str = "^2 Staff On-Duty"
else
ExecuteCommand('UnToggleAdminMenu')
str = "^1 Off-Duty Staff"
end
TriggerEvent('chatMessage', "^1[SYSTEM]:^0 You're Now"..str.."^0.")
else
TriggerEvent("chatMessage", "", {255,255,255}, "^1You're Not Authorised To Use This Command!")
end
end)
I guess it’s FiveM for ya. works sometimes then doesn’t.