Adding Permission to Scripts

Hi there,

I have a question for you.
How do i add permission level to scripts ?

E.g. If user’s perm lv. is 1 user can’t use /cuff if user’s lv. is 2, user can use /cuff command.

1 Like

I need to

but nobody respond …

Hello,

Here is an exemple from Police Garage (not made by me), if it can help.
EssentialMode is needed !

Client:
if IsControlJustPressed(1,201) then

    TriggerServerEvent("cp:spawncheck")
	

	    end

Server:
RegisterServerEvent(‘cp:spawncheck’)
AddEventHandler(‘cp:spawncheck’, function()

TriggerEvent(‘es:getPlayerFromId’, source, function(user)

local player = user.identifier

if user.permission_level == (2) then

TriggerClientEvent(‘policespawn’, source)

TriggerClientEvent(‘worked’, source)

else

TriggerClientEvent(‘notworked’, source)

end
end)
end)

1 Like

I will try this. Thank you.

what about if detects player ped like s_m_y_cop then can use police garage? would that be possible?

Create a new post, this post is not for your problem ^^

was just asking a question it’s no big deal buddy. plus the person already provided a solution for you.

no the problem is not fixed ^^

Yes, i didn’t try it yet

i have try it, is not work ^^ for me

1 Like

If you found the solution. Please notice me senpai!

1 Like