Quer_yugane_DE

RandomTP

Nov 27th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 7.05 KB | None | 0 0
  1. #               Random-TP skript
  2. #This skript inplements a randomtp command with in-game configurable values (like teleport range)
  3. #if you found a bug or have questions feel free to add me on skype: Hiroyugane
  4. #This skript is by Hiroyugane_DE. You may can use it for your server or private. You may cannot re-upload it or make money from it.
  5. #(configurable costs and delay are work in progress)
  6. #
  7.  
  8. Skript start:
  9.     if {random.min} is not set:
  10.         set {random.min} to -5000
  11.     if {random.max} is not set:
  12.         set {random.max} to 5000
  13.     if {random.height} is not set:
  14.         set {random.height} to 100
  15.     else:
  16.         stop
  17.  
  18. command /randomtp [<text>] [<player=%player%>]:
  19.     trigger:
  20.         if arg-1 is "use":
  21.             if player has permission "randomtp.use.self":
  22.                 if player has 4 diamonds:
  23.                     set {_waited} to difference between {randomtp.%player%.lastused} and now
  24.                     if {_waited} is less than 5 minutes:
  25.                         message "&c&nSorry&r,&7 but you have to wait &d%difference between 5 minutes and {_waited}% &7before you can use this command again!"
  26.                         stop
  27.                     else:
  28.                         remove 8 diamonds from player
  29.                         set {randomtp.%player%.lastused} to now
  30.                         send "&8>&c> &e&nTeleportation is being prepared"
  31.                         set {_random.cord.x} to a random integer between {random.min} and {random.max}
  32.                         set {_random.cord.y} to {random.height}
  33.                         set {_random.cord.z} to a random integer between {random.min} and {random.max}
  34.                         set {_currentlocation} to location of arg-player
  35.                         set {_relative.x} to rounded down the x coord of {_currentlocation}
  36.                         subtract {_random.cord.x} from {_relative.x}
  37.                         set {_relative.y} to rounded down the y coord of {_currentlocation}
  38.                         subtract {_random.cord.y} from {_relative.y}
  39.                         set {_relative.z} to rounded down the z coord of {_currentlocation}
  40.                         subtract {_random.cord.z} from {_relative.z}
  41.                         set {_destinationx} to the block {_relative.x} west of the block at {_currentlocation}
  42.                         set {_destinationy} to the block {_relative.y} below the block at {_destinationx}
  43.                         set {_destination} to the block {_relative.z} north of the block at {_destinationy}
  44.                         wait 50 tick
  45.                         send "&8>&c> &e&nTeleporting you to &4&n%{_random.cord.x}%, %{_random.cord.y}%, %{_random.cord.z}%"
  46.                         wait 25 tick
  47.                         send "&2&l3..."
  48.                         wait 25 tick
  49.                         send "&6&l2..."
  50.                         wait 25 tick
  51.                         send "&4&l1..."
  52.                         wait 25 tick
  53.                         teleport the player to {_destination}
  54.                         wait 5 ticks
  55.                         send "&8>&c> &4&nSuccessfully&r &e&nTeleported!"
  56.                         stop
  57.                 else:
  58.                     send "&c&nSorry&r, &7but you need &b&n8 diamonds&7 to use this function."
  59.                     stop
  60.             if arg-2 is not player:
  61.                 if player has permission "randomtp.use.others":
  62.                     send "&8>&c> &e&nAn Admin forced a random teleportation" to arg 2
  63.                     send "&8>&c> &e&nteleporting in 10 seconds" to arg 2
  64.                     wait 100 tick
  65.                     send "&8>&c> &e&nTeleportation is being prepared"
  66.                     set {_random.cord.x} to a random integer between {random.min} and {random.max}
  67.                     set {_random.cord.y} to {random.height}
  68.                     set {_random.cord.z} to a random integer between {random.min} and {random.max}
  69.                     set {_currentlocation} to location of arg-player
  70.                     set {_relative.x} to rounded down the x coord of {_currentlocation}
  71.                     subtract {_random.cord.x} from {_relative.x}
  72.                     set {_relative.y} to rounded down the y coord of {_currentlocation}
  73.                     subtract {_random.cord.y} from {_relative.y}
  74.                     set {_relative.z} to rounded down the z coord of {_currentlocation}
  75.                     subtract {_random.cord.z} from {_relative.z}
  76.                     set {_destinationx} to the block {_relative.x} west of the block at {_currentlocation}
  77.                     set {_destinationy} to the block {_relative.y} below the block at {_destinationx}
  78.                     set {_destination} to the block {_relative.z} north of the block at {_destinationy}
  79.                     wait 50 tick
  80.                     send "&8>&c> &e&nTeleporting you to &4&n%{_random.cord.x}%, %{_random.cord.y}%, %{_random.cord.z}%"
  81.                     wait 25 tick
  82.                     send "&2&l3..."
  83.                     wait 25 tick
  84.                     send "&6&l2..."
  85.                     wait 25 tick
  86.                     send "&4&l1..."
  87.                     wait 25 tick
  88.                     teleport the player to {_destination}
  89.                     wait 5 ticks
  90.                     send "&8>&c> &4&nSuccessfully&r &e&nTeleported!"
  91.                     stop
  92.                 else:
  93.                     send "&c&nSorry&r, &7but you're not allowed to teleport others."
  94.                     stop
  95.             else:
  96.                 send "&c&nSorry&r, &7but you're not allowed to do that."
  97.                 stop
  98.         if arg-1 is "help":
  99.             if player has permission "randomtp.help":
  100.                 send "        &e&lRandom&6&lTp"
  101.                 send "&7/&9randomtp &ause &7- &eTo take a randomtp (this costs 8 diamonds)"
  102.                 send "&7/&3randomtp &cconfig &7- &eFor editing variables"
  103.                 stop
  104.             else:
  105.                 send "&c&nSorry&r, &7but you're not allowed to do that."
  106.                 stop
  107.         if arg-1 is "config":
  108.             if player has permission "randomtp.admin":
  109.                 send "        &e&lRandomTp &cAdmin"
  110.                 send "&7/&2randommin &9[value] &7- &ddefault is -5000"
  111.                 send "&7/&4randommax &9[value] &7- &ddefault is  5000"
  112.                 send "&7/&brandomheight &9[value] &7- &ddefault is 100"
  113.                 send "&7/&6randomcooldown &9[value] &7- &ddefault is 5"
  114.                 send "&7/&3randomcost &9[value] &7- &ddefault is 4"
  115.                 stop
  116.             else:
  117.                 send "&c&nSorry&r, &7but you're not allowed to do that."
  118.                 stop
  119.         else:
  120.             send "&8>&c>If you don't know what to do, use &7/&erandomtp &6help"
  121.             stop
  122.            
  123. command /randommin [<integer>]:
  124.     description: Sets the minimum value for x and z coordinates
  125.     permission: randomtp.admin
  126.     permission message: &4&nPlease go back to the user area.
  127.     trigger:
  128.         if arg-1 is set:
  129.             set {random.min} to arg-1
  130.             send "&8>&c> &a&nminvalue set to %arg-1%"
  131.             stop
  132.         else:
  133.             send "&3The current value is %{random.min}%"
  134.  
  135. command /randommax [<integer>]:
  136.     description: Sets the maximum value for x and z coordinates
  137.     permission: randomtp.admin
  138.     permission message: &4&nPlease go back to the user area.
  139.     trigger:
  140.         if arg-1 is set:
  141.             set {random.max} to arg-1
  142.             send "&8>&c> &a&nmaxvalue set to %arg-1%"
  143.             stop
  144.         else:
  145.             send "&3The current value is %{random.max}%"
  146.  
  147. command /randomheight [<integer>]:
  148.     description: Sets the y coordinate (it has to be between 0 and 255)
  149.     permission: Randomtp.admin
  150.     permission message: &4&nPlease go back to the user area.
  151.     trigger:
  152.         if arg-1 is set:
  153.             if arg-1 is between 0 and 255:
  154.                 set {random.height} to arg-1
  155.                 send "&8>&c> &a&nheightvalue set to %arg 1%"
  156.                 stop
  157.             else:
  158.                 send "&8>&c> &c&nThe value isn't valid"
  159.                 stop
  160.         else:
  161.             send "&3The current value is %{random.height}%"
  162.  
  163. #command /randomcooldown [<integer>]:
  164. #   description: Sets the cooldown for this command (in minutes)
  165. #   permission: Randomtp.admin
  166. #   permission message: &4&nPlease go back to the user area.
  167. #   trigger:
  168. #       set {random.cooldown} to "%arg 1% minutes"
  169. #       send "&8>&c> &a&ncooldownvalue set to %arg 1% minutes"
  170. #      
  171. #       >>>If you know how to let this work feel free to send me the idea<<<
  172. #
  173. #command /randomcost [<integer>]:
  174. #   description: Sets the cost for this command
  175. #   permission: Randomtp.admin
  176. #   permission message: &4&nPlease go back to the user area.
  177. #   trigger:
  178. #       set {random.cost} to arg-1
  179. #       send "&8>&c> &a&ncost set to %arg 1% diamonds"
Add Comment
Please, Sign In to add comment