Jump to content

l1j

Member
  • Posts

    2
  • Joined

  • Last visited

Posts posted by l1j

  1. I currently have code that is working fine and all, but everytime the command is run it loops the variable and could easily crash the server if someone were to spam it. I was wondering if anyone knew an alternate way to do this so that it didn't lag the server if someone spammed it but still worked fine.

    command /top balance:
      trigger:
        loop {money::*}:
          add 1 to {_size}
          if {_low.to.high.list::%loop-value%} is not set:
            set {_low.to.high.list::%loop-value%} to loop-index
          else:
            set {_n} to 0
            loop {_size} times:
              set {_n} to {_n}+1
              {_low.to.high.list::%loop-value-1%.%{_n}%} is not set
              set {_low.to.high.list::%loop-value-1%.%{_n}%} to loop-index
              stop loop
        wait 1 tick
        set {_n} to size of {_low.to.high.list::*}
        loop {_low.to.high.list::*}:
          set {_high.to.low.list::%{_n}%} to loop-value
          set {_n} to {_n}-1
        wait 1 tick
        set {_i} to 0
        send "&7&m-----------&8< &6Top10 &8>&7&m-----------"
        loop {_high.to.low.list::*}:
          add 1 to {_topnumber}
          set {_player} to "%loop-value%" parsed as offlineplayer
          send "&7%{_topnumber}% - &c%{_player}% &8» &7$%format({money::%loop-value%})%"
          add 1 to {_i}
          if {_topnumber} > 10:
            stop
        send "&7&m------------------------------"

     

  2. Description

    I'm fairly new to skript, and I've created a command that tells the player how much more of an item they need out of 64

    Steps to Reproduce

    Once the command is run, it'll say "An internal error occurred while attempting to perform this command." to my player, here's the code:

    options:
        amount: 64

    command /antimatter:
      trigger:
        set {_am} to amount of sweet berries named " &4&ki &cAnti-matter berries &4&ki" with lore "&3Trade for anti-matter gens" and " &9&l&kii &6/antimatter &9&l&kii" in player's inventory
        if player has 64 sweet berries named " &4&ki &cAnti-matter berries &4&ki" with lore "&3Trade for anti-matter gens" and " &9&l&kii &6/antimatter &9&l&kii":
          remove 64 of sweet berries named " &4&ki &cAnti-matter berries &4&ki" with lore "&3Trade for anti-matter gens" and " &9&l&kii &6/antimatter &9&l&kii" from player
          give player 1 light gray glazed terracotta named "&b&ki &f&lAnti-Matter Generator &b&ki" with lore "&4Resets every 10 seconds!"
          send "&b&lOculis &8&l» &f&lAnti-Matter &3generator received!"
        else:
          set {_needed} to {@amount} - {_am}
          send "&b&lOculis &8&l» &3You need %{_needed}% more"

    Expected Behavior

    It should send a message to the player that reads "&b&lOculis &8&l» &3You need (64 - however many more you need) more" but, as stated before it says An internal error occurred while attempting to perform this command." instead.

    Errors / Screenshots

    Here's the gist link to the error:
    https://gist.github.com/SmellyEggplant/e4382b0a8b3894f3c3138dbc7713570c

    Server Information

    • Server version/platform: Minehut
    • Skript version: 2.4-beta5-MH (custom version)

    Thanks in advance! 🙂

×
×
  • Create New...