1. 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!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved if %player's money% is greater or equal to 2000:

Discussion in 'Skript' started by AndrewKopera, Mar 20, 2021.

Thread Status:
Not open for further replies.
  1. AndrewKopera

    AndrewKopera Member

    Joined:
    Mar 18, 2021
    Messages:
    18
    Likes Received:
    0
    Skript version: 2.5.3
    Server version:git-paper-529
    Addons:Skellett v1.9.11, skRayFall v1.9.23, SkQuery v4.1.4, TuSKe v1.8.2, SharpSK v1.6.4

    Hello, I am making a skript that you can buy someone out of jail. I have it almost done but i need to add money check. I added if %player's money% is greater or equal to 2000 but it says: "cant compare %player's money% with an integer. I have vault installed but it doesnt work.

    Thanks for your help.
    Code (Text):
    1. command /buyout <player>:
    2.     trigger:
    3.         if arg 1 is not set:
    4.             send "&eYou have to write player's name." to player
    5.             stop
    6.         if arg 1 is set:
    7.             if %player's money% is greater than or equal to 2000:
    8.                 send "&aYou have rescued  %arg 1% from jail." to player
    9.                 make server execute command "eco take %player% 2000"
    10.                 make server execute command "unjail %arg 1%"
    11.                 stop
    12.             if %player's money% is lesser than or equal to 1999:
    13.                 send "&eYou dont have enough money.."
    14.                 stop
    15.  
    Solved:
    Instead of %player's money% put player's balance without %.
    for the if player's balance is lesser than or equal to 1999 dont put it there put: else :emoji_grinning:

    New code looks like this:
    Code (Text):
    1. command /buyout <player>:
    2.     trigger:
    3.         if arg 1 is not set:
    4.             send "&eYou have to write name of the player." to player
    5.             stop
    6.         if arg 1 is set:
    7.             if player's balance is greater than or equal to 2000:
    8.                 send "&aYou've rescued %arg 1%" to player
    9.                 make server execute command "eco take %player% 2000"
    10.                 make server execute command "unjail %arg 1%"
    11.                 stop
    12.             else:
    13.                 send "&eYou dont have enough money." to player
    14.                 stop
    15.  
     
    #1 AndrewKopera, Mar 20, 2021
    Last edited: Mar 21, 2021
  2. Orangesanta8415

    Supporter

    Joined:
    Nov 21, 2020
    Messages:
    40
    Likes Received:
    0
    What economy plugin are you using?
     
  3. AndrewKopera

    AndrewKopera Member

    Joined:
    Mar 18, 2021
    Messages:
    18
    Likes Received:
    0
    what economy plugins are there? I really dont know. I started working on a minecraft server when my developer left. Is it possible that shopguiplus works if i dont have economy plugin? Also i can do cmd /eco give. Is Vault economy plugin?

    Thanks for help.
     
  4. Orangesanta8415

    Supporter

    Joined:
    Nov 21, 2020
    Messages:
    40
    Likes Received:
    0
    It sounds like you use vault, I can’t test this because I’m in bed right now, I may be able to help you further in the morning but instead of using percents use balance. E.g:

    if player’s balance is greater than 2000:

    idk Soz if it no work
     
  5. AndrewKopera

    AndrewKopera Member

    Joined:
    Mar 18, 2021
    Messages:
    18
    Likes Received:
    0
    Thank you so much. It works now. But i have another problem now. This code doesnt work. It says: cant compare a money with ('lesser than' or 'equal to 1999'. How do i fix this?
    Code (Text):
    1. if player's balance is lesser than or equal to 1999:
    2.     send "&eYou dont have enough money."
    3.     stop
    4.  
     
  6. Killerz1243

    Killerz1243 Active Member

    Joined:
    Oct 31, 2019
    Messages:
    78
    Likes Received:
    7
    Code (Text):
    1. less than or equal to
    change lesser to less
     
  7. AndrewKopera

    AndrewKopera Member

    Joined:
    Mar 18, 2021
    Messages:
    18
    Likes Received:
    0
    I forgot to edit my post. I have just put "else:" there.
     
Thread Status:
Not open for further replies.

Share This Page

Loading...