1. 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!

  2. LOOKING FOR A VERSION OF SKRIPT??:

    You can always check our our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved Command Won't Work on Offline Players

Discussion in 'Skript' started by Anonymous, Jan 27, 2017.

Thread Status:
Not open for further replies.
  1. A

    Anonymous Member

    Joined:
    Jan 27, 2017
    Messages:
    15
    Likes Received:
    0
    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 (Skript):
    1. command /getip [<player>] [<text>]:
    2.   permission: getip.use
    3.   permission message: "&CYou don't have access to this command."
    4.   trigger:
    5.     if arg-1 is not set:
    6.       message "&cYou must put a player's username."
    7.     else if arg-1 is set:
    8.       if arg-2 is not set:
    9.         message "&cYou must put a password."
    10.       else if arg-2 is set:
    11.         if arg-2 is "password1":
    12.           if arg-1 isn't "VoidStacker" or "GotUrDox" or "StrafinMC" or "Macrolect":
    13.             message "&e%arg-1%'s &7IP adress is &e%IP of arg-1%&7."
    14.           else if arg-1 is "VoidStacker" or "GotUrDox" or "StrafinMC" or "Macrolect":
    15.             message "&cYou're not allowed to view this user's IP adress."
    16.             message "&7Nice try though. ;)"
    17.         else if arg-2 is not "password1":
    18.           message "&cIncorrect password!"
    Help would be much appreciated.
     
  2. ShaneBee

    Supporter +

    Joined:
    Sep 7, 2017
    Messages:
    1,459
    Likes Received:
    96
    To be able to use a command on offline players, you must declare the argument as <offline player> instead of <player>.
     
  3. ShaneBee

    Supporter +

    Joined:
    Sep 7, 2017
    Messages:
    1,459
    Likes Received:
    96
    Use [<offline player>] instead of [<player>].
    --- Double Post Merged, Jan 27, 2017, Original Post Date: Jan 27, 2017 ---
    Rip, as i posted that your comment popped up lol
     
  4. ShaneBee

    Supporter +

    Joined:
    Sep 7, 2017
    Messages:
    1,459
    Likes Received:
    96
    It's messaging IP is <none> when I try this.
     
  5. ShaneBee

    Supporter +

    Joined:
    Sep 7, 2017
    Messages:
    1,459
    Likes Received:
    96
    It's because the IP expression doesn't support offline players, you'll have to use TuSKe and its player data expression:
    Code (Skript):
    1.  
    2. if arg-1 isn't online:
    3.     set {_IP} to player data of arg-1's ip
    4. else:
    5.     set {_IP} to arg-1's ip
    6. send "%arg-1%'s IP address is &e%{_IP}%&7."
    7.  
     
  6. ShaneBee

    Supporter +

    Joined:
    Sep 7, 2017
    Messages:
    1,459
    Likes Received:
    96
    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.
     
  7. ShaneBee

    Supporter +

    Joined:
    Sep 7, 2017
    Messages:
    1,459
    Likes Received:
    96
    You can do that, however, what I said would be a lot more efficient such as it doesn't need of useless vars
     
  8. ShaneBee

    Supporter +

    Joined:
    Sep 7, 2017
    Messages:
    1,459
    Likes Received:
    96
    I'm using the variables for many other things as well.
    --- Double Post Merged, Jan 28, 2017, Original Post Date: Jan 27, 2017 ---
    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.
    --- Double Post Merged, Jan 28, 2017 ---
    Fixed my error, but it's still messaging "<none>" when I try it on offline players.
     
  9. ShaneBee

    Supporter +

    Joined:
    Sep 7, 2017
    Messages:
    1,459
    Likes Received:
    96
    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.
    [​IMG]

    [​IMG]

    [​IMG]

    [​IMG]
     
  10. ShaneBee

    Supporter +

    Joined:
    Sep 7, 2017
    Messages:
    1,459
    Likes Received:
    96
    In what way is that a help to my question?
     
  11. ShaneBee

    Supporter +

    Joined:
    Sep 7, 2017
    Messages:
    1,459
    Likes Received:
    96
    try to see if it works.
    EDIT: That's using tabs, not spaces. :emoji_slight_smile:
    Code (Text):
    1. command /getip [<offlineplayer>] [<text>]:
    2.     permission: getip.use
    3.     permission message: "&CYou don't have access to this command."
    4.     trigger:
    5.         if arg-1 is not set:
    6.             message "&cYou must put a player's username."
    7.         else if arg-1 is set:
    8.             if arg-2 is not set:
    9.                 message "&cYou must put a password."
    10.             else if arg-2 is set:
    11.                 if arg-2 is "password1":
    12.                     if arg-1 isn't "VoidStacker" or "GotUrDox" or "StrafinMC" or "Macrolect":
    13.                         message "&e%arg-1%'s &7IP adress is &e%IP of arg-1%&7."
    14.                     else if arg-1 is "VoidStacker" or "GotUrDox" or "StrafinMC" or "Macrolect":
    15.                         message "&cYou're not allowed to view this user's IP adress."
    16.                         message "&7Nice try though. ;)"
    17.                 else if arg-2 is not "password1":
    18.                     message "&cIncorrect password!"
     
  12. ShaneBee

    Supporter +

    Joined:
    Sep 7, 2017
    Messages:
    1,459
    Likes Received:
    96
    You'll have to store the IP of the player to a variable when they connect, and insert the variable.

    Code (Skript):
    1.  
    2. on join:
    3.     set {ips::%name of player%} to "%ip of player%"
    4.  
    5. command /ip [<offline player>]:
    6.     trigger:
    7.         # do stuff
    8.         message "The IP of %arg 1% is %{ips::%name of arg-1%}%"
    9.  
    10.  
    Seriously. Why does nobody think of such basic things, and instead makes it more complicated... Complicated != good.
     
  13. ShaneBee

    Supporter +

    Joined:
    Sep 7, 2017
    Messages:
    1,459
    Likes Received:
    96
    I was 99% sure that would work, tried it that way and it doesn't.
    Code (Skript):
    1. on join:
    2.   set {ip::%name of player%} to "%IP of player%"
    3. command /getip [<offline player>] [<text>]:
    4.   permission: ip.getip
    5.   permission message: &cYou don't have access to this command.
    6.   trigger:
    7.     if arg-1 is not set:
    8.       message "&cYou must put a player's username."
    9.     else if arg-1 is set:
    10.       if arg-2 is not set:
    11.         message "&cYou must put the password!"
    12.       else if arg-2 is set:
    13.         if arg-2 is "password99":
    14.           message "&f&l%arg-1% &8- &b&l%{ip::%name of arg-1%}%"
    15.         else if arg-2 is not "password99":
    16.           message "&c&lIncorrect password!"
    Edit: Forgot to mention that it comes up with <none> no errors.
     
    #13 ShaneBee, Jan 28, 2017
    Last edited by a moderator: Jan 28, 2017
  14. ShaneBee

    Supporter +

    Joined:
    Sep 7, 2017
    Messages:
    1,459
    Likes Received:
    96
    Then try this

    Code (Skript):
    1.  
    2. on join:
    3.     set {_s} to "%player%" parsed as an offline player
    4.     set {ip::%{_s}%} to "%ip of player%"
    5.  
    6. command /getip [<offline player>] [<text>]:
    7.   permission: ip.getip
    8.   permission message: &cYou don't have access to this command.
    9.   trigger:
    10.     if arg-1 is not set:
    11.       message "&cYou must put a player's username."
    12.     else if arg-1 is set:
    13.       if arg-2 is not set:
    14.         message "&cYou must put the password!"
    15.       else if arg-2 is set:
    16.         if arg-2 is "password99":
    17.           message "&f&l%arg-1% &8- &b&l%{ip::%arg-1%}%"
    18.         else if arg-2 is not "password99":
    19.           message "&c&lIncorrect password!"
    20.  
    Tested and worked fine for me.
     
Thread Status:
Not open for further replies.
Loading...