Supports up to 5 names out of the box. I added comments if you want to increase this. Set min word limit via cvar.
PHP Code:
#include <amxmodx>
new const Version[] = "0.1";
new g_pMinWords;
public plugin_init()
{
register_plugin( "Name Word Limit" , Version , "bugsy" );
g_pMinWords = register_cvar( "name_minwords" , "3" );
}
public client_connect( id )
{
if ( !is_user_bot( id ) && !is_user_hltv( id ) )
{
new szName[ 33 ] , szWords[ 5 ][ 2 ] , iWords , iMinWords;
get_user_name( id , szName , charsmax( szName ) );
//If you want to support more than 5 words, you must increase the szWords[] array
//size and add to parse().
iWords = parse( szName , szWords[ 0 ] , charsmax( szWords[] ) ,
szWords[ 1 ] , charsmax( szWords[] ) ,
szWords[ 2 ] , charsmax( szWords[] ) ,
szWords[ 3 ] , charsmax( szWords[] ) ,
szWords[ 4 ] , charsmax( szWords[] ) );
if ( iWords < ( iMinWords = get_pcvar_num( g_pMinWords ) ) )
{
server_cmd( "kick #%d ^"Your name must have at least %d word(s)^"" , get_user_userid( id ) , iMinWords );
}
}
}
__________________