1. Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved Shop/Bankrob

Discussion in 'Requests' started by Merthan, Oct 17, 2020.

  1. Merthan

    Merthan Member

    Oct 17, 2020
    Likes Received:
    Category: Robbery

    Suggested name: shoprob

    Spigot/Skript Version: Spigot: 1.12.2 Skript: 2.5

    What I want:

    If a player is in a specific region (inside a shop) a player should be able to execute a command like /startrob. After this, a countdown (In Action-Bar) of 5 Minutes should start. After this countdown, the player should get $300-$500 for completing the shop- or bankrob. But if a player leaves the region of the shop / bank while countdown is active, the countdown should stop and the rob should be cancelled. (Messages etc. could i add by myself)

    The command like /startrob should have a global cooldown of 30 minutes

    Ideas for commands: /startrob (Starts the Shop- or Bankrob); /resetrobtimer (Resets the cooldown (Admins only))

    Ideas for permissions: permission for resetting timer: "admin"

    When I'd like it by: as soon as possible (1-2 weeks)

    Thank u guys <3
  2. Best Answer:
    Post #2 by TFS_Mads, Oct 21, 2020
  3. TFS_Mads

    TFS_Mads Active Member

    Oct 16, 2020
    Likes Received:
    Here is a rob skript but you could check if player is in the area way easier with worldguard.

    Code (Text):
    1. options:
    2.     countdown: 1 #minutes
    3.     robtime: 10 #seconds
    6. function checkarea(p: player) :: boolean:
    7.     if x coord of {robarea::pos1} > x coord of {robarea::pos2}:      
    8.         if {_p}'s x coord is more than {robarea::pos1}'s x coord:
    9.             broadcast "fail3"
    10.             return false
    11.     else:
    12.         if {_p}'s x coord is less than {robarea::pos1}'s x coord:
    13.             broadcast "fail3"
    14.             return false
    16.     if x coord of {robarea::pos2} > x coord of {robarea::pos1}:      
    17.         if {_p}'s x coord is more than {robarea::pos2}'s x coord:
    18.             broadcast "fail3"
    19.             return false
    20.     else:
    21.         if {_p}'s x coord is less than {robarea::pos2}'s x coord:
    22.             broadcast "fail3"
    23.             return false
    25.     if z coord of {robarea::pos1} > z coord of {robarea::pos2}:      
    26.         if {_p}'s z coord is more than {robarea::pos1}'s z coord:
    27.             broadcast "fail3"
    28.             return false
    29.     else:
    30.         if {_p}'s z coord is less than {robarea::pos1}'s z coord:
    31.             broadcast "fail3"
    32.             return false
    34.     if z coord of {robarea::pos2} > z coord of {robarea::pos1}:      
    35.         if {_p}'s z coord is more than {robarea::pos2}'s z coord:
    36.             broadcast "fail3"
    37.             return false
    38.     else:
    39.         if {_p}'s z coord is less than {robarea::pos2}'s z coord:
    40.             broadcast "fail3"
    41.             return false
    42.     return true
    44. command /rob <text>:
    45.     usage: &7/rob <start/reset/pos1/pos2>
    46.     permission: rob
    47.     permission message: &cNo permission
    48.     trigger:
    49.         if arg-1 is set:
    50.             if arg-1 is "start":
    51.                 if {robbery::countdown} is not set:
    52.                     if checkarea(player) is true:
    53.                         if {robbery::timer} is not set:
    54.                             send "Robbery started"
    55.                             set {robbery::timer} to 0
    56.                             set {robbery::player} to player
    57.                             stop
    58.                         else:
    59.                             send "robbery inprogress"
    60.                     else:
    61.                         send "area"
    62.                 else:
    63.                     send "cooldown"
    64.             else if player has permission "rob.admin":
    65.                 if arg-1 is "reset":
    66.                     delete {robbery::countdown}
    67.                     send "reset"
    68.                 else if arg-1 is "pos1":
    69.                     set {robarea::pos1} to player's target block
    70.                     send "pos1 set to %player's target block's location%"
    71.                 else if arg-1 is "pos2":
    72.                     set {robarea::pos2} to player's target block
    73.                     send "pos2 set to %player's target block's location%"              
    74.             else if player does not have permission "rob.admin":
    75.                 send "&cNo permission"
    76.         else:
    77.             send "&7/rob <start/reset/pos1/pos2>"
    80. every 1 second:
    81.     if {robbery::timer} is set:
    82.         if checkarea({robbery::player}) is true:
    83.             add 1 to {robbery::timer}
    84.             if {robbery::timer} >= {@robtime}:
    85.                 send "Robbery succesfull" to {robbery::player}
    86.                 set {robbery::countdown} to 60 * {@countdown}
    87.                 delete {robbery::timer}
    88.             else:
    89.                 send action bar "%{@robtime} - {robbery::timer}%" to {robbery::player}
    90.         else:
    91.             delete {robbery::timer}
    92.             send "robbery failed" to {robbery::player}
    93.     if {robbery::countdown} is set:      
    94.         subtract 1 from {robbery::countdown}
    95.         if {robbery::countdown} <= 0:
    96.             delete {robbery::countdown}
    Merthan and Truezify like this.

Share This Page