Help with item block script and changing blocks

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

  • 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.

RobotnikMan

Member
Mar 14, 2017
2
0
0
34
Hi, I made an item block script for use with a PVP arena on my server. When clicked, it will give a random item, and turn to stone, before turning back into a redstone lantern again. In theory and in my testing it works, however when there are multiple players clicking on all the blocks in the arena, they will get 'stuck' as a stone block, and won't turn back into a redstone lantern.


Skript Version:
Skript 2.2 (dev25)
Skript Author: Bensku
Minecraft Version: 1.11
---
Full Code:

code_language.skript:
variables:
   {__randomblockitem} = 0
on click on a active redstone lamp:
   player has the permission "fps.fpsblock":
       set block to stone
       set {randomblockitem} to random integer from 0 and 772
       if {randomblockitem} is above or equal to 0:
           if {randomblockitem} is less than or equal to 10:
               wait 1 second
               execute console command "/shot give %name of player% Bazooka"
               execute console command "/give %name of player% cobblestone 10"
       if {randomblockitem} is above or equal to 11:
           if {randomblockitem} is less than or equal to 15:
               wait 1 second
               execute console command "/shot give %name of player% RecoilessRifle"
               execute console command "/give %name of player% stone 10"
#50 other if statements here so im not gonna include them
       if {randomblockitem} is above or equal to 759:
           if {randomblockitem} is below or equal to  767:
               wait 1 second
               execute console command "/shot give %name of player% FlakBomb"
       if {randomblockitem} is above or equal to 768:
           if {randomblockitem} is below or equal to  772:
               wait 1 second
               execute console command "/shot give %name of player% Smite"
       Wait 30 seconds
       set block to redstone lamp
       #to hopefully fix the bug, but unfortunately doesnt work
       Wait 5 ticks
       set block to redstone lamp
       Wait 5 ticks
       set block to redstone lamp

Errors on Reload:

None

Console Errors: (if applicable)

None

Other Useful Info:

Addons using (including versions):
Umbaska 2.0 (Beta 5.5.1), SkRayFall 1.9.3, skUtilities 0.5.5

Troubleshooting:

Have you tried searching the docs? Yes
Have you tried searching the forums? No
What other methods have you tried to fix it? Added code to change the block to stone a few ticks after it was supposed to turn back
 
Status
Not open for further replies.