Solved Skript Problems I Need Help!

  • 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.
Feb 25, 2017
21
1
0
23
Hey so I have this mobcoins skript and it all works except for adding the mobcoins to their coin balance:


code_language.skript:
command /coins [<text>] [<player>] [<number>]:
    trigger:
        if arg 1 is not set:
            send "{@P}"
            send "&7&oYour coins balance is:"
            send ""
            send "&bCoins &3» &f%{coins.%player%}%"
        if arg 1 is "help":
            if player has permission "{@Perm}":
                send "{@P}"
                send "&7&oHere you can view the commands!"
                send ""
                send "&b/coins give (player) (number)"
                send "&b/coins view (player)"
                send "&b/coins remove (player) (number)"
                send "&b/coins reset (player)"
                send "&b/coins shop"
                send "&b/coins transfer"               
                send "{@UP}"               
        if arg 1 is "give":
            if player has permission "{@Perm}":
                send "{@P}"
                send "&7&oPlease give an &aIGN &7and a &aNumber!"
                send ""
                send "{@UP}"
            if arg 2 is set:   
                if player has permission "{@Perm}":
                    send "{@P}"
                    send "&7&oPlease give a &anumber!"
                    send ""
                    send "{@UP}"   
                if arg 3 is set:
                    if player has permission "{@Perm}":
                        add number arg to {coins.%arg-2%}
                        send "{@P}"
                        send "&7&oSuccess you have given a player coins!"
                        send ""
                        send "&a%arg-2% &7has been given &a%number arg%"
                        send "{@UP}"                   
                        send "{@P}" to arg-2
                        send "&7&oYou have been given coins" to arg-2
                        send "" to arg-2
                        send "&a%player% &7has given you &a%number arg% &7coins" to arg-2
                        send "{@UP}" to arg-2                       
            if player does not have permission "{@Perm}":
                send "&8(&c&l!&8)  &cYou don't have permission to run this command."
        if arg 1 is "view":
            send "{@P}"
            send "&7&oPlease give a &aname!"
            send ""
            send "{@UP}"
            if arg 2 is set:
                send "{@P}"
                send "&7&oHere you can see &a%arg-2% &7coins"
                send ""
                send "&bCoins &3» &f%{coins.%arg-2%}%"
        if arg 1 is "remove":
            if player has permission "{@Perm}":
                send "{@P}"
                send "&7&oPlease give an &aIGN &7and a &aNumber!"
                send ""
                send "{@UP}"               
            if arg 2 is set:   
                if player has permission "{@Perm}":
                    send "{@P}"
                    send "&7&oPlease give a &anumber!"
                    send ""
                    send "{@UP}"
                if arg 3 is set:
                    if player has permission "{@Perm}":
                        remove number arg from {coins.%arg-2%}
                        send "{@P}"
                        send "&7&oSuccess you have removed coins from a player!"
                        send ""
                        send "&a%arg-2% &7has lost &a%number arg%"
                        send "{@UP}"                   
                        send "{@P}" to arg-2
                        send "&7&oCoins have been taken from your account!" to arg-2
                        send "" to arg-2
                        send "&a%player% &7has taken &a%number arg% &7coins. &7Your balance is now &a%{coins.%arg-2%}%" to arg-2
                        send "{@UP}" to arg-2                       
            if player does not have permission "{@Perm}":
                send "&8(&c&l!&8)  &cYou don't have permission to run this command."   
        if arg 1 is "reset":       
            if player has permission "{@Perm}":
                send "{@P}"
                send "&7&oPlease give an &aIGN!"
                send ""
                send "{@UP}"
            if arg 2 is set:   
                if player has permission "{@Perm}":
                    send "{@P}"
                    send "&7&oPlease give a &anumber!"
                    send ""
                    send "{@UP}"               
                if arg 3 is set:
                    if player has permission "{@Perm}":
                        set {coins.%arg-2%} to 0
                        send "{@P}"
                        send "&7&oSuccess you have reset a players coin balance!"
                        send ""
                        send "&a%arg-2% &7has had their coins reset!"
                        send "{@UP}"
                        send "{@P}" to arg-2
                        send "&7&oYour coins balance has been reset!" to arg-2
                        send "" to arg-2
                        send "&a%player% &7has reset your balance!" to arg-2
                        send "{@UP}" to arg-2

code_language.skript:
        if arg 1 is "transfer":
            set {_mobcoins} to number of sunflower named "MobCoin" in player's inventory
            add {_mobcoins} to {coins.%arg-2%}
            remove {_mobcoins} of sunflower named "MobCoin" from player's inventory
            send "&6You just got &c%{_mobcoins}% Coins!"
 
Last edited:
Just saying that the send/broadcast effect support multiple strings & entities, so you can do the following instead of use the send effect multiple times:
code_language.skript:
send "{@P}", "&7Your balance is:", "" and "&bCoins &3» &f%{coins.%player%}%"
Also, I would use a list variable for save the coins of the player.
 
Status
Not open for further replies.