Guest User

Untitled

a guest
Dec 5th, 2015
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. function clientWantToCheckHisState()
  2. local account = getPlayerAccount(source)
  3. if isGuestAccount(account) then
  4. local colorCode = get("*race.color") or "#00aaff"
  5. triggerClientEvent(source,"onServerWantIniteteLoginPanel",getRootElement(),colorCode)
  6. end
  7. end
  8. addEvent("onClientWantCheckHisState",true)
  9. addEventHandler("onClientWantCheckHisState",getRootElement(),clientWantToCheckHisState)
  10.  
  11. function tryToLogInAsClient(theLogin,thePassword)
  12. if theLogin and thePassword then
  13. local account = getAccount(theLogin,thePassword)
  14. if account then
  15. logIn(source,account,thePassword)
  16. displayServerMessage(source,"Pomyślnie zalogowano!")
  17. triggerClientEvent(source,"onClientSuccessfullyLogIn",getRootElement())
  18. else
  19. displayServerMessage(source,"Nieprawidłowy login lub hasło!","warning")
  20. end
  21. end
  22. end
  23. addEvent("onClientWantToLogIn",true)
  24. addEventHandler("onClientWantToLogIn",getRootElement(),tryToLogInAsClient)
  25.  
  26.  
  27. function tryToRegister(theLogin,thePassword)
  28. if theLogin and thePassword then
  29. if not getAccount(theLogin) then
  30. local newAccount = addAccount(theLogin,thePassword)
  31. if newAccount then
  32. displayServerMessage(source,"Pomyślnie stworzyłeś konto! Możesz się zalogować!")
  33. triggerClientEvent(source,"onClientSuccessfullyRegisterNewAccount",getRootElement())
  34. else
  35. displayServerMessage(source,"Błąd podczas tworzenia konta. Spróbuj ponownie później.","warning")
  36. end
  37. else
  38. displayServerMessage(source,"Konto z tą nazwą użytkownika już istnieje!","warning")
  39. end
  40. end
  41. end
  42. addEvent("onClientWantToRegister",true)
  43. addEventHandler("onClientWantToRegister",getRootElement(),tryToRegister)
  44.  
  45.  
  46. function displayServerMessage(thePlayer,message,type)
  47. triggerClientEvent(thePlayer,"onServerWantToShowMessage",getRootElement(),message,type)
  48. end
Advertisement
Add Comment
Please, Sign In to add comment