Solved How to make the event cause the blocks to stay the same?

  • 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 community!

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

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

JustADev

Well-Known Member
Apr 8, 2017
379
9
18
This my current kitpvp block placing script


I added a cmd called /buildmode, where staff can toggle it.

Here is what is supposed to happen:
When:
ENABLED - Never clears the player's blocks when placed
DISABLED (Works Perfectly) - Removes Oak Logs, Plank, water, and fire

The only problem, is that when buildmode is enabled, it still removes blocks
If anyone can show me a better way to code it i would love it

CODE:
code_language.skript:
on place of planks:0:
    add location of event-block to {locations::*}
on place of oak log:
    add location of event-block to {locations::*}
on place of water:
    add location of event-block to {locations::*}
on place of fire:
    add location of event-block to {locations::*}
  
On block place:
    If event-block is planks:0:
        wait 5 seconds
        Set event-block to air
    If event-block is oak log:
        wait 5 seconds
        Set event-block to air
    If event-block is water:
        wait 5 seconds
        Set event-block to air
    If event-block is fire:
        wait 5 seconds
        Set event-block to air
        
    
        
 
command /buildmode:
    permission: staff.buildmode
    trigger:
        if {build.%player%} is not set:
            set {build.%player%} to true
            send "&8[&aBuildMode&8] &7BuildMode is now &a&lENABLED" to player
        else:
            delete {build.%player%}
            send "&8[&aBuildMode&8] &7BuildMode is now &c&lDISABLED" to player
    
on block place:
     if {build.%player%} is not set:
        if event-block is planks:0:
            wait 5 seconds
            Set event-block to air
        if event-block is oak log:
            wait 5 seconds
            Set event-block to air
        if event-block is water:
            wait 5 seconds
            Set event-block to air
        if event-block is fire:
            wait 5 seconds
            Set event-block to air
        
on block place:
    if {build.%player%} is set:
        if event-block is planks:0:
            wait 1 second
            set block at event-location to event-block
        if event-block is oak log:
            wait 1 second
            set block at event-location to event-block
        if event-block is water:
            wait 1 second
            set block at event-location to event-block
        if event-block is fire:
            wait 1 second
            set block at event-location to event-block
            
    
            
on bucket empty:
    wait 1 tick
    remove 1 bucket from player
 
This my current kitpvp block placing script


I added a cmd called /buildmode, where staff can toggle it.

Here is what is supposed to happen:
When:
ENABLED - Never clears the player's blocks when placed
DISABLED (Works Perfectly) - Removes Oak Logs, Plank, water, and fire

The only problem, is that when buildmode is enabled, it still removes blocks
If anyone can show me a better way to code it i would love it

CODE:
code_language.skript:
on place of planks:0:
    add location of event-block to {locations::*}
on place of oak log:
    add location of event-block to {locations::*}
on place of water:
    add location of event-block to {locations::*}
on place of fire:
    add location of event-block to {locations::*}
 
On block place:
    If event-block is planks:0:
        wait 5 seconds
        Set event-block to air
    If event-block is oak log:
        wait 5 seconds
        Set event-block to air
    If event-block is water:
        wait 5 seconds
        Set event-block to air
    If event-block is fire:
        wait 5 seconds
        Set event-block to air
       
   
       
 
command /buildmode:
    permission: staff.buildmode
    trigger:
        if {build.%player%} is not set:
            set {build.%player%} to true
            send "&8[&aBuildMode&8] &7BuildMode is now &a&lENABLED" to player
        else:
            delete {build.%player%}
            send "&8[&aBuildMode&8] &7BuildMode is now &c&lDISABLED" to player
   
on block place:
     if {build.%player%} is not set:
        if event-block is planks:0:
            wait 5 seconds
            Set event-block to air
        if event-block is oak log:
            wait 5 seconds
            Set event-block to air
        if event-block is water:
            wait 5 seconds
            Set event-block to air
        if event-block is fire:
            wait 5 seconds
            Set event-block to air
       
