Solved Command Won't Work on Offline Players

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

Anonymous

Member
Jan 27, 2017
15
0
0
22
Hi, this is my Skript, I'm trying to make my server more secure by blocking administrators from seeing IP adresses unless I trust them enough, so I'm making a custom command with a password and permission but it's not seeming to work on offline players and I don't know how I would be able to fix this. Here's my Skript:
code_language.skript:
command /getip [<player>] [<text>]:
  permission: getip.use
  permission message: "&CYou don't have access to this command."
  trigger:
    if arg-1 is not set:
      message "&cYou must put a player's username."
    else if arg-1 is set:
      if arg-2 is not set:
        message "&cYou must put a password."
      else if arg-2 is set:
        if arg-2 is "password1":
          if arg-1 isn't "VoidStacker" or "GotUrDox" or "StrafinMC" or "Macrolect":
            message "&e%arg-1%'s &7IP adress is &e%IP of arg-1%&7."
          else if arg-1 is "VoidStacker" or "GotUrDox" or "StrafinMC" or "Macrolect":
            message "&cYou're not allowed to view this user's IP adress."
            message "&7Nice try though. ;)"
        else if arg-2 is not "password1":
          message "&cIncorrect password!"
Help would be much appreciated.
 
Use [<offline player>] instead of [<player>].
[doublepost=1485546978,1485546944][/doublepost]Rip, as i posted that your comment popped up lol
 
It's because the IP expression doesn't support offline players, you'll have to use TuSKe and its player data expression:
code_language.skript:
if arg-1 isn't online:
    set {_IP} to player data of arg-1's ip
else:
    set {_IP} to arg-1's ip
send "%arg-1%'s IP address is &e%{_IP}%&7."
 
It's because the IP expression doesn't support offline players, you'll have to use TuSKe and its player data expression:
code_language.skript:
if arg-1 isn't online:
    set {_IP} to player data of arg-1's ip
else:
    set {_IP} to arg-1's ip
send "%arg-1%'s IP address is &e%{_IP}%&7."
That might work, before you posted this I restarted, on join I'm just going to save their IP to a list and it'll draw the IP from the list.
 
You can do that, however, what I said would be a lot more efficient such as it doesn't need of useless vars
I'm using the variables for many other things as well.
[doublepost=1485562728,1485560577][/doublepost]
You can do that, however, what I said would be a lot more efficient such as it doesn't need of useless vars
I decided to try it since my way isn't working, errors. (Yes I installed the addon)
https://gyazo.com/032c97cdabb2bc4d8d330fe9f0f86f53?token=885a2de7d64f977da2fc8d01ef1470ad
Edit: Wrote it wrong, trying again now.
[doublepost=1485562891][/doublepost]
I'm using the variables for many other things as well.
[doublepost=1485562728,1485560577][/doublepost]
I decided to try it since my way isn't working, errors. (Yes I installed the addon)
https://gyazo.com/032c97cdabb2bc4d8d330fe9f0f86f53?token=885a2de7d64f977da2fc8d01ef1470ad
Edit: Wrote it wrong, trying again now.
Fixed my error, but it's still messaging "<none>" when I try it on offline players.
 
I made a skript like this, but different. It's from a api that uses %player's ip%.
EDIT: It requires a key to work with.
zGiDs9h.png

QwEwZ6r.png

AhtfAHx.png

L4eV1lx.png
 
In what way is that a help to my question?
try to see if it works.
EDIT: That's using tabs, not spaces. :emoji_slight_smile:
Code:
command /getip [<offlineplayer>] [<text>]:
    permission: getip.use
    permission message: "&CYou don't have access to this command."
    trigger:
        if arg-1 is not set:
            message "&cYou must put a player's username."
        else if arg-1 is set:
            if arg-2 is not set:
                message "&cYou must put a password."
            else if arg-2 is set:
                if arg-2 is "password1":
                    if arg-1 isn't "VoidStacker" or "GotUrDox" or "StrafinMC" or "Macrolect":
                        message "&e%arg-1%'s &7IP adress is &e%IP of arg-1%&7."
                    else if arg-1 is "VoidStacker" or "GotUrDox" or "StrafinMC" or "Macrolect":
                        message "&cYou're not allowed to view this user's IP adress."
                        message "&7Nice try though. ;)"
                else if arg-2 is not "password1":
                    message "&cIncorrect password!"
 
You'll have to store the IP of the player to a variable when they connect, and insert the variable.

code_language.skript:
on join:
    set {ips::%name of player%} to "%ip of player%"

command /ip [<offline player>]:
    trigger:
        # do stuff
        message "The IP of %arg 1% is %{ips::%name of arg-1%}%"

Seriously. Why does nobody think of such basic things, and instead makes it more complicated... Complicated != good.
 
You'll have to store the IP of the player to a variable when they connect, and insert the variable.

code_language.skript:
on join:
    set {ips::%name of player%} to "%ip of player%"

command /ip [<offline player>]:
    trigger:
        # do stuff
        message "The IP of %arg 1% is %{ips::%name of arg-1%}%"

Seriously. Why does nobody think of such basic things, and instead makes it more complicated... Complicated != good.
I was 99% sure that would work, tried it that way and it doesn't.
code_language.skript:
on join:
  set {ip::%name of player%} to "%IP of player%"
command /getip [<offline player>] [<text>]:
  permission: ip.getip
  permission message: &cYou don't have access to this command.
  trigger:
    if arg-1 is not set:
      message "&cYou must put a player's username."
    else if arg-1 is set:
      if arg-2 is not set:
        message "&cYou must put the password!"
      else if arg-2 is set:
        if arg-2 is "password99":
          message "&f&l%arg-1% &8- &b&l%{ip::%name of arg-1%}%"
        else if arg-2 is not "password99":
          message "&c&lIncorrect password!"
Edit: Forgot to mention that it comes up with <none> no errors.
 
Last edited by a moderator:
I was 99% sure that would work, tried it that way and it doesn't.
code_language.skript:
on join:
  set {ip::%name of player%} to "%IP of player%"
command /getip [<offline player>] [<text>]:
  permission: ip.getip
  permission message: &cYou don't have access to this command.
  trigger:
    if arg-1 is not set:
      message "&cYou must put a player's username."
    else if arg-1 is set:
      if arg-2 is not set:
        message "&cYou must put the password!"
      else if arg-2 is set:
        if arg-2 is "password99":
          message "&f&l%arg-1% &8- &b&l%{ip::%name of arg-1%}%"
        else if arg-2 is not "password99":
          message "&c&lIncorrect password!"
Edit: Forgot to mention that it comes up with <none> no errors.
Then try this

code_language.skript:
on join:
    set {_s} to "%player%" parsed as an offline player
    set {ip::%{_s}%} to "%ip of player%"
 
command /getip [<offline player>] [<text>]:
  permission: ip.getip
  permission message: &cYou don't have access to this command.
  trigger:
    if arg-1 is not set:
      message "&cYou must put a player's username."
    else if arg-1 is set:
      if arg-2 is not set:
        message "&cYou must put the password!"
      else if arg-2 is set:
        if arg-2 is "password99":
          message "&f&l%arg-1% &8- &b&l%{ip::%arg-1%}%"
        else if arg-2 is not "password99":
          message "&c&lIncorrect password!"

Tested and worked fine for me.
 
Status
Not open for further replies.