Hello,
so here I tired to create command (taken from SkAdmin) godmode and everyone have permision to command.
Here is code from server.lua
ESX = nil
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
RegisterCommand("godmode", function(source, args, rawCommand)
local xPlayer = ESX.GetPlayerFromId(source)
local target = ESX.GetPlayerFromId(args[1])
if playerRank =="superadmin" or "moderator" then
TriggerClientEvent("skadmin:toggleGodmode", xPlayer.source)
else
TriggerClientEvent('chatMessage', source, 'UNITY ', {0, 128, 255 }, 'Nemate permisiju da koristite ovu komandu!')
end
end)
and here is client.lua
RegisterNetEvent("skadmin:toggleGodmode")
AddEventHandler("skadmin:toggleGodmode", function()
godmode = not godmode
SetEntityInvincible(GetPlayerPed(-1), godmode)
if godmode then
exports.pNotify:SendNotification({text = "Godmode ukljucen!", type = "success", timeout = 2000, layout = "center", queue = "right"})
else
exports.pNotify:SendNotification({text = "Godmode isključen!", type = "error", timeout = 2000, layout = "center", queue = "right"})
end
end)
so problem is everyone can use command and I want only modrator and supermoderator to have permission