Wichtige Funktionen und Variablen
In diesem Abschnitt werden die wichtigsten vom Script verwendeten oder bereitgestellten Funktionen und Variablen erläutert.
Das Verständnis dieser Elemente hilft Ihnen, das Script anzupassen oder in andere Ressourcen zu integrieren.
Hauptfunktionen
Abschnitt mit dem Titel „Hauptfunktionen“Benachrichtigungen: Ein Benachrichtigungssystem hinzufügen
Abschnitt mit dem Titel „Benachrichtigungen: Ein Benachrichtigungssystem hinzufügen“Notify = function(msg) if Config.Debug then print("[DEBUG] Notify", msg) end
local duration = 2000 -- 2 seconds
if Config.Notify == "default" then defaultNotify(msg) elseif Config.Notify == "mythic_notify" then exports['mythic_notify']:DoHudText('inform', msg) elseif Config.Notify == "k5_notify" then exports["k5_notify"]:notify("", msg, 'info', duration) elseif Config.Notify == "FL-Notify" then exports['FL-Notify']:Notify("", "", msg, duration, 3) elseif Config.Notify == "dillen-notifications" then exports['dillen-notifications']:sendNotification({ message = msg, type = "info", duration = duration }) elseif Config.Notify == "noxen_notify" then TriggerEvent("noxen:notify", "", msg, "info", duration) elseif Config.Notify == "wasabi_notify" then exports['wasabi_notify']:notify('', msg, duration, 'info') elseif Config.Notify == "custom" then -- Custom notify
endend
Dieser Code dient dazu, Benachrichtigungen für verschiedene Benachrichtigungsskripte anzuzeigen. Wenn Sie ein anderes Benachrichtigungsskript verwenden, fügen Sie es bitte im Bereich “custom” hinzu oder erweitern Sie die elseif-Struktur. (Vergessen Sie nicht, die notwendigen Elemente im Konfigurationsbereich Config.Notify
(config.lua) einzutragen).
Sound: Ein Soundsystem hinzufügen
Abschnitt mit dem Titel „Sound: Ein Soundsystem hinzufügen“PlaySound = function(ped) if not Config.SoundSystem or not Config.Sound then return end local coords = GetEntityCoords(ped) if Config.Debug then print("[DEBUG] PlaySound", ped, coords, Config.SoundSystem, Config.Sound.url) end
if Config.SoundSystem == "xsound" then exports["xsound"]:PlayUrlPos("electric_brass_knuckles", Config.Sound.url, Config.Sound.volume or 0.1, coords, false) elseif Config.SoundSystem == "interact_sound" then TriggerEvent('InteractSound_CL:PlayOnOne', Config.Sound.url, Config.Sound.volume or 0.1) elseif Config.SoundSystem == "evo_sound" then exports["evo_sound"]:PlayUrlPos("electric_brass_knuckles", Config.Sound.url, Config.Sound.volume or 0.1, coords, false) elseif Config.SoundSystem == "custom" then -- Custom sound system
endend
Dieser Code dient dazu, einen Sound mit dem auf Ihrem Server vorhandenen Soundsystem abzuspielen. Wenn Sie ein anderes Soundsystem verwenden, fügen Sie es bitte im Bereich “custom” hinzu oder erweitern Sie die elseif-Struktur. (Vergessen Sie nicht, die notwendigen Elemente im Konfigurationsbereich Config.SoundSystem
(config.lua) einzutragen).