How to have player run a command with their username in it?

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

ywnjoe

Member
Jan 18, 2022
1
0
1
21
So I'm making a sort of AFK Pool/ AFK Reward system so when the player is standing on a redstone block for an hour, they get a key. They problem with that is I am using the goldencrates plugin. Goldencrates requires you to list the player on who the key is being given to. Is there any way in my code I can make the player execute the command but put their name as an argument. I attached a file showing my code.

Code:
on join:
    while player is online:
        if block under player is block of redstone:
            add 1 to {points::%uuid of player%}
            if {points::%uuid of player%} >= 1:
                remove 1 from {points::%uuid of player%}
                make player run command "crate givekey {%player%} afk" as op
        wait 60 minutes
 

Attachments

  • on join.txt
    342 bytes · Views: 87
Last edited:
Hey! Try using %player% in line 7, rather than {%player%}. Two more things to note is that you can make %player% default to the player's UUID in the config, just to save a little time. You might also want to look into periodical events rather than using "while", since that might get a bit laggy if you end up with a typo somewhere. Hope this helped!
 
Status
Not open for further replies.