Solved [ 3/3 Fixed ] Variables not working with Skript

  • 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.
@White Nope, I replaced it with an obsidian, and it still not working.
@Donut Updated script (sound not working on slot 13)

code_language.skript:
on inventory click:
    if "%inventory name of player's current inventory%" is "            &0&nPlayer Stats":
        cancel event
        if clicked slot is 13:
            broadcast "test"
            play sound "ITEM_BREAK" to player with volume 3 and pitch 1

on first join:
    set {mysql._joined.%player%} to true
    set {mysql._jtime.%player%} to now
    stop

command /stats [<offline player>]:
    usage: /stats <player>
    trigger:
        arg-1 is not set:
            send "/stats <player>"
            stop
        set {_player} to "%player%"
        if {mysql._joined.%arg-1%} is true:
            arg-1 is set:
                if arg-1 has permission "test.1":
                    open chest with 3 rows named "            &0&nPlayer Stats" to player
                    format slot 13 of player with obsidian named "&c&l&n%arg-1%" with lore "test" to be unstealable
                else if arg-1 has permission "test.2":
                    open chest with 3 rows named "            &0&nPlayer Stats" to player
                    set slot 5 of player's current inventory to feather named "&c&l&n%arg-1%" with lore "%{_amount}%"
        else:
            open chest with 3 rows named "            &0&nPlayer Stats" to player
            set slot 5 of player's current inventory to feather named "&1%arg-1%" with lore "never joined!"

@Donut @White You can see, I even did broadcast "test", and if i click slot 13 with that item in it, it's not going to broadcast the message.
 
Last edited by a moderator:
use:
code_language.skript:
format slot 13 of player with skull of ("%player%" parsed as an offline player) named "&7Skull of %player%" with lore "This is your skull!"
 
code_language.skript:
set slot 13 of player's current inventory to arg-1's skull named "&c&l&n%arg-1%" with lore "test"

It is unstealable because when you check "on inventory click" you cancel the event
 
Okay it works now, thanks!
[doublepost=1496002233,1496002136][/doublepost]@Donut One more thing,
When I check for an offline player, let's say /stats Notch, it won't bring up the GUI saying "player never joined" (last line in script)

Could you help me fix this?
 
You need to add
code_language.skript:
 if {mysql._joined.%arg-1%} is true:
    if arg-1 is not online:
        #show what you want to show when they have joined but are offline
 
@Donut Not working
Not showing the GUI

code_language.skript:
command /stats [<offline player>]:
    usage: /stats <player>
    trigger:
        arg-1 is not set:
            send "/stats <player>"
            stop
        set {_player} to "%player%"
        if {mysql._joined.%arg-1%} is true:
            arg-1 is set:
                if arg-1 is not online:
                    if arg-1 has permission "test.1":
                        open chest with 3 rows named "            &0&nPlayer Stats" to player
                        set slot 13 of player with obsidian named "&c&l&n%arg-1%" with lore "test"
                    else if arg-1 has permission "test.2":
                        open chest with 3 rows named "            &0&nPlayer Stats" to player
                        set slot 5 of player's current inventory to feather named "&c&l&n%arg-1%" with lore "%{_amount}%"
        else:
            open chest with 3 rows named "            &0&nPlayer Stats" to player
            set slot 5 of player's current inventory to feather named "&1%arg-1%" with lore "never joined!"

 
@Donut

So I added in what you said, I did /stats Me, (me, i was online) it didn't bring up the GUI same with the offline player
code_language.skript:
command /stats [<offline player>]:
    usage: /stats <player>
    trigger:
        arg-1 is not set:
            send "/stats <player>"
            stop
        set {_player} to "%player%"
        if {mysql._joined.%arg-1%} is true:
            arg-1 is set:
                if arg-1 is not online:
                    if arg-1 has permission "test.1":
                        open chest with 3 rows named "            &0&nPlayer Stats" to player
                        set slot 13 of player's current inventory to arg-1's skull named "&c&l&n%arg-1%" with lore "just testing!"
                    else if arg-1 has permission "test.2":
                        open chest with 3 rows named "            &0&nPlayer Stats" to player
                        set slot 13 of player's current inventory to arg-1's skull named "&c&l&n%arg-1%" with lore "just testing!2"
        else:
            open chest with 3 rows named "            &0&nPlayer Stats" to player
            set slot 5 of player's current inventory to feather named "&1%arg-1%" with lore "never joined!"
 
It didn't bring up the gui for you because you were supposed to add the "if not online" stuff in addition to what you already had because right now it doesn't do anything if you're online.
 
@Donut Like this?
code_language.skript:
command /stats [<offline player>]:
    usage: /stats <player>
    trigger:
        arg-1 is not set:
            send "/stats <player>"
            stop
        set {_player} to "%player%"
        if {mysql._joined.%arg-1%} is true:
            arg-1 is set:
                if arg-1 is not online:
                    if arg-1 has permission "test.1":
                        open chest with 3 rows named "            &0&nPlayer Stats" to player
                        set slot 13 of player's current inventory to arg-1's skull named "&c&l&n%arg-1%" with lore "just testing!"
                    else if arg-1 has permission "test.2":
                        open chest with 3 rows named "            &0&nPlayer Stats" to player
                        set slot 13 of player's current inventory to arg-1's skull named "&c&l&n%arg-1%" with lore "just testing!2"
                else:
                    if arg-1 has permission "test.1":
                        open chest with 3 rows named "            &0&nPlayer Stats" to player
                        set slot 13 of player's current inventory to arg-1's skull named "&c&l&n%arg-1%" with lore "just testing!"
                    else if arg-1 has permission "test.2":
                        open chest with 3 rows named "            &0&nPlayer Stats" to player
                        set slot 13 of player's current inventory to arg-1's skull named "&c&l&n%arg-1%" with lore "just testing!2"
        else:
            open chest with 3 rows named "            &0&nPlayer Stats" to player
            set slot 5 of player's current inventory to feather named "&1%arg-1%" with lore "never joined!"

It works for /stats Me
but doesn't for /stats MyOfflineAlt
 
Yes. For the offline player does it come up with the never joined gui? or none at all?
[doublepost=1496004282,1496004056][/doublepost]Wait if the gui is the same for offline players and online players you shouldn't need to do that
 
For the offline player (that joined but offline), nothing comes up.
For the offline player (that never joined), the never joined gui comes up.
For the online player, the normal permission gui comes up.
 
If you want the GUIs to be different then keep what you have. If you want them to be the same you can get rid of that whole "if not online" part. Either way I'm guessing the issue is that {mysql_.joined.%arg 1%} is not set for the offline player you are testing so try broadcasting it to see if it's set
 
Status
Not open for further replies.