• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] how to get the last digit of a player's IP
#3
(2021-07-15, 11:09 PM)Kwarde Wrote:
Code:
new ip[] = "192.168.1.200";
if (strfind(ip, "192.168.1") == 0) //0, because "192.168.1" should be found in "192.168.1.200", and that found character 'has no characters before the sub string' (the found string started at index 0)
{
    //OK, it is a LAN IP
}
else
{
    //NOK, it is most likely a VPN user (assuming we already checked other addresses such as 127.0.0.1)
}

are you sure, that this is going to solve the problem? because what im asking is if a player's ip matches 192.168.1.(1..255) while yours as i see what it does is check if the ip variable (not player's ip) matches 192.168.1

edit: to elaborate a bit, this is what i need
Code:
if(strcmp(ip, "127.0.0.1", true) == 0)
but the 192.168.1 until 255 version.
  Reply


Messages In This Thread
RE: how to get the last digit of a player's IP. - by mems - 2021-07-15, 11:27 PM

Forum Jump: