Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function login(source,cmd,username,password)
- if not username then -- Check if they've not entered a username
- outputChatBox("login: Please specify a username and password",source,255,168,0)
- return false
- end
- if not password then -- If they haven't specified a password, presume they're using '/login [password]'
- password = username
- username = getPlayerName(source)
- end
- if isGuestAccount(getPlayerAccount(source)) then -- They aren't logged in.
- local account = getAccount(username,password) -- Parse the account
- if account then
- logIn(source,account,password) -- Attempt to login
- else -- They entered incorrect credentials.
- outputChatBox("login: Invalid credentials",source,255,168,0)
- end
- else -- They're logged in.
- outputChatBox("login: You are already logged in",source,255,168,0)
- end
- end
- addCommandHandler("login",login,false,false)
Add Comment
Please, Sign In to add comment