on block place:
    if {build.%player%} is set:
        if event-block is planks:0:
            wait 1 second
            set block at event-location to event-block
        if event-block is oak log:
            wait 1 second
            set block at event-location to event-block
        if event-block is water:
            wait 1 second
            set block at event-location to event-block
        if event-block is fire:
            wait 1 second
            set block at event-location to event-block
           
   
           
on bucket empty:
    wait 1 tick
    remove 1 bucket from player
Why do you have all thoose "On block place" events? You only need one.

Code:
on block place:
     if {build.%player%} is not set:
        if event-block is planks:0:
            wait 5 seconds
            Set event-block to air
        if event-block is oak log:
            wait 5 seconds
            Set event-block to air
        if event-block is water:
            wait 5 seconds
            Set event-block to air
        if event-block is fire:
            wait 5 seconds
            Set event-block to air
[doublepost=1501428231,1501428146][/doublepost]Just make an "Else" if you need to.
 
wait can you show me an example? im not sure what your saying
 
wait can you show me an example? im not sure what your saying
Code:
on block place:
     if {build.%player%} is not set:
        if event-block is planks:0:
            wait 5 seconds
            Set event-block to air
        if event-block is oak log:
            wait 5 seconds
            Set event-block to air
        if event-block is water:
            wait 5 seconds
            Set event-block to air
        if event-block is fire:
            wait 5 seconds
            Set event-block to air
    Else:
        if event-block is planks:0:
            Set event-block to event-block
        if event-block is oak log:
            Set event-block to event-block
        if event-block is water:
            Set event-block to event-block
        if event-block is fire:
            Set event-block to event-block
There should be a pair of errors, but you just need fix the tabs. This code thingy, does it with spaces and not tabs.
 
So wait, it gives me 21 errors saying i need to use spaces instead of tabs? Do i change it to spaces?
 
So wait, it gives me 21 errors saying i need to use spaces instead of tabs? Do i change it to spaces?
You need to change it to tabs. Just clear all of the spaces and tab it out so it works. :emoji_slight_smile: - Sorry for bad english
 
TYSM, Appreciate it man
[doublepost=1501430707,1501429833][/doublepost]Now, 1 question, how would i change the entire thing so i can set other players in buildmode?
Like /buildmode [<player>]?

Also, I am new to script so showing me is the best way to learn
 
TYSM, Appreciate it man
[doublepost=1501430707,1501429833][/doublepost]Now, 1 question, how would i change the entire thing so i can set other players in buildmode?
Like /buildmode [<player>]?

Also, I am new to script so showing me is the best way to learn
That can be done pretty easy. After the # i have made a little text, you can read.
Code:
command /buildmode [<Offline player>]:
    permission: staff.buildmode
    trigger:
        if arg-1 is not set:   #Checks if you typed a player in
            if {build.%player%} is not set:
                set {build.%player%} to true
                send "&8[&aBuildMode&8] &7BuildMode is now &a&lENABLED" to player
            else:
                delete {build.%player%}
                send "&8[&aBuildMode&8] &7BuildMode is now &c&lDISABLED" to player
        Else:    #You could set this to "If arg-1 is Whatever", but in this case you don't need to.
            If {Build.%arg-1%} is not set:  #Checking if the player (arg-1) has buildmode enabled
                Set {Build.%arg-1%} to true
                send "&8[&aBuildMode&8] &7BuildMode is now &a&lENABLED" to arg-1   #Remember to send it to arg-1
                send "&8[&aBuildMode&8] &7BuildMode is now &a&lENABLED &7for %arg-1%" to command sender   #This is the message the command sender get.
            Else:
                Delete {Build.%arg-1%}
                send "&8[&aBuildMode&8] &7BuildMode is now &c&lDISABLED" to player
                send "&8[&aBuildMode&8] &7BuildMode is now &c&lDISABLED &7for %arg-1%" to command sender
 
wait so does do i have to add another On block place for the arg-1 section that is now added or no
 
wait so does do i have to add another On block place for the arg-1 section that is now added or no
The %arg-1% basicly mean %player%. So you don't have to make another on block place.
 
Status
Not open for further replies.