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 out 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 Staff Auth getting IPS?

Discussion in 'Skript' started by DroppingYou, Nov 23, 2017.

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

    DroppingYou Member

    Joined:
    Nov 23, 2017
    Messages:
    3
    Likes Received:
    0
    Hey so I need help making a staff authentication skript names easyauth.

    My code so far is this:
    Code (Skript):
    1.  
    2.         #--------------- Staff Auth --------------#
    3.        
    4.         #     NORMAL PIN AUTHENTICATION     #
    5.  
    6. on join:
    7.     if player has permission "staffauth.staff":
    8.         if {password.%player%} is not set:
    9.             message "&7Since this is your first time joining as staff, please use &c&l/REGISTER <PIN> <CONFIRM PIN> &7to protect your account."
    10.        
    11. on quit:
    12.     set {loggedin.%player%} to false
    13.  
    14. on disconnect:
    15.     set {loggedin.%player%} to false
    16.    
    17. on any movement:
    18.     if player has permission "easyauth.staff":
    19.         if {loggedin.%player%} is false:
    20.             cancel event
    21.             message "&7In order to play, you must login using &c&l/LOGIN <PIN>"
    22.         if {loggedin.%player%} is true:
    23.             stop
    24.         if {pin.%player%} is not set:
    25.             cancel event
    26.             message "&7Please use &c&l/REGISTER <PIN> <CONFIRM PIN> &7before playing"
    27.            
    28. command /register [<text>] [<text>]:
    29.     permission: easyauth.staff
    30.     trigger:
    31.         if {pin.%player%} is set:
    32.             message "&c&lERROR! &7You already have a pin set! To change your pin use &c&l/RESETPIN <OLD-PIN> <NEW-PIN>"
    33.         else:
    34.             if arg 1 is set:
    35.                 if arg 2 is set:
    36.                     if arg 1 = arg 2:
    37.                         set {pin.%player%} to arg 1
    38.                         message "&7Thank you for registering. Your PIN is &c&l%arg 1%"
    39.                 else:
    40.                     message "&7Wrong usage. Please use &c&l/REGISTER <PIN> <CONFIRM PIN>"
    41.             else:
    42.                 message "&7Wrong usage. Please use &c&l/REGISTER <PIN> <CONFIRM PIN>"
    43.                    
    44. command /login [<text>]:
    45.     permission: easyauth.staff
    46.     trigger:
    47.         if arg 1 is not set:
    48.             message "&7Please use &c&l/LOGIN <PIN>"
    49.         if arg 1 is {pin.%player%}:
    50.             set {loggedin.%player%} to true
    51.             message "&a&lSUCCESSFULLY &7logged in."
    52.            
    53.         if arg 1 is not {pin.%player%}:
    54.             loop 5 times:
    55.                 message "&4&lINCORRECT PIN!"
    56.            
    57. command /resetpin [<text>] [<text>]:
    58.     permission: easyauth.staff
    59.     trigger:
    60.         if arg 1 is {pin.%player%}:
    61.             if arg 2 is set:
    62.                 set {pin.%player%} to arg 2
    63.                 message "&7Your PIN has sucessfully been reset. Your new PIN is &c&l%arg 2%"
    64.             else:
    65.                 message "&7Now enter a &c&lNEW PIN"
    66.                    
    67.         else:
    68.             message "&7Wrong usage. Please enter your &c&lOLD PIN"
    69.                    
    70.    
    71.         #         IP AUTHENTICATION        #
    72.  
    73. on join:
    74.     if player has permission "easyauth.staff":
    75.         if {pin.%player%} is not set:
    76.             set {ip.%player%} to player's ip
    77.  
    78. on any movement:
    79.     if player has permission "easyauth.staff":
    80.         if players ip is not {ip.%player%}:
    81.             wait 20 ticks
    82.             kick due to "&c&lInvalid IP &4&l>> &c&lPlease alert admins through discord to reset your IP!"
    83.         if {ip.%player%} is not set:
    84.             set {ip.%player%} to players ip
    85.  
    Scroll to the bottom cause that's where my issues are.. The entire PIN system works great and all but I'm just having issues with IPS..


    Feel free to spoon feed me cause this is only like my 4th skript.
    Regards, DroppingYou
    --- Double Post Merged, Nov 23, 2017, Original Post Date: Nov 23, 2017 ---
    reading this over I realize I have not stated my issue... Silly me

    Basically I want it to not allow players to join on a different IP of their origin IP (from first time join/ first time pin setting) but I'm not familiar enough with the conditions, and effects of skripts low end documentation given to understand what to do with IPS. Ive tried to look at other skripts for methods on obtaining a players IP and I cant find anything. Any help would be great :emoji_slight_smile:

     
  2. Best Answer:
    Post #5 by MartinOdum, Nov 23, 2017
  3. Wynnevir

    Wynnevir Well-Known Member

    Joined:
    Jul 9, 2017
    Messages:
    1,015
    Likes Received:
    62
    This post HERE is similar to yours, I think this is what you want. I wouldn't use the on any move event, it's likely going to cause quite a bit of lag. you'd only need to do what you want in the join event. The working skript in this related post is the very last comment.
     
  4. Epicskymi

    Epicskymi Active Member

    Joined:
    Feb 14, 2017
    Messages:
    71
    Likes Received:
    11
  5. HiddenDev

    HiddenDev Member

    Joined:
    Sep 19, 2017
    Messages:
    43
    Likes Received:
    2
    This would be a horrible way of going about it anyway, peoples ips often change. Meaning you would have to do a lot of ip adding to a variable.
     
  6. MartinOdum

    MartinOdum Member

    Joined:
    Jan 26, 2017
    Messages:
    112
    Likes Received:
    13
    Yeah Ip addresses change often, I made something like this a while back and what I did was I would store the last ip they successfully logged in with and every time they joined the server if the ip matched it would not ask for any sort of login credentials but if their ip didn't match then it would ask for login credentials

    As for your question/issue, there isn't much to it and you basically had it, you can store a player's ip address like this:
    Code (Skript):
    1. set {ip::%player%} to ip of player
    and to check if the stored ip address is the same as their current ip address you would do:
    Code (Skript):
    1. if ip of player is not equal to {ip::%player%}:
     
    DroppingYou likes this.
  7. Pikachu

    Supporter Addon Developer

    Joined:
    Jan 25, 2017
    Messages:
    870
    Likes Received:
    139
    Medals:
    Don't make your own login script if you arent going to be safe about it. You currently arent being safe about it.
     
  8. Epicskymi

    Epicskymi Active Member

    Joined:
    Feb 14, 2017
    Messages:
    71
    Likes Received:
    11
    its why I linked just ok login
     
  9. DroppingYou

    DroppingYou Member

    Joined:
    Nov 23, 2017
    Messages:
    3
    Likes Received:
    0
    I'm making this script for private use for my server hence why I'm not using configurable stuff like {@message} or permission stuff. I just need some help for what I'd like to see MY script do not planning on releasing this unless I feel the need too. ._.
    --- Double Post Merged, Nov 24, 2017, Original Post Date: Nov 24, 2017 ---
    Thank you :emoji_slight_smile:
     
Thread Status:
Not open for further replies.

Share This Page

Loading...