Jump to content

Random Player Money Giver


JustDogYT

Recommended Posts

I am trying to make a skript that gives a random player in a region a certain amount of money.

This is my code so far

command moneyDrop <number>:
    trigger:
        if "%region at player%" contains "golddrop":
            set {random} to a random element out of all players
            add %arg-1% to {random} player
 

I am not sure whats wrong i am new to skript.

 

Edited by 1Dog_
Grammer
Link to comment
Share on other sites

  • JustDogYT changed the title to Random Player Money Giver
1 hour ago, 1Dog_ said:

I am trying to make a skript that gives a random player in a region a certain amount of money.

This is my code so far

command moneyDrop <number>:
    trigger:
        if "%region at player%" contains "golddrop":
            set {random} to a random element out of all players
            add %arg-1% to {random} player
 

I am not sure whats wrong i am new to skript.

 

This is probably what you tried to do:

command moneyDrop <number>:
    trigger:
        if "%region at player%" contains "golddrop":
            set {_random} to a random element out of all players
            add arg-1 to balance of {_random}

Here are the thing which were wrong with your code:

-> If you want to access variables directly within a trigger or event, use local variables. Local variables are not permanent and are only available with-in the trigger or event. A local variable starts with an underscore. E.g. {_hello}, {_variable}, etc.

-> You do not use % in add %arg-1% to... sign to represent variables or values within skript syntax. Just type it out as such: add arg-1 to...

 

Anyways, happy learning, enjoy!

Hello there! If you're reading this, hope you're having a wonderful day!

 

Feel free to contact me via Discord (CoolProgrammer#1920) for any help.

My DMs are always open for help.

You can also message via. forum messages for help.

1604908226_ScreenShot2021-01-28at10_32_28AM.png.2646ad6be239a9d0756a99e8e15602ab.png

Also, don't hesitate to leave a like on my post if I helped you in any way.

Link to comment
Share on other sites

2 hours ago, 1Dog_ said:

Thanks so much!!!

No problem, anytime.

Hello there! If you're reading this, hope you're having a wonderful day!

 

Feel free to contact me via Discord (CoolProgrammer#1920) for any help.

My DMs are always open for help.

You can also message via. forum messages for help.

1604908226_ScreenShot2021-01-28at10_32_28AM.png.2646ad6be239a9d0756a99e8e15602ab.png

Also, don't hesitate to leave a like on my post if I helped you in any way.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...