Solved Function 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.

_Jeeper_Creeper_

New Member
Jun 24, 2019
6
0
0
23
I have tried to use functions for the first time, by making an economy skript, but it does not work. Whenever I try to type my /money command then proceed by typing /bal, my balance is <none> and I also don't get the message that is supposed to send in the addMoney function.

Code:
options:
    feedback: &b&lGrinder &3&lFarms &f»&r


function addMoney(p: player , m: number):
    add {_m} to {money::%{_p}%}
    send "%{_p}% %{_m}%" to {_p}

function removeMoney(p: player , m: number):
    if {_m} is less than {money::%player%}:
        subtract {_m} from {money::%{_p}%}
    if {_m} is greater than {money::%player%}:
        send "" to {_p}
        send "{@feedback}&b You &3Don't&b Have Enough &3Money&b!" to {_p}
        send "" to {_p}

command /money [<player>] [<text>] [<text>]:
    trigger:
        if arg-1 is set:
            if arg-2 is "add":
                if arg-3 is an integer:
                    function addMoney(arg-1,arg-3)

command /bal:
    trigger:
        message ""
        message "{@feedback}&b Your Balance is &3%{money::%player%}%"
        message ""
[doublepost=1581216904,1581211877][/doublepost]bump
[doublepost=1581218137][/doublepost]I updated the skript a bit because I found some errors, so here it is. I still have the same issues though :emoji_wink:
Code:
options:
    feedback: &b&lGrinder &3&lFarms &f»&r


function addMoney(p: player, m: number):
    add {_m} to {money::%{_p}%}
    broadcast "%{_p}% %{_m}%"

function removeMoney(p: player, m: number):
    if {_m} is less than {money::%player%}:
        subtract {_m} from {money::%{_p}%}
    if {_m} is greater than {money::%player%}:
        send "" to {_p}
        send "{@feedback}&b You &3Don't&b Have Enough &3Money&b!" to {_p}
        send "" to {_p}

command /money [<player>] [<text>] [<text>]:
    trigger:
        if arg-1 is set:
            if arg-2 is "add":
                addMoney(arg-1, arg-3)

command /bal:
    trigger:
        message ""
        message "{@feedback}&b Your Balance is &3%{money::%player%}%"
        message ""
[doublepost=1581218517][/doublepost]Well, I was being dumb and was ignoring the errors and idk why. LMAO
Its fixed
 
Status
Not open for further replies.