I have a client script for safezone but I want to make sure that people with a different group than user do not get it, just as you see on the code at Police has succeeded. Now the problem is that I have searched all over the internet and I really can’t figure out how I get the group from the person who has it. Because if I have the group of the player then I can just say if getgroup ~='user' then I need something like that can someone help me! Thanks a lot in advance!
Citizen.CreateThread(function()
while not NetworkIsPlayerActive(PlayerId()) do
Citizen.Wait(0)
end
while true do
Citizen.Wait(0)
local player = GetPlayerPed(-1)
local x,y,z = table.unpack(GetEntityCoords(player, true))
local dist = Vdist(zones[closestZone].x, zones[closestZone].y, zones[closestZone].z, x, y, z)
if ESX.PlayerData.job and ESX.PlayerData.job.name ~= 'police' then
if dist <= 50.0 then
if not notifIn then
NetworkSetFriendlyFireOption(false)
ClearPlayerWantedLevel(PlayerId())
SetCurrentPedWeapon(player,GetHashKey("WEAPON_UNARMED"),true)
TriggerEvent("pNotify:SendNotification",{
text = "<b style='color:#1E90FF'>Je bent in een veilige zone!</b>",
type = "success",
timeout = (3000),
layout = "bottomcenter",
queue = "global"
})
notifIn = true
notifOut = false
end
else
if not notifOut then
NetworkSetFriendlyFireOption(true)
TriggerEvent("pNotify:SendNotification",{
text = "<b style='color:#1E90FF'>U bent niet meer in een veilige zone!</b>",
type = "error",
timeout = (3000),
layout = "bottomcenter",
queue = "global"
})
notifOut = true
notifIn = false
end
end
if notifIn then
DisableControlAction(2, 37, true)
DisablePlayerFiring(player,true)
DisableControlAction(0, 106, true)
if IsDisabledControlJustPressed(2, 37) then
SetCurrentPedWeapon(player,GetHashKey("WEAPON_UNARMED"),true)
TriggerEvent("pNotify:SendNotification",{
text = "<b style='color:#1E90FF'>Je kan geen wapens in een veilige zone gebruiken!</b>",
type = "error",
timeout = (3000),
layout = "bottomcenter",
queue = "global"
})
end
if IsDisabledControlJustPressed(0, 106) then
SetCurrentPedWeapon(player,GetHashKey("WEAPON_UNARMED"),true)
TriggerEvent("pNotify:SendNotification",{
text = "<b style='color:#1E90FF'>Je kan dat niet doen in een veilige zone!</b>",
type = "error",
timeout = (3000),
layout = "bottomcenter",
queue = "global"
})
end
end
end
end
end)