Help with checking if player is online in TuSKe GUI's

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

martinn112

Member
Jan 21, 2018
23
0
1
I have an issue with a TuSKe GUI. When inside the GUI it will ALWAYS say the player is offline, but if i do the same outside the GUI, it will say the player is online.

Code:
#This one says the player is offline while they are online
command /test1 [<OfflinePlayer>]:
    trigger:
        if offlineplayer-arg-1 is not set:
            message "NO PLAYER"
        if offlineplayer-arg-1 is set:
            create a gui with virtual chest with 2 rows named "TEST":
                make gui 0 with glowstone named "TEST":
                    if offlineplayer-arg-1 is online:
                        close player's inventory
                        message "PLAYER IS ONLINE"
                        stop
                    if offlineplayer-arg-1 is offline:
                        close player's inventory
                        message "PLAYER IS OFFLINE"
                        stop
            open last gui to player

#This one says the player is online while they are online           
command /test2 [<OfflinePlayer>]:
    trigger:
        if offlineplayer-arg-1 is not set:
            message "NO PLAYER"
        if offlineplayer-arg-1 is set:
            if offlineplayer-arg-1 is online:
                close player's inventory
                message "PLAYER IS ONLINE"
                stop
            if offlineplayer-arg-1 is offline:
                close player's inventory
                message "PLAYER IS OFFLINE"
                stop
 
What the hell.... offlineplayer-arg-1 ??? That is absolutely wrong, try this:

Code:
command /test1 [<offline player>]:
    trigger:
        set {_player} to arg-1 parsed as player
        if arg-1 is not set:
            send "&cUsage: /test1 <player>"
        else if arg-1 is set:
            create a gui with virtual chest with 2 rows named "TEST":
                make gui 0 with glowstone named "TEST":
                    if {_player} is online:
                        close player's inventory
                        message "PLAYER IS ONLINE"
                        stop
                    if {_player} is offline:
                        close player's inventory
                        message "PLAYER IS OFFLINE"
                        stop
            open last gui to player
          
command /test2 [<offline player>]:
    trigger:
        if arg-1 is not set:
            send "&cUsage: /test2 <player>"
        # code idk what else
 
I believe it will work, it already checks if the player is offline or online.
 
The code you provided, it says arg-1 is not a Text. I presume it means the command /test [<OfflinePlayer>], where arg-1 is not a text
 
Idk why you're using variables.
Code:
command /test1 [<offline player>]:
    trigger:
        if arg-1 is set:
            create a gui with virtual chest with 2 rows named "TEST":
                make gui 0 with glowstone named "TEST":
                    if arg-1 is online:
                        close player's inventory
                        message "PLAYER IS ONLINE"
                    else:
                        close player's inventory
                        message "PLAYER IS OFFLINE"

            open last gui to player
        else:
            message "Incorrect usage."
 
That code is still an issue, it still says the player ALWAYS is offline. I tried it with a random name, it says offline, Good. But then i tried my own name. Player is offline. Thats the issue
 
That code is still an issue, it still says the player ALWAYS is offline. I tried it with a random name, it says offline, Good. But then i tried my own name. Player is offline. Thats the issue
it works without problems for me, idk whats the issue.
 
Try this:
Code:
command /test1 [<text>]:
    trigger:
        if arg-1 is set:
            create a gui with virtual chest with 2 rows named "TEST":
                make gui 0 with glowstone named "TEST":
                    if arg-1 parsed as player is online:
                        close player's inventory
                        message "PLAYER IS ONLINE"
                    else:
                        close player's inventory
                        message "PLAYER IS OFFLINE"
 
            open last gui to player
        else:
            message "Incorrect usage."
 
Nope, still says i'm offline
Code:
command /test1 [<offline player>]:
    trigger:
        if arg-1 is set:
            set {_check} to true if arg-1 is online
            create a gui with virtual chest with 2 rows named "TEST":
                make gui 0 with glowstone named "TEST":
                    if {_check} is set:
                        close player's inventory
                        message "PLAYER IS ONLINE"
                    else:
                        close player's inventory
                        message "PLAYER IS OFFLINE"
 
            open last gui to player
        else:
            message "Incorrect usage."
Try that
 
I'm using Skript2.2dev36 and im using paperspigot, but i am unsure about version but i know it's minecraft 1.8.8
 
I'm using Skript2.2dev36 and im using paperspigot, but i am unsure about version but i know it's minecraft 1.8.8
This should work with that version

Code:
command /test1 [<offline player>]:
    trigger:
        if arg-1 is set:
            if arg-1 is online:
                set {_check} to true
            create a gui with virtual chest with 2 rows named "TEST":
                make gui 0 with glowstone named "TEST":
                    if {_check} is set:
                        close player's inventory
                        message "PLAYER IS ONLINE"
                    else:
                        close player's inventory
                        message "PLAYER IS OFFLINE"
 
            open last gui to player
        else:
            message "Incorrect usage."
 
Status
Not open for further replies.