23 lines
		
	
	
	
		
			819 B
		
	
	
	
		
			Lua
		
	
	
	
	
	
			
		
		
	
	
			23 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ü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)
 | 
