Aller au contenu

Fonctions et variables importantes

Cette section détaille les principales fonctions et variables utilisées ou exposées par le script.
Comprendre ces éléments vous aidera à personnaliser ou à intégrer le script à d’autres ressources.

Les notifications : Ajouter un système de notifications

Section intitulée « Les notifications : Ajouter un système de notifications »
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
end
end

Ce code est généré pour afficher les notifications pour les différents scripts de notification. Si vous avez un autre script pour les notifications, veuillez l’ajouter soit dans la partie custom, soit en ajoutant un elseif. (N’oubliez pas d’ajouter les éléments nécessaires dans le fichier de configuration partie Config.Notify (config.lua)).


PlaySound = function(url)
if not Config.SoundSystem or not Config.Sound or not url then return end
if Config.Debug then print("[DEBUG] PlaySound", ped, Config.SoundSystem, url) end
if Config.SoundSystem == "xsound" then
exports["xsound"]:PlayUrl("mini_tazer", url, Config.Sound.volume or 0.1, false)
elseif Config.SoundSystem == "interact_sound" then
TriggerEvent('InteractSound_CL:PlayOnOne', url, Config.Sound.volume or 0.1)
elseif Config.SoundSystem == "evo_sound" then
exports["evo_sound"]:PlayUrl("mini_tazer", url, Config.Sound.volume or 0.1, false)
elseif Config.SoundSystem == "custom" then -- Custom sound system
end
end

Ce code est généré pour jouer un son avec le son système que vous avez sur votre serveur. Si vous avez un autre script pour le son, veuillez l’ajouter soit dans la partie custom, soit en ajoutant un elseif. (N’oubliez pas d’ajouter les éléments nécessaires dans le fichier de configuration partie Config.SoundSystem (config.lua)).