Zeldaboy111

Skript #173 - YML files writen

May 25th, 2019
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.42 KB | None | 0 0
  1. options:
  2. skript_name: Lobby
  3. version: 1.0
  4. prefix: &f[&3Lobby&f] &8>>
  5. settings: Files/{@skript_name}/Settings.yml
  6.  
  7.  
  8. on enable:
  9. send "%nl%%nl%{@prefix} &7Het Skript &8{@skript_name} &7is aangezet" to console
  10. send "{@prefix} &8Bestanden &7aan het maken...%nl%%nl%" to console
  11.  
  12. #Direction
  13. if dir "Files/{@skript_name}" doesn't exist:
  14. create dir "Files/{@skript_name}"
  15.  
  16. if dir "Files/{@skript_name}/LobbyList" doesn't exist:
  17. create dir "Files/{@skript_name}/LobbyList"
  18.  
  19. if file "Files/{@skript_name}/Settings.yml" doesn't exist:
  20. create file "Files/{@skript_name}/Settings.yml"
  21.  
  22. set yml value "GiveLobbyCompassOnJoin.enabled" of file "Files/{@skript_name}/Settings.yml" to true
  23. set yml value "GiveLobbyComapassOnWorldJoin.enabled" of file "Files/{@skript_name}/Settings.yml" to true
  24. add "world" to yml list "GiveLobbyCompassOnWorldJoin.worlds" of file "Files/{@skript_name}/Settings.yml"
  25. set yml value "ResetJoinSettings.enabled" of file "Files/{@skript_name}/Settings.yml" to true
  26. save yml "Files/{@skript_name}/Settings.yml"
  27.  
  28.  
  29.  
  30. #Bestanden
  31. setup("config")
  32.  
  33.  
  34.  
  35. wait 3 seconds
  36. send "%nl%%nl%{@prefix} &7Succesvol alle &8bestanden &7gemaakt%nl%%nl%" to console
  37.  
  38.  
  39. on disable:
  40. send "%nl%%nl%{@prefix} &4Het Skript &c{@skript_name} &4is uitgezet%nl%%nl%" to console
  41.  
  42.  
  43. on join:
  44. execute console command "/lobby %player%"
  45.  
  46.  
  47. command /lobbyconfig [<text>] [<text>] [<text>] [<text>]:
  48. trigger:
  49. if player has permission "lobby.*":
  50. if arg 1 is "set":
  51. if arg 2 is set:
  52. if arg 3 is "spawn" OR "lobby":
  53. if arg 2 is "lobby":
  54.  
  55. setValue("Lobby", "set", player)
  56.  
  57. send "{@prefix} &7Succesvol de &8%arg 2% &7gezet op:"
  58. send "&8World: &7%world of player%"
  59. send "&8Yaw: &7%yaw of player%"
  60. send "&8Pitch: &7%pitch of player%"
  61. send "&8X: &7%x-coordinate of location of player%"
  62. send "&8Y: &7%y-coordinate of location of player%"
  63. send "&8Z: &7%z-coordinate of location of player%"
  64. stop
  65.  
  66. else:
  67. set yaml value "%arg 2%.Location.World" of file "Files/{@skript_name}/LobbyList/%arg 2%.yml" to "%world of player%"
  68. set yaml value "%arg 2%.Location.Yaw" of file "Files/{@skript_name}/LobbyList/%arg 2%.yml" to yaw of player
  69. set yaml value "%arg 2%.Location.Pitch" of file "Files/{@skript_name}/LobbyList/%arg 2%.yml" to pitch of player
  70. set yaml value "%arg 2%.Location.X" of file "Files/{@skript_name}/LobbyList/%arg 2%.yml" to x-coordinate of player
  71. set yaml value "%arg 2%.Location.Y" of file "Files/{@skript_name}/LobbyList/%arg 2%.yml" to y-coordinate of player
  72. set yaml value "%arg 2%.Location.Z" of file "Files/{@skript_name}/LobbyList/%arg 2%.yml" to z-coordinate of player
  73.  
  74. save yaml "Files/{@skript_name}/LobbyList/%arg 2%.yml"
  75.  
  76. send "{@prefix} &7Succesvol &8%arg 2% &7gezet op:"
  77. send "&8World: &7%world of player%"
  78. send "&8Yaw: &7%yaw of player%"
  79. send "&8Pitch: &7%pitch of player%"
  80. send "&8X: &7%x-coordinate of location of player%"
  81. send "&8Y: &7%y-coordinate of location of player%"
  82. send "&8Z: &7%z-coordinate of location of player%"
  83. stop
  84.  
  85. else if arg 3 is "name":
  86. if arg 4 is set:
  87. if arg 2 is "lobby" OR "spawn":
  88. send "{@prefix} &4Je kan de naam van de &c%arg 2% &4niet aanpassen."
  89. stop
  90.  
  91. else:
  92.  
  93. if file "Files/{@skript_name}/LobbyList/%arg 4%.yml" exists:
  94. send "{@prefix} &4De naam &c%arg 4% &4is al in gebruik."
  95. stop
  96.  
  97. send "{@prefix} &7Bestand &8%arg 2% &7van naam veranderen naar &8%arg 4%&7..."
  98.  
  99. renameLobby("%arg 2%", "%arg 4%")
  100.  
  101. wait 1 second
  102.  
  103. send "{@prefix} &7Bestand &8%arg 2% &7is succesvol van naam gewijzigd naar &8%arg 4%&7."
  104. stop
  105.  
  106.  
  107.  
  108. else:
  109. send "{@prefix} &4Je moet nog een &cnaam &4opgeven."
  110.  
  111. else:
  112. send "{@prefix} &4Je moet &cspawn &4of &cname &4opgeven."
  113.  
  114. else:
  115. send "{@prefix} &4Je moet nog &clobby &4of een &cnaam voor je gamemode &4opgeven en &cwat je wilt doen&4."
  116. send "{@prefix} &4Voor een lijstje met evenementen doe: &c/lobbyconfig eventlist&4."
  117.  
  118.  
  119. else if arg 1 is "delete":
  120. if arg 2 is set:
  121. if arg 2 is "lobby" OR "spawn":
  122. setup("config")
  123.  
  124. send "{@prefix} &7Succesvol de &8%arg 2% &7verwijderd."
  125. stop
  126.  
  127.  
  128. else:
  129. if file "Files/{@skript_name}/LobbyList/%arg 2%.yml" exists:
  130.  
  131. delete file "Files/{@skript_name}/LobbyList/%arg 2%.yml"
  132. send "{@prefix} &7Succesvol het bestand &8%arg 2%.yml &7verwijderd."
  133. stop
  134.  
  135. else:
  136. send "{@prefix} &4De lobby &c%arg 2% &4bestaat niet."
  137. stop
  138.  
  139. else:
  140. send "{@prefix} &4Je moet nog een &clobby naam &4opgeven."
  141. stop
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150. command /lobby [<text>] [<text>]:
  151. trigger:
  152. if executor is console:
  153. if arg 1 is set:
  154. if arg 2 is set:
  155. teleportLobby((arg-1 parsed as a player), "%arg 2%")
  156. send "{@prefix} &7Succesvol de speler &8%arg 1% &7naar de lobby gestuurd." to console
  157.  
  158. else:
  159. teleportLobby((arg-1 parsed as a player), "Lobby")
  160.  
  161.  
  162. else:
  163. if arg 1 is set:
  164. if player has permission "Lobby.*":
  165. if arg 2 is set:
  166. teleportLobby((arg-1 parsed as a player), arg 2)
  167.  
  168. else:
  169. teleportLobby((arg-1 parsed as a player), "Lobby")
  170.  
  171. else:
  172. teleportLobby(player, "Lobby")
  173. else:
  174. teleportLobby(player, "Lobby")
  175.  
  176.  
  177. command /lobbycompass [<text>] [<text>] [<text>] [<text>] [<text>]:
  178. aliases: /lc
  179. trigger:
  180. if player has permission "Lobby.*":
  181. if arg 1 is "config":
  182. if arg 2 is "create":
  183. if arg 3 is set:
  184. if file "Files/{@skript_name}/LobbyList/%arg 3%.yml" exists:
  185.  
  186. if arg 4 is set:
  187. if ("%arg 4%" parsed as an item) is an item:
  188. if yml value "ResetJoinSettings.enabled" of file "Files/{@skript_name}/Settings.yml" is true:
  189. set yml value "GiveLobbyCompassOnJoin.enabled" of file "Files/{@skript_name}/Settings.yml" to true
  190.  
  191. set {_dir} to "Files/{@skript_name}/LobbyList/%arg 3%.yml"
  192.  
  193.  
  194.  
  195. stop
  196.  
  197. else:
  198. send "{@prefix} &4Het item &c%arg 4% &4is geen item."
  199. stop
  200. else:
  201. send "{@prefix} &4Je moet nog een &citem &4opgeven."
  202. stop
  203. else:
  204. send "{@prefix} &4Het bestand &c%arg 3%.yml &4bestaat niet."
  205. stop
  206. else:
  207. send "{@prefix} &4Je moet nog een &clobbynaam &4en &citem &4opgeven."
  208. stop
  209.  
  210.  
  211.  
  212. if arg 2 is "edit":
  213. if arg 3 is set:
  214. if file "Files/{@skript_name}/LobbyList/%arg 3%.yml" exists:
  215. if arg 4 is "setname":
  216. if arg 5 is set:
  217. set yaml value "%arg 3%.LobbyCompass.name" of file "Files/{@skript_name}/LobbyList/%arg 3%.yml" to "%arg 5%"
  218. save yaml "Files/{@skript_name}/LobbyList/%arg 3%.yml"
  219.  
  220. send "{@prefix} &7Succesvol de naam van &8%arg 3% &7veranderd naar: &8%arg 5%"
  221. stop
  222.  
  223. else:
  224. send "{@prefix} &4Je moet nog een &cnaam voor het item &4opgeven."
  225. stop
  226. if arg 4 is "deletename":
  227.  
  228.  
  229. if arg 4 is "enable":
  230. #EnableOnNameSwitch
  231. #EnableOnLoreSwitch
  232. #EnableOnItemSwitch
  233.  
  234. if arg 4 is "disable":
  235.  
  236. if arg 4 is "setitem":
  237.  
  238.  
  239.  
  240. if arg 4 is "setlore":
  241. if arg 5 is set:
  242.  
  243. if arg 4 is "deletelore":
  244. if arg 5 is set:
  245.  
  246. else:
  247. send "{@prefix} &4Het bestand &c%arg 3%.yml &4bestaat niet."
  248. stop
  249.  
  250.  
  251.  
  252. function teleportLobby(p: player, tVar: string):
  253. if {_tVar} is "Lobby":
  254. set {_world} to yaml value "Lobby.Location.World" of file "Files/{@skript_name}/Config.yml"
  255.  
  256. if {_world} is not "None":
  257. set {_yaw} to yaml value "Lobby.Location.Yaw" of file "Files/{@skript_name}/Config.yml"
  258. set {_pitch} to yaml value "Lobby.Location.Pitch" of file "Files/{@skript_name}/Config.yml"
  259. set {_x} to yaml value "Lobby.Location.X" of file "Files/{@skript_name}/Config.yml"
  260. set {_y} to yaml value "Lobby.Location.Y" of file "Files/{@skript_name}/Config.yml"
  261. set {_z} to yaml value "Lobby.Location.Z" of file "Files/{@skript_name}/Config.yml"
  262.  
  263. set {_loc} to location at ({_x}, {_y}, {_z}) in world "%{_world}%"
  264. set {_loc}'s pitch to {_pitch}
  265. set {_loc}'s yaw to {_yaw}
  266.  
  267. teleport {_p} to {_loc}
  268. stop
  269. else:
  270. send "{@prefix} &4De lobby is &cnog niet gezet&4, doe &c/lobby set &c&llobby &cspawn&4." to {_p}
  271. stop
Advertisement
Add Comment
Please, Sign In to add comment