I really dunno why do you need this, but anyway here is code of this simple plugin:
PHP Code:
#include <amxmodx>
#define MAX_NAMES 100
#define MAX_ATTEMPTS 4
new g_stored_names[MAX_NAMES+1][33]
new g_attempts[MAX_NAMES+1]
new g_last_name_pos = 0 //indicates "last used cell" in g_stored_names array
public plugin_init(){
register_plugin( "BanOn5thAttempt", "1.0", "Sylwester" )
register_logevent("logevent_round_start", 2, "1=Round_Start")
}
public logevent_round_start(){
g_last_name_pos = 0 //no names stored in array
}
public check_name(id){
new name[33]
get_user_name(id, name, 32)
for(new i=1; i<=g_last_name_pos; i++){ //search g_stored_names array for specified name (if any stored)
if(equal(g_stored_names[i], name)){
g_attempts[i] += 1 //name has been found, increase amount of attempts for player with this name by 1
if(g_attempts[i] > MAX_ATTEMPTS){ //check if player exceeded the limit
g_attempts[i] = 0 //reset amount of attempts, so another player with same name will not be banned instantly
// insert ban code here
// ban player with id "id"
}
return PLUGIN_CONTINUE
}
}
if(g_last_name_pos >= MAX_NAMES)
return PLUGIN_CONTINUE //don't store any more names if reached the limit
g_last_name_pos += 1 //set "last used cell" to "first empty cell"
copy(g_stored_names[g_last_name_pos], 32, name) //store player name in "first empty cell"
g_attempts[g_last_name_pos] = 1
return PLUGIN_CONTINUE
}
public client_connect(id){
check_name(id);
}
__________________