bans imposter?
#1

hey how can i make it so if an imposter goes onto a server with a name but the ip isnt right they get kicked

for example

if someone uses the name "Sampiscool123" and their ip is different they get kicked

Thanks
Reply
#2

Hey there sampiscoopl123,

There is a pretty simple way to do this.

Assuming you have already made some sort of regisration system that stores the users IP.

You could try the following:

Код:
new str[256];
new str2[256];
GetPlayerIp(playerid,str,sizeof(str));
format(str2,sizeof(str2),"%s",SOURCE OF STORED IP);
if(!strcmp(str,str2,true) == 0) { SendClientMessage(playerid,COLOUR,"Invalid IP"); Kick(playerid); }
This would go under your OnPlayerConnect callback

Cheers,

TJ
Reply
#3

Or you can do this if you do or don't have a registration system.
pawn Код:
public OnPlayerConnect(playerid)
{
  new pname[24];
  GetPlayerName(playerid,pname,24);
  if(!strcmp(pname,"Sampiscool123",false)) //Change "Sampiscool123"
  {
    new pip[16];
    GetPlayerIp(playerid,pip,16);
    if(strcmp(pip,"127.0.0.1",false))Kick(playerid); //Change "127.0.0.1"
  }
  return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)