Advertisement
Guest User

Untitled

a guest
May 27th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>JSON TO MP.OBJECT</title>
  6. </head>
  7.  
  8. <body>
  9. <form action="" method="post">
  10. <textarea id="code" name="code" cols="50" rows="50"></textarea>
  11. <textarea id="generated" name="generated" cols="50" rows="50"></textarea>
  12. </form>
  13.  
  14. <script src="https://code.jquery.com/jquery-3.3.1.js" integrity="sha256-2Kok7MbOyxpgUVvAk/HJ2jigOSYS2auK4Pfzbm7uH60=" crossorigin="anonymous"></script>
  15. <script type="text/javascript">
  16. $(document).ready(function() {
  17. $('#code').change(function() {
  18. var code = $('#code').val();
  19. var jsonCode = JSON.parse(code);
  20. console.log(code);
  21. console.log(jsonCode);
  22. console.log("------------------------------------------------------")
  23. jsonCode.Map.Objects.MapObject.forEach(function(element) {
  24. let mpObject = "let object = mp.objects.new(" + element.Hash + "), new mp.Vector3(" + element.Position.X + ", " + element.Position.Y + ", " + element.Position.Z + "), {\n rotation: new mp.Vector3(" + element.Rotation.X + ", " + element.Rotation.Y + ", " + element.Rotation.Z + "),\n dimension: 0 });\n";
  25. $('#generated').append(mpObject);
  26. });
  27. });
  28. });
  29. </script>
  30. </body>
  31. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement