Forums WoW Modding Tutorials Serverside [Archive] Script to Announce Logins and Logouts for Eluna

[Archive] Script to Announce Logins and Logouts for Eluna

[Archive] Script to Announce Logins and Logouts for Eluna

rektbyfaith
Administrator
0
11-03-2025, 12:01 PM
#1
Because so many people have requested a script to announce logins and logouts over the years, and due to a lack of simple scripts that I could find, I’ve written up a very simple script that announces whenever a player logs on or off. I’ll assume that anyone looking at this already knows how to add a Lua script to their server, so here’s the script.

local function OnEnterWorld(event, player)
local isHorde = player:IsHorde()
local playerName = player:GetName()

if(player:IsGM()) then
SendWorldMessage("|Hplayer:" .. playerName .. ":1:WHISPER:" .. string.upper(playerName) .. "|h[" .. playerName .. " - GM]|h has logged in.")
elseif(isHorde == true) then
SendWorldMessage("|Hplayer:" .. playerName .. ":1:WHISPER:" .. string.upper(playerName) .. "|h[" .. playerName .. " - Horde]|h has logged in.")
elseif(isHorde == false) then
SendWorldMessage("|Hplayer:" .. playerName .. ":1:WHISPER:" .. string.upper(playerName) .. "|h[" .. playerName .. " - Alliance]|h has logged in.")
end
end

local function OnExitWorld(event, player)
local isHorde = player:IsHorde()
local playerName = player:GetName()

if(player:IsGM()) then
SendWorldMessage("[" .. playerName .. " - GM] has logged out." )
elseif(isHorde == true) then
SendWorldMessage("[" .. playerName .. " - Horde] has logged out." )
elseif(isHorde == false) then
SendWorldMessage("[" .. playerName .. " - Alliance] has logged out." )
end
end

RegisterPlayerEvent(3, OnEnterWorld)
RegisterPlayerEvent(4, OnExitWorld)There is definitely some room for improvement on the script, so if you have any suggestions, just leave a comment below.
rektbyfaith
11-03-2025, 12:01 PM #1

Because so many people have requested a script to announce logins and logouts over the years, and due to a lack of simple scripts that I could find, I’ve written up a very simple script that announces whenever a player logs on or off. I’ll assume that anyone looking at this already knows how to add a Lua script to their server, so here’s the script.

local function OnEnterWorld(event, player)
local isHorde = player:IsHorde()
local playerName = player:GetName()

if(player:IsGM()) then
SendWorldMessage("|Hplayer:" .. playerName .. ":1:WHISPER:" .. string.upper(playerName) .. "|h[" .. playerName .. " - GM]|h has logged in.")
elseif(isHorde == true) then
SendWorldMessage("|Hplayer:" .. playerName .. ":1:WHISPER:" .. string.upper(playerName) .. "|h[" .. playerName .. " - Horde]|h has logged in.")
elseif(isHorde == false) then
SendWorldMessage("|Hplayer:" .. playerName .. ":1:WHISPER:" .. string.upper(playerName) .. "|h[" .. playerName .. " - Alliance]|h has logged in.")
end
end

local function OnExitWorld(event, player)
local isHorde = player:IsHorde()
local playerName = player:GetName()

if(player:IsGM()) then
SendWorldMessage("[" .. playerName .. " - GM] has logged out." )
elseif(isHorde == true) then
SendWorldMessage("[" .. playerName .. " - Horde] has logged out." )
elseif(isHorde == false) then
SendWorldMessage("[" .. playerName .. " - Alliance] has logged out." )
end
end

RegisterPlayerEvent(3, OnEnterWorld)
RegisterPlayerEvent(4, OnExitWorld)There is definitely some room for improvement on the script, so if you have any suggestions, just leave a comment below.

Recently Browsing
 1 Guest(s)
Recently Browsing
 1 Guest(s)