[HELP] Ace permission for group (Cops-FiveM)

Hello, I don’t know too much about scripting, I tried to do it myself and it wont work. The resource is Cops-FiveM and it can be used standalone or esx. I am doing standalone and want to restrict the clock in for a LEO group. If you are leo then you can clock in. if you are not leo you can not clock in. If someone know how to do it, that would be great.

I dont need the whole whitelist and database. I did add a gasmask script to it and it works without error

Server Side
server.lua (15.3 KB)

Client Side
client.lua (29.0 KB)
cloackroom.lua (6.2 KB)
i18n.lua (649 Bytes)
menu.lua (17.4 KB)
armory.lua (5.2 KB)

Ok, I think this might work for you. I haven’t tested it but this should do what you want.

In client.lua, remove/comment this section

if(config.useCopWhitelist == true) then
	isCop = false
else
	isCop = true
end

and replace it with:

Citizen.CreateThread(function()
	TriggerServerEvent("CheckCopPerms")
end)

RegisterNetEvent("isAllowed")
AddEventHandler("isAllowed", function(allowed)
	isCop = allowed
end)

Then in server.lua, add this to the top:

ReigsterServerEvent("CheckCopPerms")
AddEventHandler("CheckCopPerms", function()
	if IsPlayerAceAllowed(source, "clockin") then
		TriggerClientEvent("isAllowed", source, true)
	else
		TriggerClientEvent("isAllowed", source, false)
	end
end)

Then don’t forget to add the ace perm “clockin” to your server.cfg for example:

add_ace group.leo clockin allow 

Replace group.leo with whatever group you have for people who should be allowed to clock in.

Hope that helps!

alright, ima test it out and make sure it works

this is what happened

[ citizen-server-impl] Stopping resource police
[ c-scripting-core] Creating script environments for police
[ script:police] Error loading script server/server.lua in resource police: @police/server/server.lua:17: attempt to call a nil value (global ‘ReigsterServerEvent’)
[ script:police] stack traceback:
[ script:police] @police/server/server.lua:17: in main chunk
[ c-scripting-core] Failed to load script server/server.lua.
[ citizen-server-impl] Started resource police

now there is a config for the config.useCopWhitelist

Yeah, looks like I made a typo in the code. Go to line 17 in server.lua and spell Register in RegisterServerEvent properly, and give it a go.

so does that mean we don’t need ghmattimysql?

ghmattimysql is for the esx portion or data base. you arent using that

is this working? because I am trying to do it and it is not working

this isnt a finished version as we continued it on my server. I have a copy of it with baitcar, speedzone, gas mask, and ace perms. I just gotta upload it to github

1 Like

this is an edit version of mine with ace permission

2 Likes