Getting the player's uuid in a function

  • 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.

Fguzy

Member
Jan 10, 2021
1
0
1
25
Skript version: 2.5.3-MH
Minecraft version: 1.16.4
Code:
on inventory click:
    if event-player has a gui:
        cancel event

command /shop:
    trigger:
        send "%{economy::balance::%player's uuid%}%" to player
        show virtual chest inventory with 5 rows named "Shop" to player
        format gui slot 4 of player with gold nugget named "&rBalance: $%{economy::balance::%player's uuid%}%" to do nothing
        format gui slot 19 of player with grass block named "&rBlocks" to close then run function blockMenu(player)

function blockMenu(p: player):
    show virtual chest inventory with 5 rows named "Shop - Blocks" to {_p}
    format gui slot 10 of {_p} with grass block to close then run function buy({_p}, grass block, 10)


function buy(p: player, i: item, c: integer):
    set {amount::%{_p}%} to 1
    show virtual chest inventory with 5 rows named "Shop - Buy" to {_p}
    format gui slot 22 of {_p} with "%{amount::%{_p}%}% %{_i}%" parsed as item with lore "&rPrice: %{_c}%" to do nothing
   
    format gui slot 41 of {_p} with lime glass pane named "&rBuy" to run:
    if {economy::balance::%{_p}'s uuid%} is greater than or equal to {_c} * {amount::%{_p}%}:
        send {economy::balance::%{_p}'s uuid%} to {_p}

    format gui slot 39 of {_p} with red glass pane named "&rSell" to run:
        send "no" to {_p}
   
    format gui slot 20 of {_p} with red glass pane named "&rRemove 1" to run:
        addAmount(-1, {_p}, {_i}, {_c})
    format gui slot 24 of {_p} with lime glass pane named "&rAdd 1" to run:
        addAmount(1, {_p}, {_i}, {_c})
    format gui slot 25 of {_p} with lime glass pane named "&rSet to 64" to run:
        setAmount(64, {_p}, {_i}, {_c})
    format gui slot 19 of {_p} with red glass pane named "&rSet to 1" to run:
        setAmount(1, {_p}, {_i}, {_c})

function addAmount(a: integer, p: player, i: item, c: integer):
    add {_a} to {amount::%{_p}%}
    if {amount::%{_p}%} is greater than 64:
        set {amount::%{_p}%} to 1
    if {amount::%{_p}%} is less than 1:
        set {amount::%{_p}%} to 64
    format gui slot 22 of {_p} with "%{amount::%{_p}%}% %{_i}%" parsed as item with lore "&rPrice: %{_c} * {amount::%{_p}%}%" to do nothing

function setAmount(a: integer, p: player, i: item, c: integer):
    set {amount::%{_p}%} to {_a}
    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
jJBcVzK


*Can't access the console on MH

Addons:
qn6jbgS


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.
 
Status
Not open for further replies.