Advertisement
Guest User

Untitled

a guest
Sep 8th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.08 KB | None | 0 0
  1. function registerValidation(username, password, passwordConfirm, email)
  2. if not username or username == "" or not password or password == "" or not passwordConfirm or passwordConfirm == "" or not email or email == "" then
  3. guiSetText(lbl_reg_top_info, "Необходимо указать все поля.")
  4. guiLabelSetColor ( lbl_reg_top_info, 255, 0, 0 )
  5. playSoundFrontEnd ( 4 )
  6. elseif string.len(username) < 3 then
  7. guiSetText(lbl_reg_top_info, "Ваш логин должен имеет менее 3х символов.")
  8. guiLabelSetColor ( lbl_reg_top_info, 255, 0, 0 )
  9. playSoundFrontEnd ( 4 )
  10. elseif string.len(username) >= 15 then
  11. guiSetText(lbl_reg_top_info, "Ваш логин должен имеет более 20 символов.")
  12. guiLabelSetColor ( lbl_reg_top_info, 255, 0, 0 )
  13. playSoundFrontEnd ( 4 )
  14. elseif string.find(password, "'") or string.find(password, '"') then
  15. guiSetText(lbl_reg_top_info, "Пароль не совпадает ' or "..'"')
  16. guiLabelSetColor ( lbl_reg_top_info, 255, 0, 0 )
  17. playSoundFrontEnd ( 4 )
  18. elseif string.len(password) < 6 then
  19. guiSetText(lbl_reg_top_info, "Пароль должен иметь более 6 символов")
  20. guiLabelSetColor ( lbl_reg_top_info, 255, 0, 0 )
  21. playSoundFrontEnd ( 4 )
  22. elseif password ~= passwordConfirm then
  23. guiSetText(lbl_reg_top_info, "Пароли не совпадают")
  24. guiLabelSetColor ( lbl_reg_top_info, 255, 0, 0 )
  25. playSoundFrontEnd ( 4 )
  26. elseif string.match(username,"%W") then
  27. guiSetText(lbl_reg_top_info, "В логине разрешены только буквы и цифры.")
  28. guiLabelSetColor ( lbl_reg_top_info, 255, 0, 0 )
  29. playSoundFrontEnd ( 4 )
  30. else
  31. local validEmail, reason = exports.global:isEmail(email)
  32. if not validEmail then
  33. guiSetText(lbl_reg_top_info, reason)
  34. guiLabelSetColor ( lbl_reg_top_info, 255, 0, 0 )
  35. playSoundFrontEnd ( 4 )
  36. else
  37. triggerServerEvent("accounts:register:attempt",getLocalPlayer(),username,password,passwordConfirm, email)
  38. authen_msg("Register", "Sending request to server.")
  39. end
  40. end
  41. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement