Zeldaboy111

Integer-parse functie ]|[ Skript #452

Sep 19th, 2021
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.90 KB | None | 0 0
  1. options:
  2. prefix: &6Mines&8:&7
  3.  
  4. on quit:
  5. delete {mine.user.%uuid of player%.isConfirmingMine}
  6.  
  7. command /mine [<text>] [<text>] [<text>] [<text>] [<text>]:
  8. aliases: /mines
  9. trigger:
  10. if executor is not a player:
  11. send "{@prefix} This command can only be executed by a player."
  12. else if arg-1 is "create":
  13. if arg-2 is not set:
  14. send "{@prefix} Invalid Usage! &e/mine create <id> <length> <depth> <width>&7."
  15. else if {mine.list::*} contains arg-2 in lower case:
  16. send "{@prefix} A mine with the id &e%arg-2 in lower case% &7already exists."
  17. else if isNotANumber(player, arg-3, "<length>", "<depth>", "<width>"), isNotANumber(player, arg-4, arg-3, "<depth>", "<width>") or isNotANumber(player, arg-5, arg-3, arg-4, "<width>") is false:
  18. stop
  19. else:
  20. set {mine.user.%uuid of player%.id} to arg-2 in lower case
  21. set {mine.user.%uuid of player%.length} to arg-3 parsed as an integer
  22. set {mine.user.%uuid of player%.depth} to arg-4 parsed as an integer
  23. set {mine.user.%uuid of player%.width} to arg-5 parsed as an integer
  24. send "{@prefix} Please confirm you want to create a mine with as parameters &e%arg-3% &e%arg-4% &e%arg-5%&7."
  25. send "{@prefix} To confirm, please type &e/mine confirm&7."
  26.  
  27. else if arg-1 is "delete":
  28. # Delete a mine
  29. else if arg-1 is "confirm":
  30. if {mine.user.%uuid of player%.isConfirmingMine} is not true:
  31. send "{@prefix} Invalid Usage! &e/mine <create | delete> <id> <length> <depth> <width>&7."
  32. else:
  33. # Confirm creating a mine
  34. else:
  35. send "{@prefix} Invalid Usage! &e/mine <create | delete> <id> <length> <depth> <width>&7."
  36.  
  37. function isNotANumber(player: Player, input: String, length: String, depth: String, width: String) :: Boolean:
  38. if {_input} parsed as an integer is not set:
  39. send "{@prefix} Invalid Usage! &e/mine create <id> %{_length}% &e%{_depth}% &e%{_width}%&7." to {_player}
  40. return false
  41. return true
  42.  
  43.  
Advertisement
Add Comment
Please, Sign In to add comment