if(strfind(Nome(playerid),"com1",true) != -1)
{
Ban(playerid);
}
if(strfind(Nome(playerid),"com2",true) != -1)
{
Ban(playerid);
}
if(strfind(Nome(playerid),"com3",true) != -1)
{
Ban(playerid);
}
#include <a_samp>
#define _CHANGE_NAME_BEFORE_KICK true
stock
bool: bIllegalPlayer [ MAX_PLAYERS ] = false,
szTmpKickName [ MAX_PLAYER_NAME ];
public OnFilterScriptInit( )
{
print( "* Bad name protection has been enabled." );
print( "* The following names are forbidden to join your server:" );
print( "\tcom[1-9], lpt[1-9], clock$, nul, aux, prn, con" );
#if _CHANGE_NAME_BEFORE_KICK == true
for ( new i = 0; i < MAX_PLAYER_NAME; i++ )
szTmpKickName[ i ] = '_';
szTmpKickName[ MAX_PLAYER_NAME - 1 ] = '\0';
print( "* The temporary name used to disconnect crashers will be:" );
printf( "\t%s", szTmpKickName );
#endif
return 1;
}
public OnPlayerConnect( playerid )
{
new
szPlayerName[ MAX_PLAYER_NAME ];
bIllegalPlayer[ playerid ] = false;
GetPlayerName( playerid, szPlayerName, MAX_PLAYER_NAME );
if ( !strcmp( szPlayerName, "com", true, 3 ) || !strcmp( szPlayerName, "lpt", true, 3 ) )
{
if ( szPlayerName[ 3 ] >= '0' && szPlayerName[ 3 ] <= '9' && szPlayerName[ 4 ] == '\0' )
return aKick( playerid, szPlayerName );
}
else if ( !strcmp( szPlayerName, "clock$", true, 6 ) )
return aKick( playerid, szPlayerName );
else
{
static const
szForbiddenName[ ][ ] =
{
"nul", "aux",
"prn", "con"
};
for ( new i = 0; i < sizeof( szForbiddenName ); i++ )
{
if ( !strcmp( szPlayerName, szForbiddenName[ i ], true, 3 ) )
return aKick( playerid, szPlayerName );
}
#if _CHANGE_NAME_BEFORE_KICK == true
// Players cannot join with our temporary kicking name either...
// this name is "________________" by default which you probably don't want anyways.
if ( !strcmp( szPlayerName, szTmpKickName, true, MAX_PLAYER_NAME ) )
return aKick( playerid, szPlayerName );
#endif
}
return 1;
}
public OnPlayerDisconnect( playerid, reason )
{
if ( bIllegalPlayer[ playerid ] )
{
bIllegalPlayer[ playerid ] = false;
return 0;
}
return 1;
}
stock aKick( playerid, pname[ ] )
{
new
szIP[ 16 ];
bIllegalPlayer[ playerid ] = true;
#if _CHANGE_NAME_BEFORE_KICK
SetPlayerName( playerid, szTmpKickName );
#endif
GetPlayerIp( playerid, szIP, 16 );
SendClientMessage( playerid, 0xFFFFFFFF, "SERVER: You have been because you have an illegal nickname." );
Kick( playerid );
printf( "[protect] %s (%d:%s) was kicked for an illegal nickname.", pname, playerid, szIP );
return 0;
}
Tenta usar isto: https://sampforum.blast.hk/showthread.php?tid=384222
|
Sem chance, quero saber pq alguns servidores vocк consegue entrar com esse nick atй jogar.
|
public OnPlayerConnect(playerid)
{
new Bots[MAX_PLAYER_NAME];
GetPlayerName(playerid, Bots, MAX_PLAYER_NAME);
if(!strcmp("con", Bots, true) || !strcmp("aux", Bots, true) || !strcmp("com4", Bots, true) || !strcmp("com8", Bots, true)
|| !strcmp("lpt3", Bots, true) || !strcmp("lpt7", Bots, true) || !strcmp("com1", Bots, true) || !strcmp("com5", Bots, true)
|| !strcmp("com9", Bots, true) || !strcmp("lpt5", Bots, true))
{
SetPlayerName(playerid, "O_Mais_Lixo");
BanEx(playerid, "Anti-Bot");
return 1;
}