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.

Getting the player's uuid in a function

Discussion in 'Skript' started by Fguzy, Jan 10, 2021.

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

    Fguzy Member

    Joined:
    Jan 10, 2021
    Messages:
    1
    Likes Received:
    0
    Skript version: 2.5.3-MH
    Minecraft version: 1.16.4
    Code (Text):
    1. on inventory click:
    2.     if event-player has a gui:
    3.         cancel event
    4.  
    5. command /shop:
    6.     trigger:
    7.         send "%{economy::balance::%player's uuid%}%" to player
    8.         show virtual chest inventory with 5 rows named "Shop" to player
    9.         format gui slot 4 of player with gold nugget named "&rBalance: $%{economy::balance::%player's uuid%}%" to do nothing
    10.         format gui slot 19 of player with grass block named "&rBlocks" to close then run function blockMenu(player)
    11.  
    12. function blockMenu(p: player):
    13.     show virtual chest inventory with 5 rows named "Shop - Blocks" to {_p}
    14.     format gui slot 10 of {_p} with grass block to close then run function buy({_p}, grass block, 10)
    15.  
    16.  
    17. function buy(p: player, i: item, c: integer):
    18.     set {amount::%{_p}%} to 1
    19.     show virtual chest inventory with 5 rows named "Shop - Buy" to {_p}
    20.     format gui slot 22 of {_p} with "%{amount::%{_p}%}% %{_i}%" parsed as item with lore "&rPrice: %{_c}%" to do nothing
    21.    
    22.     format gui slot 41 of {_p} with lime glass pane named "&rBuy" to run:
    23.     if {economy::balance::%{_p}'s uuid%} is greater than or equal to {_c} * {amount::%{_p}%}:
    24.         send {economy::balance::%{_p}'s uuid%} to {_p}
    25.  
    26.     format gui slot 39 of {_p} with red glass pane named "&rSell" to run:
    27.         send "no" to {_p}
    28.    
    29.     format gui slot 20 of {_p} with red glass pane named "&rRemove 1" to run:
    30.         addAmount(-1, {_p}, {_i}, {_c})
    31.     format gui slot 24 of {_p} with lime glass pane named "&rAdd 1" to run:
    32.         addAmount(1, {_p}, {_i}, {_c})
    33.     format gui slot 25 of {_p} with lime glass pane named "&rSet to 64" to run:
    34.         setAmount(64, {_p}, {_i}, {_c})
    35.     format gui slot 19 of {_p} with red glass pane named "&rSet to 1" to run:
    36.         setAmount(1, {_p}, {_i}, {_c})
    37.  
    38. function addAmount(a: integer, p: player, i: item, c: integer):
    39.     add {_a} to {amount::%{_p}%}
    40.     if {amount::%{_p}%} is greater than 64:
    41.         set {amount::%{_p}%} to 1
    42.     if {amount::%{_p}%} is less than 1:
    43.         set {amount::%{_p}%} to 64
    44.     format gui slot 22 of {_p} with "%{amount::%{_p}%}% %{_i}%" parsed as item with lore "&rPrice: %{_c} * {amount::%{_p}%}%" to do nothing
    45.  
    46. function setAmount(a: integer, p: player, i: item, c: integer):
    47.     set {amount::%{_p}%} to {_a}
    48.     format gui slot 22 of {_p} with "%{amount::%{_p}%}% %{_i}%" parsed as item with lore "&rPrice: %{_c} * {amount::%{_p}%}%" to do nothing
    https://www.imagebanana.com/s/big/1997/ivLkcaXP.png
    [​IMG]

    *Can't access the console on MH

    Addons:
    [​IMG]

    https://www.imagebanana.com/s/big/1997/o4yWe1Fe.png

    Thr problem is in line 23/24. I want to test if the player has enough money. but I can't get the player's uuid. I also tried to add the uuid as an argument to the function but then it doesn't work at all. No errors. It just doesn't work.

    I have researched everywhere and have been trying for over and hour but I didn't fix it.
     
  2. _XxfedexX_

    _XxfedexX_ Member

    Joined:
    Oct 6, 2020
    Messages:
    29
    Likes Received:
    2
    That is weird...
     
  3. Jakkeren

    Supporter

    Joined:
    Mar 23, 2017
    Messages:
    63
    Likes Received:
    3
    Not very helpful.

    You have to use uuid of {_p} rather than {_p}'s uuid. Tested, working perfectly
     
Thread Status:
Not open for further replies.

Share This Page

Loading...