In your amxmodx\configs dir place a file named "immune_names.txt" in the below format.
Code:
name1
name2
name3
name4
See below for extra options
PHP Code:
public CheckName( id )
{
if ( !is_user_connected(id) )
return PLUGIN_HANDLED;
new szNamesFile[64];
new szItem[33];
new szName[33];
get_configsdir(szNamesFile, 63);
format( szNamesFile , 63 , "%s/immune_names.txt" , szNamesFile );
if ( !file_exists( szNamesFile ) )
return 0;
new iFile = fopen ( szNamesFile , "r" );
get_user_name( id , szName , 32 );
while ( !feof( iFile ) )
{
fgets( iFile , szItem , 32 );
if ( equal( szName, szItem , strlen(szName) ) )
{
fclose( iFile );
return 1;
}
}
fclose( iFile );
return 0;
}
This function is case sensitive, if you do not want it to not be, change 'equal' to 'equali'
OR
If you want to return true if the file item is found within the players name replace the equal statement with:
PHP Code:
if ( contain( szName, szItem ) > -1 )
//OR case insensitive
if ( containi( szName, szItem ) > -1 )
Example usage:
PHP Code:
public client_putinserver(id)
{
if ( CheckName(id) )
//player is immune since name found
else
//players name not found
//OR
if ( !CheckName(id) )
//players name not found
else
//player is immune
}
__________________