forked from Simnation/Main
24 lines
819 B
Lua
24 lines
819 B
Lua
![]() |
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)
|