Random money giver

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

    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.

SoMuchWessel

Active Member
Apr 3, 2017
147
3
18
Hey guys,

Im trying to make a command which gives the player a random amount of money. This is the code i currently have:

code_language.skript:
command /addmoney:
    trigger:
        set {%player%.money} to random integer between 1 and 5000
        add %{%player%.money} to the player's balance

But the problem is that it isnt working. Can you guys help me out?
 
get rid of the percent sign in front of {%player%.money} in line 4
 
code_language.skript:
options:
    min.money: 17
    max.money: 170

function addMoneyRandom(player:player, min:integer, max:integer) :: integer:
        set {_min} to random integer between {_min} and {_max}
        add {_min} to the {_player}'s balance
        return {_min}

command addmoney [<integer>] [<integer>]:
    trigger:
        if arg-1 is set:
            message "your current balance %player's balance% dollars(+%addMoneyRandom(player,arg-1 and arg-2%)"
        else:
            message "your current balance %player's balance% dollars(+%addMoneyRandom(player,{@min.money} and {@max.money})%)"
requirements: vault and any money plugin.

p.s. don't worry)
 
Status
Not open for further replies.