SA-MP Forums Archive
bans imposter? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: bans imposter? (/showthread.php?tid=126390)



bans imposter? - Sampiscool123 - 08.02.2010

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


Re: bans imposter? - TTJJ - 08.02.2010

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


Re: bans imposter? - Joe Staff - 08.02.2010

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;
}