Solved Staff Auth getting IPS?

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

DroppingYou

Member
Nov 23, 2017
3
0
1
21
Hey so I need help making a staff authentication skript names easyauth.

My code so far is this:
code_language.skript:
        #--------------- Staff Auth --------------#
        
        #     NORMAL PIN AUTHENTICATION     #

on join:
    if player has permission "staffauth.staff":
        if {password.%player%} is not set:
            message "&7Since this is your first time joining as staff, please use &c&l/REGISTER <PIN> <CONFIRM PIN> &7to protect your account."
        
on quit:
    set {loggedin.%player%} to false

on disconnect:
    set {loggedin.%player%} to false
    
on any movement:
    if player has permission "easyauth.staff":
        if {loggedin.%player%} is false:
            cancel event
            message "&7In order to play, you must login using &c&l/LOGIN <PIN>"
        if {loggedin.%player%} is true:
            stop
        if {pin.%player%} is not set:
            cancel event
            message "&7Please use &c&l/REGISTER <PIN> <CONFIRM PIN> &7before playing"
            
command /register [<text>] [<text>]:
    permission: easyauth.staff
    trigger:
        if {pin.%player%} is set:
            message "&c&lERROR! &7You already have a pin set! To change your pin use &c&l/RESETPIN <OLD-PIN> <NEW-PIN>"
        else:
            if arg 1 is set:
                if arg 2 is set:
                    if arg 1 = arg 2:
                        set {pin.%player%} to arg 1
                        message "&7Thank you for registering. Your PIN is &c&l%arg 1%"
                else:
                    message "&7Wrong usage. Please use &c&l/REGISTER <PIN> <CONFIRM PIN>"
            else:
                message "&7Wrong usage. Please use &c&l/REGISTER <PIN> <CONFIRM PIN>"
                    
command /login [<text>]:
    permission: easyauth.staff
    trigger:
        if arg 1 is not set:
            message "&7Please use &c&l/LOGIN <PIN>"
        if arg 1 is {pin.%player%}:
            set {loggedin.%player%} to true
            message "&a&lSUCCESSFULLY &7logged in."
            
        if arg 1 is not {pin.%player%}:
            loop 5 times:
                message "&4&lINCORRECT PIN!"
            
command /resetpin [<text>] [<text>]:
    permission: easyauth.staff
    trigger:
        if arg 1 is {pin.%player%}:
            if arg 2 is set:
                set {pin.%player%} to arg 2
                message "&7Your PIN has sucessfully been reset. Your new PIN is &c&l%arg 2%"
            else:
                message "&7Now enter a &c&lNEW PIN"
                    
        else:
            message "&7Wrong usage. Please enter your &c&lOLD PIN"
                    
    
        #         IP AUTHENTICATION        #

on join:
    if player has permission "easyauth.staff":
        if {pin.%player%} is not set:
            set {ip.%player%} to player's ip

on any movement:
    if player has permission "easyauth.staff":
        if players ip is not {ip.%player%}:
            wait 20 ticks
            kick due to "&c&lInvalid IP &4&l>> &c&lPlease alert admins through discord to reset your IP!"
        if {ip.%player%} is not set:
            set {ip.%player%} to players ip

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
[doublepost=1511423845,1511423594][/doublepost]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:
 
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.
 
not allow players to join on a different IP of their origin IP (from first time join
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.
 
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_language.skript:
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_language.skript:
if ip of player is not equal to {ip::%player%}:
 
  • Like
Reactions: DroppingYou
Don't make your own login script if you arent going to be safe about it. You currently arent being safe about it.
 
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. ._.
[doublepost=1511553651,1511553616][/doublepost]
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_language.skript:
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_language.skript:
if ip of player is not equal to {ip::%player%}:
Thank you :emoji_slight_smile:
 
Status
Not open for further replies.