Solved Get IP Adress on Server Ping

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

EisteeRamon

Member
Aug 27, 2018
10
0
0
20
Hey,

What I want is... If a player pings the server, a variable should be set to its IP adress. :emoji_slight_smile:

on server list ping:
set {allow::%player's ip%} to true

best regards,
Ramon
 
on server list ping:
set {allow::%player's ip%} to true <---
This wouldn't work, because when a player pings a server, the only info the server gets it the IP... so there is no player in this event.
[doublepost=1535614253,1535613000][/doublepost]Oops forgot to add.
The best way to do it would be that when a player joins your server, set their IP as a variable that holds their name:
code_language.skript:
on join:
    set {join::%ip of player%} to player

So when a player pings the server, you can check the owner of said IP address
For some reason I can't find the syntax for getting the IP on a server ping event... So I just wrote a little something with Skript-Mirror as an example
code_language.skript:
on join:
    set {join::/%ip of player%} to player

on server list ping:
    set {_p} to event.getAddress()
    if {join::%{_p}%} is set:
        send "&7[&aPINGER&7] - &b%{join::%{_p}%}% &7pinged the server" to console
 
  • Like
Reactions: EisteeRamon
I can use the on connect event too
[doublepost=1535620747,1535620637][/doublepost]What I want is... The player should add the server to its serverlist. If the player try to connect he should get kicked by reason "Add the server to your server list!"
 
that would be easy
just use the server ping list, to add the IP to a list.
And on connect, if their ip is in that list let them connect, else like them for "Add the server to your server list"
 
Okay this SHOULD work... I tested it, and it seems to work (requires Skript mirror)
code_language.skript:
on server list ping:
    set {_p} to "%event.getAddress()%"
    replace all "/" with "" in {_p}
    add {_p} to {ServerSaveList::*}
    broadcast "&aPINGED BY: %{_p}%"

on connect:
    if {ServerSaveList::*} contains IP of player:
        send "&aCONNECTED" to console
    else:
        kick player due to "You need to add our server to your server list"
        send "&cKICKED" to console
 
Status
Not open for further replies.