Solved Weird error

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

verycoolguy123

Active Member
Jul 31, 2017
70
2
0
54
I keep getting the exception "There is no player argument in this command" when I set it to offlineplayer instead of just player. Here is my code:
code_language.skript:
command /ping [<offlineplayer>]:
    trigger:
        if arg-1 is not set:
            send "&6Your ping is &e%player's ping%ms"
        else:
            if arg-1 is offline:
                send "&c%arg-1% is not online"
            else:
                if arg-1 is player:
                    send "&6Your ping is &e%player's ping%ms"
                else:
                    if player's ping > player-arg-1's ping:
                        set {_difference.%player%} to player's ping - player-arg's ping
                    else:
                        if player-arg-1's ping > player's ping:
                            set {_difference.%player%} to difference between player-arg's ping and player's ping
                    send "&6%arg-1%'s ping is &e%player-arg-1's ping%ms &7&o(Difference: %{_difference.%player%}%ms)"
 
What you mean with that? When the server doesn't have players in addition to the command executor?
If I did /ping (player) but that player isn't online, it shows an error message. I don't like the default skript error message, so how would I be able to change it?
 
If I did /ping (player) but that player isn't online, it shows an error message. I don't like the default skript error message, so how would I be able to change it?

Oh you mean the red message: This player isn't online etc etc.
Im sorry , that i know this can not be changed.
 
Can you give me an example of that?
In this way you should bypass the error message.
code_language.skript:
command /ping [<offlineplayer>]:
    trigger:
        if arg-1 is not set:
            send "&6Your ping is &e%player's ping%ms"
        else:
            set {_player} to "%arg-1%" parsed as player
            if {_player} isn't online:
                send "&c%arg-1% is not online"
            else:
                if arg-1 is player:
                    send "&6Your ping is &e%player's ping%ms"
                else:
                    if player's ping > player-arg-1's ping:
                        set {_difference.%player%} to player's ping - player-arg's ping
                    else:
                        if player-arg-1's ping > player's ping:
                            set {_difference.%player%} to difference between player-arg's ping and player's ping
                    send "&6%arg-1%'s ping is &e%player-arg-1's ping%ms &7&o(Difference: %{_difference.%player%}%ms)"
 
In this way you should bypass the error message.
code_language.skript:
command /ping [<offlineplayer>]:
    trigger:
        if arg-1 is not set:
            send "&6Your ping is &e%player's ping%ms"
        else:
            set {_player} to "%arg-1%" parsed as player
            if {_player} isn't online:
                send "&c%arg-1% is not online"
            else:
                if arg-1 is player:
                    send "&6Your ping is &e%player's ping%ms"
                else:
                    if player's ping > player-arg-1's ping:
                        set {_difference.%player%} to player's ping - player-arg's ping
                    else:
                        if player-arg-1's ping > player's ping:
                            set {_difference.%player%} to difference between player-arg's ping and player's ping
                    send "&6%arg-1%'s ping is &e%player-arg-1's ping%ms &7&o(Difference: %{_difference.%player%}%ms)"
that didn't exactly fix the issue, but it helped me to fix it. here is how i did it.
code_language.skript:
command /ping [<offlineplayer>]:
    trigger:
        if arg-1 is not set:
            send "&6Your ping is &e%player's ping%ms"
        else:
            if arg-1 is offline:
                send "&c%arg-1% is not online"
                stop trigger
            else:
                if arg-1 is player:
                    send "&6Your ping is &e%player's ping%ms"
                else:
                    if player's ping > offlineplayer-arg-1's ping:
                        set {_difference.%player%} to player's ping - offlineplayer-arg's ping
                    else:
                        if offlineplayer-arg-1's ping > player's ping:
                            set {_difference.%player%} to difference between offlineplayer-arg's ping and player's ping
                    send "&6%arg-1%'s ping is &e%offlineplayer-arg-1's ping%ms &7&o(Difference: %{_difference.%player%}%ms)"
wait isnt the error happening because youre using player-arg and not offlineplayer-arg
kind of, yes
 
that didn't exactly fix the issue, but it helped me to fix it. here is how i did it.
code_language.skript:
command /ping [<offlineplayer>]:
    trigger:
        if arg-1 is not set:
            send "&6Your ping is &e%player's ping%ms"
        else:
            set {_player} to "%arg-1%" parsed as player
            if arg-1 is offline:
                send "&c%arg-1% is not online"
                stop trigger
            else:
                if arg-1 is player:
                    send "&6Your ping is &e%player's ping%ms"
                else:
                    if player's ping > offlineplayer-arg-1's ping:
                        set {_difference.%player%} to player's ping - offlineplayer-arg's ping
                    else:
                        if offlineplayer-arg-1's ping > player's ping:
                            set {_difference.%player%} to difference between offlineplayer-arg's ping and player's ping
                    send "&6%arg-1%'s ping is &e%offlineplayer-arg-1's ping%ms &7&o(Difference: %{_difference.%player%}%ms)"

kind of, yes

It was just an example , good to hear that you worked around it.
 
Just because their solved doesn't mean it's a good solution, you can always make it better and that isn't a rule
Coming up with a better solution, sure. Always a good thing. But you don't have to be so rude about it. Almost all of your comments are so condescending. Everyone here is learning, and everyone learns at a different level. Just because they don't arrive at the best solution first does not mean they've earned your scorn.
Be constructive, not hurtful:emoji_slight_smile:
 
Coming up with a better solution, sure. Always a good thing. But you don't have to be so rude about it. Almost all of your comments are so condescending. Everyone here is learning, and everyone learns at a different level. Just because they don't arrive at the best solution first does not mean they've earned your scorn.
Be constructive, not hurtful:emoji_slight_smile:
I tend to be cunty on the forums
 
Status
Not open for further replies.