noftaly

MultiPage

Jan 29th, 2018
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. command /menu [<int=1>]:
  2. trigger:
  3. set {_p} to arg-1
  4. set {_mp} to ceil((size of {loop::*} / 44))
  5. if {_p} > {_mp}:
  6. make player execute command "/menu %{_mp}%"
  7. stop
  8. open chest with 6 rows named "&cLoopTest &f(page %{_p}%/%{_mp}%)" to player
  9. if size of {loop::*} > 44:
  10. #=================================================
  11.  
  12. set {_index} to 0
  13. loop {loop::*}:
  14. if {_index} >= {_p} * (5 * 9) - 5 * 9:
  15. if {_index} < {_p} * 5 * 9:
  16. create a gui slot {_index} of player with stone named "&c%loop-value%" with lore "" to do nothing
  17. add 1 to {_index}
  18.  
  19. #=================================================
  20.  
  21. if {_p} != {_mp}:
  22. format gui slot 53 of player with an arrow named "&eSuivant" to run player command "/menu %({_p} + 1)%"
  23. if {_p} != 1:
  24. format gui slot 45 of player with an arrow named "&ePrécédent" to run player command "/menu %({_p} - 1)%"
  25. else:
  26. set {_si} to size of {loop::*}
  27. loop {_si} times:
  28. loop {loop::*}:
  29. set {_s} to loop-value-1
  30. format gui slot ({_s} - 1) of player with stone named "%loop-value-2%" to do nothing
  31. exit 1 section
  32. format gui slot 49 of player with paper named "&ePage actuelle : &f%{_p}%" with lore "&eMax page: &f%{_mp}%"
  33. on load:
  34. clear {loop::*}
  35. set {_r} to a random integer between 2 and 200
  36. broadcast "entre 1 et %{_r}%"
  37. loop all integers between 1 and {_r}:
  38. add loop-value to {loop::*}
Advertisement
Add Comment
Please, Sign In to add comment