SA-MP Forums Archive
How to ban? +REP - 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)
+--- Thread: How to ban? +REP (/showthread.php?tid=369124)



How to ban? +REP - Gooday - 15.08.2012

Is there a way to ban JUST THE NAME and not the IP? For example if I ban someone like Tony_Johnson I ban just his name but if he changes name he can join.-


AW: How to ban? +REP - Kwashiorkor - 15.08.2012

check the name on OnPlayerConnect and kick him if the name is banned?


Re: How to ban? +REP - FireCat - 15.08.2012

pawn Код:
public OnPlayerConnect(playerid)
{
    new pName[25];
    GetPlayerName(playerid,pName,25);
    if(!(strcmp(pName,"BANNEDNAME"))) return SendClientMessage(playerid,-4,"You're banned."),Kick(playerid);
    return 1;
}



AW: How to ban? +REP - Kwashiorkor - 15.08.2012

Код:
public OnPlayerConnect(playerid)
{
	new forbidden_names[][] = {"Tony_Johnson","Gooday","and_so_on"},
		username[MAX_PLAYER_NAME];
	GetPlayerName(playerid,username,MAX_PLAYER_NAME);
	for(new i; i<sizeof(forbidden_names); i++)
	{
	    if(!strcmp(username,forbidden_names[i]))
	    {
	        Kick(playerid);
	        return 1;
	    }
	}
	return 1;
}