Solved Messed up function?

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

quick007

New Member
Jul 9, 2020
7
0
1
29
Layout:

Skript Version (do not put latest): Skript Minehut edition
Skript Author: myself
Minecraft Version: 1.16
---
Full Code:
You can see my whole code here, but I tried my best to include the relevant parts below.

Code (Skript):

Code:
            #rankup
                if arg 1 is "rankup":
                    rankupgrade(player)
                    if {economy::rankup::%player%} is true:
                        wait 2 ticks
                        open chest with 3 rows named "&dRank &5Upgrade" to player
                        wait 2 ticks
                        loop integers between 0 and 27 - 1:
                            format slot loop-number of player with gray stained glass pane named "&r" to be unstealable
                        format slot 0 of player with paper named "&fInfo" with lore "&fHere you can upgrade your rank with just one click, assuming you have a high enough balance." to be unstealable
                        format slot 18 of player with Sunflower named "&a%{economy::bal::%player%}% &2Credits" to be unstealable
                        format slot 13 of player with diamond pickaxe named "%{price::%player%}%" to be unstealable
                    else:
                        cancel event


function rankupgrade(p: player):
    set {_prices} to {aminecost}*{rankup::teir::%{_p}%}
    set {price::%{_p}%} to {_prices}
    if {economy::bal::%{_p}%} > {_prices}:
        set {economy::rankup::%{_p}%} to true
    else:
        set {economy::rankup::%{_p}%} to false
(please note that everything was put into triggers, and there were no errors. Also, the name of the pickaxe is supposed to say the cost of the rank, but just outputs 0 atm)




Addons using:

SKbee, skillet, skquery
[doublepost=1594839858,1594777759][/doublepost]t
 
I believe it's because you did {aminecost}*{rankup::teir::%{_p}%}
Also use UUIDs when making player variables.
Also variables in the options have to have @ before them.

Code:
            #rankup
                if arg 1 is "rankup":
                    rankupgrade(player)
                    if {economy::rankup::%player%} is true:
                        wait 2 ticks
                        open chest with 3 rows named "&dRank &5Upgrade" to player
                        wait 2 ticks
                        loop integers between 0 and 27 - 1:
                            format slot loop-number of player with gray stained glass pane named "&r" to be unstealable
                        format slot 0 of player with paper named "&fInfo" with lore "&fHere you can upgrade your rank with just one click, assuming you have a high enough balance." to be unstealable
                        format slot 18 of player with Sunflower named "&a%{economy::bal::%player%}% &2Credits" to be unstealable
                        format slot 13 of player with diamond pickaxe named "%{price::%player%}%" to be unstealable
                    else:
                        cancel event
 
 
function rankupgrade(p: player):
    set {_prices} to {@aminecost} * {rankup::teir::%{_p}%}
    set {price::%{_p}%} to {_prices}
    if {economy::bal::%{_p}%} > {_prices}:
        set {economy::rankup::%{_p}%} to true
    else:
        set {economy::rankup::%{_p}%} to false
 
  • Like
Reactions: quick007
Status
Not open for further replies.