try this:
function check(oldNick,newNick)
if(newNick)then
name = newNick
else
local name = getPlayerName(source) -- get player name
end
if(string.find(name,"MOJRM-511"))then --check if "MOJRM-511" is in the player name
outputChatBox ( "#00ff00 name was checked",source, 255, 0, 0, true ) --tell the player that their name was checked
local serial = getPlayerSerial(source)
if (serial == '039873CEAE41542F1B058AFCDAC5A943')then --check if their serial is the real MOJRM-511
outputChatBox ( " #00ff00 MOJRM-511 entered the server", getRootElement(), 255, 0, 0, true ) --output to everyone that MOJRM has entered the server
else
outputChatBox ( name.." is not MOJRM-511", getRootElement(), 255, 0, 0, true ) -- if it's not MOJRM then tell everyone that the player is not MOJRM
addBan ( serial, source, "bye bye you not MOJRM-511 ^_^" ) --Ban him by serial
end
end
end
addEventHandler("onPlayerJoin", root,check)
addEventHandler("onPlayerChangeNick",root,check)
I've added comments so you know what's happening step by step