Weird issue with prefixes

  • 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
53
I'm trying to make a /msg skript but I get <none> when I include prefixes in /r sometimes and other times it doesn't even work. What's wrong with my code?
code_language.skript:
command /msg [<offlineplayer>] [<text>]:
    aliases: /m, /tell, /t, /w, /m
    trigger:
        if {chat.private.reply.%player%} is not set:
            send "&cYou have not messaged a player recently"
            stop trigger
        if arg-1 is offline:
            send "&c%arg-1% is not online"
            stop trigger
        if arg-1 is not set:
            send "&cPlease specify a player"
            stop trigger
        if arg-2 is not set:
            send "&cPlease specify a message"
            stop trigger
        else:
            set {chat.private.reply.%player%} to arg-1
            set {chat.private.reply.%arg-1%} to player
            set {chat.private.reply.prefix.%player%} to coloured {chat.private.reply.%player%}'s prefix
            send "&7(To %coloured arg-1's prefix%%arg-1%&7) %arg 2%" to player
            send "&7(From %coloured player's prefix%%player%&7) %arg 2%" to arg-1

command /r [<text>]:
    aliases: /reply
    trigger:
        if {chat.private.reply.%player%} is not set:
            send "&cYou have not messaged a player recently"
            stop trigger
        else:
            if arg-1 is not set:
                send "&cPlease specify a message"
                stop trigger
            if {chat.private.reply.%player%} is offline:
                send "&c%{chat.private.reply.%player%}% recently went offline"
                stop trigger
            else:
                send "&7(To %{chat.private.reply.prefix.%player%}%%{chat.private.reply.%player%}%&7) %arg-1%" to player
                send "&7(From %coloured player's prefix%%player%&7) %arg-1%" to {chat.private.reply.%player%}
[doublepost=1501871071,1501804077][/doublepost]Bump??
 
well you have some odd structure..

first: why would you check if the player has messaged anyone recently for /msg?

second: use [<player>] instead of offlineplayer (unless you did that to have custom message for offline player (?))

third: not sure why you are setting all those variables, just use send "%display name of player% &7) %arg-2%" to arg-1
 
well you have some odd structure..

first: why would you check if the player has messaged anyone recently for /msg?

second: use [<player>] instead of offlineplayer (unless you did that to have custom message for offline player (?))

third: not sure why you are setting all those variables, just use send "%display name of player% &7) %arg-2%" to arg-1
To answer your questions:

1- I check if the player has messaged anyone recently for /r, not /msg because if they try to reply to someone and they are not online, it displays a certain exception.

2- I do do that for a custom error message as you see in my code.

3- Because I use /r and /r doesn't use an argument, so I have to store the argument from the player in a variable, hence my problem. I can't store the prefix of a player unless they were used as an argument in /msg and therefore stored. Otherwise, it displays the prefix of the player I had messaged BEFORE them or it shows "<none>" if I messaged nobody before. I am trying to store the prefix of a player which initiated the message when /r is used, so it shows that player's prefix.
 
To answer your questions:

1- I check if the player has messaged anyone recently for /r, not /msg because if they try to reply to someone and they are not online, it displays a certain exception.

2- I do do that for a custom error message as you see in my code.

3- Because I use /r and /r doesn't use an argument, so I have to store the argument from the player in a variable, hence my problem. I can't store the prefix of a player unless they were used as an argument in /msg and therefore stored. Otherwise, it displays the prefix of the player I had messaged BEFORE them or it shows "<none>" if I messaged nobody before. I am trying to store the prefix of a player which initiated the message when /r is used, so it shows that player's prefix.
Perhaps you were over thinking it, you could use permission nodes, and then on every message event test if the arg has a permission associated with the prefix. Hope this helps.
 
Perhaps you were over thinking it, you could use permission nodes, and then on every message event test if the arg has a permission associated with the prefix. Hope this helps.
I have thought about that, but heritage would mess it up even with weight with the way I organize permissions.
 
To answer your questions:

1- I check if the player has messaged anyone recently for /r, not /msg because if they try to reply to someone and they are not online, it displays a certain exception.

2- I do do that for a custom error message as you see in my code.

3- Because I use /r and /r doesn't use an argument, so I have to store the argument from the player in a variable, hence my problem. I can't store the prefix of a player unless they were used as an argument in /msg and therefore stored. Otherwise, it displays the prefix of the player I had messaged BEFORE them or it shows "<none>" if I messaged nobody before. I am trying to store the prefix of a player which initiated the message when /r is used, so it shows that player's prefix.

"%display name of %{chat.private.reply.%player%}%%"
 
Status
Not open for further replies.