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 give and argument

Discussion in 'Skript' started by Qurao, Jul 17, 2020.

Tags:
Thread Status:
Not open for further replies.
  1. Qurao

    Qurao New Member

    Joined:
    Jul 10, 2020
    Messages:
    7
    Likes Received:
    0
    I am trying to write a code to transfer gold nuggets between players.

    I am trying to write a code to transfer gold nuggets between players

    I tried to enter a code like this through the code, but it didn't work:

    give arg-1 gold nuggets to arg-2

    I had to stop at such a solution. What can be done since this decision is clearly bad?


    make console execute command "give %arg-2% gold_nugget %arg-1%"
    make console execute command "clear %player% gold_nugget %arg-1%"


    Full code:


    command /pay <number> <player>:
    trigger:
    if number of gold nuggets in the player's inventory >= arg-1:
    if distance between player and arg-2 is smaller than 5:
    send "§9Вы передали %{rpname.%arg-2%}% %arg-1% §9золотых"
    send "§9 %{rpname.%player%}% передал вам %arg-1% §9золотых" to arg-2
    make console execute command "give %arg-2% gold_nugget %arg-1%"
    make console execute command "clear %player% gold_nugget %arg-1%"
    else:
    send "§4Игрок слишком далеко!"
    else:
    send "§4Недостаточно золотых!"
     
  2. Best Answer:
    Post #2 by couger44, Jul 18, 2020
  3. couger44

    Supporter

    Joined:
    Feb 19, 2017
    Messages:
    714
    Likes Received:
    31
    Try something like this:
    Code (Skript):
    1. command /pay <number> <player>:
    2.     trigger:
    3.         if number of golden nuggets in the player's inventory >= arg 1:
    4.             if distance between player and arg 2 < 5:
    5.                 send "§9Вы передали %{rpname.%arg 2%}% %arg 1% §9золотых"
    6.                 send "§9 %{rpname.%player%}% передал вам %arg 1% §9золотых" to arg 2
    7.                 set {_int} to arg 1
    8.                 give {_int} of golden nugget to arg 2
    9.                 remove {_int} of golden nugget from player's inventory
    10.             else:
    11.                 send "§4Игрок слишком далеко!"
    12.         else:
    13.             send "§4Недостаточно золотых!"
    And send the message error, please.
     
  4. Qurao

    Qurao New Member

    Joined:
    Jul 10, 2020
    Messages:
    7
    Likes Received:
    0
    Thank you, that work)
     
  5. couger44

    Supporter

    Joined:
    Feb 19, 2017
    Messages:
    714
    Likes Received:
    31
    You're welcome, remember make the post as solved.
     
Thread Status:
Not open for further replies.

Share This Page

Loading...