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!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

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

Solved how can i give blocks 'owners'

Discussion in 'Skript' started by GlacialDew, Jun 15, 2018.

Thread Status:
Not open for further replies.
  1. GlacialDew

    GlacialDew Member

    Joined:
    Apr 8, 2018
    Messages:
    40
    Likes Received:
    3
    How can I make it to where when a player places a block, it can only be broken by that player and nobody else. Im trying to make a custom gamemode where players will be able to raid but I cant use any extra plugins that dont involve skript, so Factions is not an option.
     
  2. Best Answer:
    Post #2 by RaikaS, Jun 15, 2018
  3. RaikaS

    RaikaS Active Member

    Joined:
    Apr 6, 2018
    Messages:
    53
    Likes Received:
    1
    Code (Skript):
    1. on place:
    2.   set {%event-block%.owner} to player
    3. on break:
    4.   if {%event-block%.owner} is not player:
    5.     cancel event
    6.     send "You can break only blocks what you placed"
    7.  
     
  4. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    231
    okay.... i do agree with @RaikaS that that is how you do it. That is the simple form, but you are going to run into a few problems with it.

    #1 - Your variables file is going to get HUUUUUGGEEEEEEE.
    #2 - Staff/Owners will not be able to bypass this.

    Suggestions:
    - Staff ByPass - Super easy, will allow staff to bypass if they need to
    - List Variables - Cleans up your variable file a bit, but also makes it easier to clear out unused variables
    - Absent Time - Write in there something about absent players... for example, after a player has not logged in in say a month, their variables are cleared. This is two fold, #1 cleans up your variable file, getting rid of players who dont play anymore #2 unlocks blocks that have been placed but are from players who dont play on the server anymore
     
  5. saipar

    saipar Member

    Joined:
    Nov 29, 2017
    Messages:
    26
    Likes Received:
    0
    my attempt:
    Code (Skript):
    1.  
    2. on place:
    3.     set {owner::%event-block%} to player
    4. on break:
    5.     if {owner::%event-block%} != "%player%":
    6.         if {owner::%event-blockt%} has permission "break.bypass"
    7.             delete {owner::%event-block%}
    8.         else:
    9.             cancel event
    10.             send "&cPermission message here (line 9)"
    11.     else:
    12.         delete {owner::%event-block%}
    13.  
    14. [/CODE=SKRIPT]
     
  6. Pikachu

    Supporter Addon Developer

    Joined:
    Jan 25, 2017
    Messages:
    871
    Likes Received:
    139
    Medals:
    this is much better than the other solution
     
    • Agree Agree x 1
  7. RaikaS

    RaikaS Active Member

    Joined:
    Apr 6, 2018
    Messages:
    53
    Likes Received:
    1
    Heyy :emoji_grinning:
     
Thread Status:
Not open for further replies.

Share This Page

Loading...