Advertisement
Guest User

Untitled

a guest
Feb 13th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.03 KB | None | 0 0
  1. HTML:
  2. <!doctype html>
  3. <html lang="de">
  4. <head>
  5. <meta charset="utf-8">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <style>
  8. .background{ width: 300px; height: 350px; background-color: white; position: absolute; left: 50%; top: 50%; margin-top: -175px; margin-left: -150px; border-radius: 50px; }
  9. .heading{text-align: center; font-size: 20pt;}
  10. .input{ width: 95%; border: none; margin-top: 20px; height: 38px; margin-left: 2.5%; }
  11. .loginBtn{ width: 100%; position: relative; height: 40px; margin-top: 15px; }
  12. </style>
  13. </head>
  14. <body>
  15. <div class="background">
  16. <div class="heading">Login</div>
  17. <form>
  18. <input class="input" type="text" id="username" placeholder="Username" />
  19. <input class="input" type="password" id="password" placeholder="Password" />
  20. <button class="loginBtn" onclick="logUser()" id="loginBtn">Login</button>
  21. </form>
  22. </div>
  23. </body>
  24. </html>
  25.  
  26. <script>
  27. function logUser() {
  28. var username = $("#username").val();
  29. var password = $("#password").val();
  30. resourceCall("tryLogin", username, password);
  31. }
  32. </script>
  33.  
  34.  
  35. Startup.js:
  36. // ON STARTUP-LOAD
  37. function onLoad(args) {
  38. var cameraPositionStartup = args[0]; // Getting the CameraPosition
  39. var vinewoodCam = API.createCamera(cameraPositionStartup, new Vector3()); // Create a Camera
  40. API.setActiveCamera(vinewoodCam);// Set the Camera Active
  41. //API.setHudVisible(false); // Disabling the HUD
  42. openLogin();
  43. }
  44.  
  45. var myBrowser = null;
  46.  
  47. function openLogin() {
  48. var res = API.getScreenResolution(); //this gets the client's screen resoulution
  49. myBrowser = API.createCefBrowser(res.Width, res.Height); //we're initializing the browser here. This will be the full size of the user's screen.
  50. API.waitUntilCefBrowserInit(myBrowser); //this stops the script from getting ahead of itself, it essentially pauses until the browser is initialized
  51. API.setCefBrowserPosition(myBrowser, 0, 0); //The orientation (top left) corner in relation to the user's screen. This is useful if you do not want a full page browser. 0,0 is will lock the top left corner of the browser to the top left of the screen.
  52. API.loadPageCefBrowser(myBrowser, "Client/Startup/Login.html"); //This loads the HTML file of your choice. . API.setCefBrowserHeadless(myBrowser, true); //this will remove the scroll bars from the bottom/right side
  53. API.showCursor(true); //This will show the mouse cursor
  54. API.setCanOpenChat(false); //This disables the chat, so the user can type in a form without opening the chat and causing issues.
  55.  
  56. }
  57.  
  58. function tryLogin(Username, Password) {
  59. API.sendChatMessage("Your username is " + Username + " and your password is " + Password); //send a chat message with the data they entered.
  60. API.showCursor(false); //stop showing the cursor
  61. API.destroyCefBrowser(myBrowser); //destroy the CEF browser
  62. API.setCanOpenChat(true); //allow the player to use the chat again.
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement