[UN SOLVED] Autokick wrong ip + name
#1

How do I make it so when someone connects with my name and it is NOT my IP Address they get autokicked (and FYI my Ip address never changes)

Quote:
Originally Posted by [SU
BP13 ]
ok. I guess you dont know what im talking about. Ill write it out with math

Name: [SU]BP13 + IP: 99.248.243.238 = Join


Name: [SU]BP13 + IP: Any IP Except 99.248.243.238 = Kicked For Impersonating Me.
Reply
#2

https://sampwiki.blast.hk/wiki/OnPlayerConnect
https://sampwiki.blast.hk/wiki/GetPlayerIp
https://sampwiki.blast.hk/wiki/Strcmp
https://sampwiki.blast.hk/wiki/Kick
Reply
#3

ok. would this work?

pawn Код:
new name[16];
    new plrIP[16];
  GetPlayerIp(playerid, plrIP, sizeof(plrIP));
    GetPlayerName(playerid, name, sizeof(name));
  if(!strcmp(name, "[SU]BP13"))
    {
    if(!strcmp(plrIP, "99.248.243.238"))
    {
      SendClientMessage(playerid, COLOR_BASIC, "Welcome [SU]BP13!");
        }
        else
        {
        Ban(playerid);
    }
  }
Reply
#4

pawn Код:
new name[16];
new plrIP[16];
GetPlayerIp(playerid, plrIP, sizeof(plrIP));
GetPlayerName(playerid, name, sizeof(name));
if(!strcmp(name, "[SU]BP13", 8))
{
   if(strcmp(plrIP, "YOUR IP HERE"))
   {
     Kick(playerid);
   }
}
Yes it will work but look at what i posted above. Optimized code (i believe that "welcome blablablah" is rubbish, considering that you know your name...) + no need to ban the player, just a kick will do the trick since you might loose regular players. Also as you can see "if(!strcmp(name, "[SU]BP13", )" compares only 8 chars so it helps those "smarter exploiters" that might add another letter at the end(as for adding a letter infront of it... you gotta figure that out on your own).
Reply
#5

ok. I guess you dont know what im talking about. Ill write it out with math

Name: [SU]BP13 + IP: 99.248.243.238 = Join


Name: [SU]BP13 + IP: Any IP Except 99.248.243.238 = Kicked For Impersonating Me.
Reply
#6

pawn Код:
if(strcmp(plrIP, "YOUR IP HERE"))
   {
     Kick(playerid);
   }
I'm not 100% sure if this would work (the thing I will suggest below) but I've tried it connecting to my own server through an IP that was set up.

pawn Код:
if(!strcmp(plrIP, "127.0.0.1"))
   {
     Kick(playerid);
   }
I'm just thinking of this, dont know if it will work or not though.
Reply
#7

Quote:
Originally Posted by djlobo[Awesome-games.tk
]
with that code you will ban yourself
check range ip not the whole ip because in next connection with internet your ip can change:

example :
Quote:

instead of 91.91.91.91

...

91.91.*.*

couldent the range be anything?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)