• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] how to get the last digit of a player's IP
#14
i solved the problem by doing this:
Code:
    new ip[16];
    GetPlayerIp(playerid, ip, sizeof(ip));
    new
        ip_part1,
        ip_part2,
        ip_part3,
        ip_part4
    ;
    sscanf(ip, "p<.>dddd", ip_part1, ip_part2, ip_part3, ip_part4);

    if (ip_part1 == 192 && ip_part2 == 168 && ip_part3 == 1 && (1 <= ip_part4 <= 255))
    {

i simply removed the ip[] = "192.168.1.255" variable, and replaced it with the player's ip and now it works perfectly. thanks so much once again for helping out. if i notice any problem i will update this topic.

messages the server is currently sending: (which are correct so far)
Code:
mems1(0) IP(my real public ip) is legit, therefore able to enter the server.
mems2(0) IP(109.201.143.77) is not legit, therefore not able to enter the server.
the last one is from hide.me vpn.

edit: as for the 127.0.0.1 thing, i added this:
Code:
if ((ip_part1 == 192 || ip_part1 == 127) && (ip_part2 == 168 || ip_part2 == 0) && (ip_part3 == 1 || ip_part3 == 0) && (1 <= ip_part4 <= 255 || ip_part4 == 1))
  Reply


Messages In This Thread
RE: how to get the last digit of a player's IP - by mems - 2021-07-16, 08:17 PM

Forum Jump: