Jump to content

Znyx

Member
  • Posts

    11
  • Joined

  • Last visited

Posts posted by Znyx

  1. I didn't make any loop in my example, here's how it might look with one:

    on server start:
    	set {allowed_block} to stone
    	wait 5 minutes
    	set {allowed_block} to coal ore
    	execute console command "sk reload <filename>"
    
    on break:
    	if event-block isn't {allowed_block}:
    		cancel event
    		send "&cThe current phase is &f%{allowed_block}%&c!" to player

    That would probably work, but I would recommend doing something like this instead:

    on server start:
    	set {allowed_block} to stone
    
    loop every 5 minutes:
    	if {allowed_block} is stone:
    		set {allowed_block} to coal ore
    	else if {allowed_block} is coal ore:
    		set {allowed_block} to iron ore
    	else if {allowed_block} is iron ore:
    		set {allowed_block} to stone # Resets the blocks
    	send "&cThere's now a new phase!" to all players
    
    on break:
    	if event-block isn't {allowed_block}:
    		cancel event
    		send "&cThe current phase is &f%{allowed_block}%&c!" to player

     

  2. on join:
    	set {_loc} to location at (0, 67, 0) in world "world"
    	set yaw of {_loc} to 90 # Edit the number here to change the yaw
    	set pitch of {_loc} to 0 # Edit the number here to change the pitch
    	teleport player to {_loc}

     

  3. I'm not sure how to do this, but here's a function that might do the trick. I haven't tested it though.

    function check_shulkers(p: player, i: item) :: boolean:
    	if {_p} is holding a shulker box:
    		loop (held item of {_p})'s inventory:
    			if loop-value is {_i}:
    				return true
    		return false

    To call the function, just do:

    check_shulker(player, item)
    
    # Player is the player whos inventory you wanna check.
    
    # Item is the item that you'll check if inside the shulker box.

    The function will then return `false` or `true` whether or not the item is inside the held shulker box.

  4. This is possible for sure! You could try something like this:

    on server start:
    	set {allowed_block} to stone
    	wait 5 minutes
    	set {allowed_block} to coal ore
    
    on break:
    	if event-block isn't {allowed_block}:
    		cancel event
    		send "&cThe current phase is &f%{allowed_block}%&c!" to player

    If you want to restart the timer you could just reload the skript, like this:

    Quote

    /sk reload <filename>.sk

    Of course it could be done using other types of loops, but this might be the easiest way.

  5. Hi! Here, this might work. Please note that I haven't tested it though.

    function openCrate(p: player):
    	set metadata tag "crateGUI" of {_p} to chest inventory with 3 rows named "NAME OF CHEST"
    	set slot 14 of metadata tag "crateGUI" of {_p} to tripwire hook named "&aClick to claim"
    	open (metadata tag "crateGUI" of {_p}) to {_p}
    
    on inventory click:
        if event-inventory = (metadata tag "crateGUI" of player):
            cancel event
    
    	if index of event-slot is 14:
    		if {claimed::%player's uuid%} is set:
    			send "&cYou have already claimed this!" to player
    			exit
    		send "&aYou claimed it!" to player
    		give 1 stone to player

    There might be a better way to do this, but still, this probably works. No addons required either.

  6. command /setspawn:
    	aliases: setlobby
    	permission: spawn.set
    	trigger:
    		set {spawn} to player's location
    		send "&aSpawn has successfully been set to your location!" to player
    		play sound "minecraft:blocks.note_block.pling" for player
    
    command /spawn [<player>]:
    	aliases: lobby
      	trigger:
      		if {spawn} isn't set:
      			send "&cSpawn hasn't been set!" to player
      			play sound "minecraft:blocks.note_block.didgeridoo" for player
      
      		if arg-1 is set:
      			if arg-1 isn't online:
      				send "&cThat's not a player!" to player
      				play sound "minecraft:blocks.note_block.didgeridoo" for player
      
      			if player has permission "spawn.tpothers":
      				teleport arg-1 to {spawn}
      				send "&aYou have been teleported to spawn by &f%player%&a." to arg-1
      				send "&aSuccessfully teleported &f%arg-1%&a to spawn!" to player
      				play sound "minecraft:blocks.note_block.pling" for player and arg-1
      			else:
      				send "&cYou do not have the permission to teleport others to spawn!" to player
      				play sound "minecraft:blocks.note_block.didgeridoo" for player
      			exit
      
      		teleport player to {spawn}
      		send "&aYou have been teleported to spawn!" to player
      		play sound "minecraft:blocks.note_block.pling" for player

    Sure you could do it a bit better, but I included some sounds and stuff. Haven't tried it tho.

  7. When you're adding the items to the list you're adding strings, not items. Also, I belive that the swords variable is local and not global which means you can't access the sword variable from the sword command. I might be wrong on that though, I'm quite new to skript. 

    I would belive this works:

    on load:
    	set {swords::*} to diamond sword, iron sword and stone sword
    
    command /sword:
    	trigger:
    		set {_random} to a random element of {swords::*}
    		give {_random} to player
    		send "&cHere's a random sword!" to player
  8. I've noticed that a lot of autosmelt scripts are very long, especially the ones with fortune.
    If you find any problems with the code, please comment it. 🙂


    Requirements:

    - Skript

    Features:

    - Autosmelt

    - Fortune Support

    - Autopickup

    on mine:
    	cancel drops
    	set {_amount} to item amount of (first element of (drops of event-block using player's tool))
    				
    	if event-block is iron ore:
    		give player {_amount} of iron ingot
    	elif event-block is gold ore:
    		give player {_amount} of gold ingot
    	elif event-block is stone:
    		give player {_amount} of stone
    	elif event-block is ancient debris:
    		give player {_amount} of netherite scraps
    
    	else:
    		give player drops of event-block using player's tool

    If you find the code useful please consider leaving a reaction.

  9. Block Regeneration to a RPG-Server.

    Hello, I'm not very experienced in coding with skript so I would need some help with this.

    • When the block first is mined the code should cancel the event and replace the block with bedrock. + It should give the user the block that was mined.
    • It should then wait a few seconds: stone 30, coal, 1 minute, iron 2 minutes.
    • When the timer is up the block should get regenerated.

     


    Please note that this should be for over 10 different blocks.
    Here is what I first made:

    on break coal ore:    
        if gamemode of player is survival:      
            wait 3 ticks
            set event-block to bedrock
            wait 60 seconds
            set event-block to stone               
    
    on break stone:    
        if gamemode of player is survival:      
            wait 3 ticks
            set event-block to bedrock
            wait 30 seconds
            set event-block to stone

    However that gets really big when there's a lot of blocks, so I then thought something like this might work:

    options:
        Blacklist: Stone and Iron ore
    
    lst = [("stone", 30), ("Iron Ore", 60)]
    
    on break:
        if {@Blacklist} contains event-block:
            wait 3 ticks
            set event-block to bedrock
            wait lst[1] seconds
            set event-block to lst[0]

    The problem with this is that I don't know if you can assign arrays with tuples, and then do array[1] on it.

    If anyone knows how to solve this, or if they know an even better solution I would really appreciate it!

     

×
×
  • Create New...