Advertisement
Guest User

Untitled

a guest
Aug 12th, 2017
376
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.06 KB | None | 0 0
  1. addCommandHandler ( "register", function ( player, command, arg1, arg2 )
  2.     local username = getPlayerName ( player )
  3.     local password = arg1
  4.     if ( arg2 ) then
  5.         username = arg1
  6.         password = arg2
  7.     end
  8.     if ( password ~= nil ) then
  9.         if ( string.len ( password ) < 4 ) then
  10.             outputChatBox ( "register: - Password should be at least 4 characters long", player, 255, 100, 70 )
  11.         elseif ( addAccount ( username, password ) ) then
  12.             outputChatBox ( "You have successfully registered! Username: '"..username.."', Password: '"..password.."'(Remember it)", player, 255, 100, 70 )
  13.             outputServerLog ( "ADMIN: "..getPlayerName ( player ).." registered account '"..username.."' (IP: "..getPlayerIP(player).."  Serial: "..getPlayerSerial(player)..")" )
  14.         elseif ( getAccount ( username ) ) then
  15.             outputChatBox ( "register: - Account with this name already exists.", player, 255, 100, 70 )
  16.         else
  17.             outputChatBox ( "Unknown Error", player, 255, 100, 70 )
  18.         end
  19.     else
  20.         outputChatBox ( "register: - Syntax is 'register [<nick>] <password>'", player, 255, 100, 70 )
  21.     end
  22. end )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement