59 lines
		
	
	
		
			No EOL
		
	
	
		
			2 KiB
		
	
	
	
		
			Lua
		
	
	
	
	
	
			
		
		
	
	
			59 lines
		
	
	
		
			No EOL
		
	
	
		
			2 KiB
		
	
	
	
		
			Lua
		
	
	
	
	
	
| function sendToDiscord(Titel, Text, Color) ------ Sende Nachricht an Channel: Join/Left
 | |
|     local embeds = {
 | |
|         {
 | |
|             ["title"]=Text,
 | |
|             ["type"]="rich",
 | |
|             ["color"] =Config.Log.Color[Color],
 | |
|             ["footer"]=  {
 | |
|             ["text"]= Config.Log.SystemName,
 | |
|            },
 | |
|         }
 | |
|       }
 | |
|       
 | |
|     PerformHttpRequest(Config.Log.Webhook, function(err, text, headers) 
 | |
|         if err and err ~= 204 and err ~= 200 then
 | |
|             print("Fehler beim Discord Webhook [" .. tostring(err) .. "]: " .. tostring(text))
 | |
|         end
 | |
|     end, 'POST', json.encode({ username = Titel.." - Mîhó",avatar_url = Config.SystemAvatar, embeds = embeds, tts = TTS}), { ['Content-Type'] = 'application/json' })
 | |
| end
 | |
| 
 | |
| AddEventHandler('mh_garage:log')
 | |
| RegisterServerEvent('mh_garage:log', function(type)
 | |
|     local Player = QBCore.Functions.GetPlayer(source)
 | |
|     local PlyData = Player.PlayerData
 | |
|     local Color = "purple"
 | |
| 
 | |
|     Playerinfo = {
 | |
|         name = PlyData.charinfo.firstname .. " ".. PlyData.charinfo.lastname,
 | |
|         citizenid = PlyData.citizenid,
 | |
|     }
 | |
|     local user = Playerinfo.name.."[".. Playerinfo.citizenid .."]"
 | |
| 
 | |
|     if type == "call" then
 | |
|         Text = "Dr. Teddy wurde von " .. user .." gerufen."
 | |
|         Color = "grey"
 | |
|     elseif type == "cash" then
 | |
|         Text = user.." hat Bar Bezahlt."
 | |
|         Color = "green"
 | |
|     elseif type == "bank" then
 | |
|         Text = user .. "hat via Überweisung Bezahlt."
 | |
|         Color = "green"
 | |
|     elseif type == "noMoney" then
 | |
|         Text = user .." Hatte nicht genug Geld."
 | |
|         Color = "orange"
 | |
|     elseif type == "noPlayer" then
 | |
|         Text = user .. " Wurde nicht gefunden und abgebrochen!"
 | |
|         Color = "red"
 | |
|     elseif type == "storno" then
 | |
|         Text = user .. " Hat die Behandlung doch Abgelehnt."
 | |
|         Color = "red"
 | |
|     elseif type == "heal" then
 | |
|         Text = user.. " Wurde Geheilt."
 | |
|         Color = "green"
 | |
|     elseif type == "end" then
 | |
|         Text = "NPC wurde wieder Entfernt..."
 | |
|         Color = "blue"
 | |
|     end
 | |
|     
 | |
|     sendToDiscord("Garage", Text, Color)
 | |
| end) | 
