This commit is contained in:
Nordi98 2025-06-12 22:57:17 +02:00
commit e4af606e9c

View file

@ -1,5 +1,11 @@
QBCore = nil
TriggerEvent('QBCore:GetObject', function(obj) QBCore = obj end)
local QBCore = nil
CreateThread(function()
while QBCore == nil do
TriggerEvent('QBCore:GetObject', function(obj) QBCore = obj end)
Wait(200)
end
end)
local function DiscordNachricht()
if Config.DiscordWebhook == "" then return end
@ -10,16 +16,26 @@ local function DiscordNachricht()
end
RegisterCommand('wartung', function(source)
while not QBCore do
Wait(100)
end
local src = source
local Player = QBCore.Functions.GetPlayer(src)
if not Player or not QBCore.Functions.HasPermission(src, Config.ErlaubteRolle) then
if not Player then
print(("^1Error: Player not found (source: %s)^7"):format(src))
return
end
if not QBCore.Functions.HasPermission(src, Config.ErlaubteRolle) then
TriggerClientEvent('QBCore:Notify', src, 'Keine Berechtigung!', 'error')
return
end
for _, v in pairs(QBCore.Functions.GetPlayers()) do
for k, v in pairs(QBCore.Functions.GetPlayers()) do
TriggerClientEvent('QBCore:Notify', v, 'Wartungsarbeiten beginnen!', 'error')
end
@ -27,4 +43,5 @@ RegisterCommand('wartung', function(source)
DiscordNachricht()
TriggerClientEvent('QBCore:Notify', src, 'Wartung angekündigt!', 'success')
print(("^5[Wartung]^7 Wartung wurde von %s gestartet"):format(GetPlayerName(src)))
end, false)