From ee09c81d3701983312b65b360bbf1b44248ae3c2 Mon Sep 17 00:00:00 2001 From: Miho931 <98314142+Miho931@users.noreply.github.com> Date: Sun, 8 Jun 2025 15:19:18 +0200 Subject: [PATCH] [Garage] Changes + Log --- .../[carscripts]/mh_garage/client/debug.lua | 5 ++ .../[carscripts]/mh_garage/client/main.lua | 6 +- resources/[carscripts]/mh_garage/config.lua | 4 +- .../[carscripts]/mh_garage/server/log.lua | 59 +++++++++++++++++++ 4 files changed, 68 insertions(+), 6 deletions(-) create mode 100644 resources/[carscripts]/mh_garage/client/debug.lua create mode 100644 resources/[carscripts]/mh_garage/server/log.lua diff --git a/resources/[carscripts]/mh_garage/client/debug.lua b/resources/[carscripts]/mh_garage/client/debug.lua new file mode 100644 index 000000000..b64d9f7e9 --- /dev/null +++ b/resources/[carscripts]/mh_garage/client/debug.lua @@ -0,0 +1,5 @@ +function Debug(text) + if Config.Debug then + print(text) + end +end \ No newline at end of file diff --git a/resources/[carscripts]/mh_garage/client/main.lua b/resources/[carscripts]/mh_garage/client/main.lua index 9de283b79..829223dbc 100644 --- a/resources/[carscripts]/mh_garage/client/main.lua +++ b/resources/[carscripts]/mh_garage/client/main.lua @@ -84,15 +84,13 @@ function AddTargetOptions() type = "client", event = "garage:storeVehicle", icon = "fas fa-parking", - label = "Fahrzeug einparken", - canInteract = true + label = "Fahrzeug einparken" }, { type = "client", event = "garage:retrieveVehicle", icon = "fas fa-car", - label = "Fahrzeug ausparken", - canInteract = true + label = "Fahrzeug ausparken" } }, distance = 2.5 diff --git a/resources/[carscripts]/mh_garage/config.lua b/resources/[carscripts]/mh_garage/config.lua index 2a4616630..2df0cdf11 100644 --- a/resources/[carscripts]/mh_garage/config.lua +++ b/resources/[carscripts]/mh_garage/config.lua @@ -6,7 +6,7 @@ Config.Zonen = { name = "Meetingpoint", price = nil, --pro FZ NPC = { - spawn = vector4(236.1599, -798.8522, 30.3653, 181.7547), + spawn = vector4(236.1599, -798.8522, 29.3653, 181.7547), model = "s_m_m_security_01", distance = 30.0 }, @@ -30,7 +30,7 @@ Config.Log = { purple = 11750815, }, - SystemName = "Evolution_State_life Log [Dr. Teddy]", + SystemName = "Evolution_State_life Log [Garage]", UserAvatar = '', SystemAvatar = '', } \ No newline at end of file diff --git a/resources/[carscripts]/mh_garage/server/log.lua b/resources/[carscripts]/mh_garage/server/log.lua new file mode 100644 index 000000000..177bbd5d2 --- /dev/null +++ b/resources/[carscripts]/mh_garage/server/log.lua @@ -0,0 +1,59 @@ +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) \ No newline at end of file