So I´m new to the scripting-community and a pretty bloody newborn with scripting / programming per se.
I can read more, than I can write and understand or connect things in my mind, but in many cases, learned knowledge, which I´m missing, is king - which leads me here
In my case, I want the script to query a type (or more) groups (admin, mod)
I tried to replace “job” with “group”, “police” with “admin” and so on, but that didn´t work as easy, as I imagined.
Would be thankfull for tipps!
Thanks in Advance
CLIENT:
local notified = false
for _, position in ipairs(Config.Position) do
exports.ox_target:addBoxZone({
coords = position.position,
size = vec3(2, 2, 2),
rotation = 45,
debug = drawZones,
options = {
{
name = ‘box’,
icon = ‘fa-solid fa-bell’,
label = ‘Klingeln’,
onSelect = function(job)
if not notified then
TriggerServerEvent(“cmdJobbell:notify”, position.job)
notified = true
Citizen.SetTimeout(60000, function()
notified = false
end)
else
ESX.ShowNotification(“Du kannst erst wieder in einer Minute die Klingel betätigen”)
end
end
}
}
})
end
CONFIG:
Config = {
Position = {
{
position = vector3(-1093.8199, -2811.5801, 26.1144),
job = “police”,
helpNotification = “Es wartet jemand bei der Einreise”,
},
{
position = vector3(440.29974365234, -984.40850830078, 30.724325180054),
job = “police”,
helpNotification = “Es wartet jemand bei der Einreise”,
},
},
}
FUNCTIONS:
ShowHelpNotification = function(text)
AddTextEntry(“HelpNotification”, text)
DisplayHelpTextThisFrame(“HelpNotification”, false)
end
SERVER:
RegisterNetEvent(“cmdJobbell:notify”)
AddEventHandler(“cmdJobbell:notify”, function(job)
local source = source
local xPlayer = ESX.GetPlayerFromId(source)
local isJob = false
for k, playerId in pairs(GetPlayers()) do
local tPlayer = ESX.GetPlayerFromId(playerId)
if tPlayer.job.name == job then
for _, position in ipairs(Config.Position) do
if position.job == job then
tPlayer.showNotification(position.helpNotification)
xPlayer.showNotification('Du hast die Klingel aktiviert')
isJob = true
break
end
end
end
end
if not isJob then
xPlayer.showNotification('Es sind keine Mitarbeiter verfügbar')
end
end)