Logging IPs (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
23
Skript Version: Skript v2.2
Skript Author: Bensku

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!"
Errors: None

Problem:
This works with online players, however; when I try it on an offline player it messages the user who executed the command: "User - <none>", I've tried setting variables, using %IP of player%, using %player's IP%, everything. Nothing seems to work. Making this new thread to use the correct format and hopefully get some more help. People have offered many ways to do this, all of which work on online players and not offline. I always receive "<none>" as their IP.
 
Did you try changing offline player to "offline-player"
 
If you do something like "message "%{ip::itismejoey}%" and I was offline, what would happen?
[doublepost=1485656591,1485656356][/doublepost]You could try something like this:

code_language.skript:
on join:
    set {ip::%player%} to IP of player

command /getip [<text>] [<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."
        stop
    if arg-2 is not set:
        message "&cYou must put the password!"
        stop
       
    set {_player} to arg 1 parsed as offlineplayer
    if arg-2 is "password99":
        message "&f&l%{_player}% &8- &b&l%{ip::%{_player%}%"
    else:
        message "&c&lIncorrect password!"

I personally always use [<text>] and then parse the player as offline later down the command. But do a few tests for yourself. Join your server then make a test command that just displays the IP variable.
 
Status
Not open for further replies.