-- MercyV Discord Link -- Speichert die Discord ID automatisch beim Charakter-Login -- Discord ID aus Player Identifiers holen local function GetDiscordId(source) for _, id in ipairs(GetPlayerIdentifiers(source)) do if string.match(id, "discord:") then return string.gsub(id, "discord:", "") end end return nil end -- Bei ESX Player Load die Discord ID speichern AddEventHandler('esx:playerLoaded', function(playerId, xPlayer) local discordId = GetDiscordId(playerId) if discordId and xPlayer then MySQL.update('UPDATE users SET discord = ? WHERE identifier = ?', { discordId, xPlayer.identifier }, function(rowsChanged) if rowsChanged > 0 then print(('[^2MercyV^7] Discord ID gespeichert: ^5%s^7 -> ^3%s^7'):format(xPlayer.identifier, discordId)) end end) else print(('[^3MercyV^7] Keine Discord ID gefunden für Player %s - Discord muss mit FiveM verknüpft sein'):format(playerId)) end end) print('[^2MercyV^7] Discord Link Resource geladen')