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.
Recommended Comments
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now