Main/resources/[test]/Duck_Alk.test/server.lua

24 lines
819 B
Lua
Raw Permalink Normal View History

2025-06-07 08:51:21 +02:00
local QBCore = exports['qb-core']:GetCoreObject()
RegisterCommand("alk", function(source, args)
local src = source
local targetId = tonumber(args[1])
local effectDuration = tonumber(args[2]) or 30 -- Dauer in Sekunden
if not targetId then
TriggerClientEvent('QBCore:Notify', src, "Ung<EFBFBD>ltige ID!", "error")
return
end
local target = QBCore.Functions.GetPlayer(targetId)
if not target then
TriggerClientEvent('QBCore:Notify', src, "Spieler nicht gefunden!", "error")
return
end
local alcoholLevel = math.random(0, 30) / 10
TriggerClientEvent("alk:showResult", src, target.PlayerData.charinfo.firstname, alcoholLevel)
TriggerClientEvent("alk:notifyTarget", target.PlayerData.source, alcoholLevel, effectDuration)
end)