Zeldaboy111

Skript #171 - LobbyFunctions

May 22nd, 2019
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.77 KB | None | 0 0
  1. function setup(s: String):
  2. if {_s} is "config":
  3. if file "Files/Lobby/Config.yml" doesn't exist:
  4. create file "Files/Lobby/Config.yml"
  5. load yaml "Files/Lobby/Config.yml" as "Files/Lobby/Config.yml"
  6. set skript-yaml value "Lobby.Location.World" from "Files/Lobby/Config.yml" to "None"
  7. set skript-yaml value "Lobby.Location.Yaw" from "Files/Lobby/Config.yml" to "None"
  8. set skript-yaml value "Lobby.Location.Pitch" from "Files/Lobby/Config.yml" to "None"
  9. set skript-yaml value "Lobby.Location.X" from "Files/Lobby/Config.yml" to "None"
  10. set skript-yaml value "Lobby.Location.Y" from "Files/Lobby/Config.yml" to "None"
  11. set skript-yaml value "Lobby.Location.Z" from "Files/Lobby/Config.yml" to "None"
  12. save yaml "Files/Lobby/Config.yml"
  13.  
  14. function setValue(s: String, e: String, p: player):
  15. if {_s} is "Lobby":
  16. if {_e} is "set":
  17. set yaml value "Lobby.Location.World" of file "Files/Lobby/Config.yml" to "%world of {_p}%"
  18. set yaml value "Lobby.Location.Yaw" of file "Files/Lobby/Config.yml" to yaw of {_p}
  19. set yaml value "Lobby.Location.Pitch" of file "Files/Lobby/Config.yml" to pitch of {_p}
  20. set yaml value "Lobby.Location.X" of file "Files/Lobby/Config.yml" to x-coordinate of {_p}
  21. set yaml value "Lobby.Location.Y" of file "Files/Lobby/Config.yml" to y-coordinate of {_p}
  22. set yaml value "Lobby.Location.Z" of file "Files/Lobby/Config.yml" to z-coordinate of {_p}
  23.  
  24. save yaml "Files/Lobby/Config.yml"
  25.  
  26. if {_e} is "delete":
  27. set yaml value "Lobby.Location.World" of file "Files/Lobby/LobbyList/%{_s}%.yml" to "None"
  28. set yaml value "Lobby.Location.Yaw" of file "Files/Lobby/LobbyList/%{_s}%.yml" to "None"
  29. set yaml value "Lobby.Location.Pitch" of file "Files/Lobby/LobbyList/%{_s}%.yml" to "None"
  30. set yaml value "Lobby.Location.X" of file "Files/Lobby/LobbyList/%{_s}%.yml" to "None"
  31. set yaml value "Lobby.Location.Y" of file "Files/Lobby/LobbyList/%{_s}%.yml" to "None"
  32. set yaml value "Lobby.Location.Z" of file "Files/Lobby/LobbyList/%{_s}%.yml" to "None"
  33.  
  34. save yaml "Files/Lobby/LobbyList/%{_s}%.yml"
  35.  
  36.  
  37. function setLobby(s: String, e: string, p: player):
  38. if {_e} is "set":
  39. if {_e} is "delete":
  40. set yaml value "Lobby.Location.World" of file "Files/Lobby/LobbyList/%{_s}%.yml" to world of {_p}
  41. set yaml value "Lobby.Location.Yaw" of file "Files/Lobby/LobbyList/%{_s}%.yml" to yaw of {_p}
  42. set yaml value "Lobby.Location.Pitch" of file "Files/Lobby/LobbyList/%{_s}%.yml" to pitch of {_p}
  43. set yaml value "Lobby.Location.X" of file "Files/Lobby/LobbyList/%{_s}%.yml" to x-coordinate of {_p}
  44. set yaml value "Lobby.Location.Y" of file "Files/Lobby/LobbyList/%{_s}%.yml" to y-coordinate of {_p}
  45. set yaml value "Lobby.Location.Z" of file "Files/Lobby/LobbyList/%{_s}%.yml" to z-coordinate of {_p}
  46.  
  47. save yaml "Files/Lobby/LobbyList/%{_s}%.yml"
  48.  
  49.  
  50. function renameLobby(s: String, s2: string):
  51. set {_world} to yaml value "%{_s}%.Location.World" of file "Files/Lobby/LobbyList/%{_s}%.yml"
  52. set {_yaw} to yaml value "%{_s}%.Location.Yaw" of file "Files/Lobby/LobbyList/%{_s}%.yml"
  53. set {_pitch} to yaml value "%{_s}%.Location.Pitch" of file "Files/Lobby/LobbyList/%{_s}%.yml"
  54. set {_x} to yaml value "%{_s}%.Location.X" of file "Files/Lobby/LobbyList/%{_s}%.yml"
  55. set {_y} to yaml value "%{_s}%Location.Y" of file "Files/Lobby/LobbyList/%{_s}%.yml"
  56. set {_z} to yaml value "%{_s}%.Location.Z" of file "Files/Lobby/LobbyList/%{_s}%.yml"
  57.  
  58. delete file "Files/Lobby/LobbyList/%{_s}%.yml"
  59.  
  60. wait 1 second
  61.  
  62. create file "Files/Lobby/LobbyList/%{_s2}%.yml"
  63.  
  64. setValue("%{_s2}%", "delete", {_world})
  65. setValue("%{_s2}%", "delete", {_yaw})
  66. setValue("%{_s2}%", "delete", {_pitch})
  67. setValue("%{_s2}%", "delete", {_x})
  68. setValue("%{_s2}%", "delete", {_y})
  69. setValue("%{_s2}%", "delete", {_z})
  70.  
  71. save yml "Files/Lobby/LobbyList/%{_s2}%/yml"
Add Comment
Please, Sign In to add comment