Raised This Month: $51 Target: $400
 12% 

Ban Names


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ZiZox
Senior Member
Join Date: Sep 2014
Location: Morocco
Old 01-29-2015 , 11:02   Ban Names
Reply With Quote #1

Hi All,
I Want a plugin baning names (amx_banname "name or steamid" "ban user name")
I mean like baning steamid & ip ..
__________________
ZiZox is offline
Send a message via Skype™ to ZiZox
joshknifer
Veteran Member
Join Date: Jun 2011
Location: Denver, CO
Old 01-29-2015 , 11:10   Re: Ban Names
Reply With Quote #2

Search for Restrict Names in approved plugins.
__________________
joshknifer is offline
Send a message via Skype™ to joshknifer
choloo
Senior Member
Join Date: Nov 2014
Location: Groznyj, Chechnya
Old 01-29-2015 , 15:09   Re: Ban Names
Reply With Quote #3

amx_banname "name or steamid", I mean baning ip...
Maybe these can help you:
Advanced bans
Restrict name
Name Replacer

Last edited by choloo; 01-29-2015 at 15:10.
choloo is offline
Old 02-06-2015, 17:40
Eagle07
This message has been deleted by Eagle07.
amir saiaoud
Senior Member
Join Date: May 2015
Location: essaouira , maroc
Old 08-19-2015 , 16:05   Re: Ban Names
Reply With Quote #4

use this
Code:
#include <amxmodx>
#include <amxmisc>


#define PLUGIN "Ban Name"
#define VERSION "1.0"
#define AUTHOR "i dont know who"

#define FILE "names_banned.ini"

new Array:a_ban_names,
	array_size,
	look_file,
	g_cfg[64];

public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR);

	register_concmd("amx_ban_name", "fnBanName", ADMIN_BAN, "<#userid, AuthID or nick>");
	register_concmd("amx_addnick", "fnBanName", ADMIN_BAN, "<nick>");

	set_task(1.5, "load_names");
}

public load_names() {
	get_configsdir(g_cfg, charsmax(g_cfg));
	formatex(g_cfg, charsmax(g_cfg), "%s/%s", g_cfg, FILE);

	if(a_ban_names) ArrayDestroy(a_ban_names);
	a_ban_names = ArrayCreate(48, 16);

	new File = fopen(g_cfg, "rt");

	if(File) {
		new Name[48];
		while(!feof(File)) {
			fgets(File, Name, charsmax(Name));

			trim(Name);

			if(!Name[0])
				continue;

			ArrayPushString(a_ban_names, Name);
		}

		array_size = ArraySize(a_ban_names);

		fclose(File);
		look_file = 1;
	}
	else {
		look_file = 2;
		log_amx("Brak '%s' na serwerze", g_cfg);
	}
}

public fnBanName(id, level, cid) {
	if(!cmd_access(id, level, cid, 2) || look_file == 0)
		return PLUGIN_HANDLED;

	new param[48], target;
	read_argv(0, param, charsmax(param));
	new bool:isBan = equali(param, "amx_ban_name") ? true : false;
	read_argv(1, param, charsmax(param));
	if(isBan) {
		target = cmd_target(id, param);
		if(!target)
			return PLUGIN_HANDLED;

		get_user_name(target, param, charsmax(param));
	}
	if(checkName(param)) {
		console_print(id, "Juz zbanowany");
		return PLUGIN_HANDLED;
	}
	write_file(g_cfg, param);
	console_print(id, "Zbanowano!");

	ArrayPushString(a_ban_names, param);
	array_size = ArraySize(a_ban_names);

	if(isBan)
		server_cmd("amx_kick #%d ^"Banned in Name!^"", get_user_userid(target));

	return PLUGIN_HANDLED;
}

bool:checkName(name[]) {
	new szName[48], bool:check, i;

	for(i=0; i<array_size; i++) {
		ArrayGetString(a_ban_names, i, szName, charsmax(szName));

		if(equali(name, szName)) {
			check = true;

			break;
		}
	}

	return check;
}

public client_putinserver(id) {
	if(is_user_bot(id))
		return PLUGIN_CONTINUE;

	if(array_size) {
		new name[48];
		get_user_name(id, name, charsmax(name));
		if(checkName(name))
			server_cmd("amx_kick #%d ^"Banned in Name!^"", get_user_userid(id));
	}
	else if(look_file != 2)
		set_task(2.0, "client_putinserver", id);

	return PLUGIN_CONTINUE;
}

public client_infochanged(id) {
	if(is_user_bot(id))
		return PLUGIN_CONTINUE;

	new newName[48], oldName[48];
	get_user_info(id, "name", newName, charsmax(newName));
	get_user_name(id, oldName, charsmax(oldName));

	if(!equali(newName, oldName) && checkName(newName))
		server_cmd("amx_kick #%d ^"Banned in Name!^"", get_user_userid(id));

	return PLUGIN_CONTINUE;
}
__________________
amir saiaoud is offline
Send a message via Skype™ to amir saiaoud
amir saiaoud
Senior Member
Join Date: May 2015
Location: essaouira , maroc
Old 08-19-2015 , 16:06   Re: Ban Names
Reply With Quote #5

add a file with rthe name "names_banned.ini"
__________________
amir saiaoud is offline
Send a message via Skype™ to amir saiaoud
hasanalizxc
Senior Member
Join Date: May 2018
Old 05-17-2018 , 16:20   Re: Ban Names
Reply With Quote #6

Quote:
Originally Posted by amir saiaoud View Post
use this
Code:
#include <amxmodx>
#include <amxmisc>


#define PLUGIN "Ban Name"
#define VERSION "1.0"
#define AUTHOR "i dont know who"

#define FILE "names_banned.ini"

new Array:a_ban_names,
	array_size,
	look_file,
	g_cfg[64];

public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR);

	register_concmd("amx_ban_name", "fnBanName", ADMIN_BAN, "<#userid, AuthID or nick>");
	register_concmd("amx_addnick", "fnBanName", ADMIN_BAN, "<nick>");

	set_task(1.5, "load_names");
}

public load_names() {
	get_configsdir(g_cfg, charsmax(g_cfg));
	formatex(g_cfg, charsmax(g_cfg), "%s/%s", g_cfg, FILE);

	if(a_ban_names) ArrayDestroy(a_ban_names);
	a_ban_names = ArrayCreate(48, 16);

	new File = fopen(g_cfg, "rt");

	if(File) {
		new Name[48];
		while(!feof(File)) {
			fgets(File, Name, charsmax(Name));

			trim(Name);

			if(!Name[0])
				continue;

			ArrayPushString(a_ban_names, Name);
		}

		array_size = ArraySize(a_ban_names);

		fclose(File);
		look_file = 1;
	}
	else {
		look_file = 2;
		log_amx("Brak '%s' na serwerze", g_cfg);
	}
}

public fnBanName(id, level, cid) {
	if(!cmd_access(id, level, cid, 2) || look_file == 0)
		return PLUGIN_HANDLED;

	new param[48], target;
	read_argv(0, param, charsmax(param));
	new bool:isBan = equali(param, "amx_ban_name") ? true : false;
	read_argv(1, param, charsmax(param));
	if(isBan) {
		target = cmd_target(id, param);
		if(!target)
			return PLUGIN_HANDLED;

		get_user_name(target, param, charsmax(param));
	}
	if(checkName(param)) {
		console_print(id, "Juz zbanowany");
		return PLUGIN_HANDLED;
	}
	write_file(g_cfg, param);
	console_print(id, "Zbanowano!");

	ArrayPushString(a_ban_names, param);
	array_size = ArraySize(a_ban_names);

	if(isBan)
		server_cmd("amx_kick #%d ^"Banned in Name!^"", get_user_userid(target));

	return PLUGIN_HANDLED;
}

bool:checkName(name[]) {
	new szName[48], bool:check, i;

	for(i=0; i<array_size; i++) {
		ArrayGetString(a_ban_names, i, szName, charsmax(szName));

		if(equali(name, szName)) {
			check = true;

			break;
		}
	}

	return check;
}

public client_putinserver(id) {
	if(is_user_bot(id))
		return PLUGIN_CONTINUE;

	if(array_size) {
		new name[48];
		get_user_name(id, name, charsmax(name));
		if(checkName(name))
			server_cmd("amx_kick #%d ^"Banned in Name!^"", get_user_userid(id));
	}
	else if(look_file != 2)
		set_task(2.0, "client_putinserver", id);

	return PLUGIN_CONTINUE;
}

public client_infochanged(id) {
	if(is_user_bot(id))
		return PLUGIN_CONTINUE;

	new newName[48], oldName[48];
	get_user_info(id, "name", newName, charsmax(newName));
	get_user_name(id, oldName, charsmax(oldName));

	if(!equali(newName, oldName) && checkName(newName))
		server_cmd("amx_kick #%d ^"Banned in Name!^"", get_user_userid(id));

	return PLUGIN_CONTINUE;
}



Edit/Delete Message Reply With Quote Multi-Quote This Message Quick reply to this message #1
Hi All,

Hope you are well. The Ban Name plugin allows you to ban nicks that you do not want the server to enter. You type the nicks that you want to block in the names_banned.ini file.

I am asking you for help, the plugin can not detect if there is a gap (space) in nick. I added kingplayer text to the names_banned.ini file and tested it worked. But it didn't work with king player nick. For example:

Plugin detects this nick: kingplayer
Plugin cannot detect this nick: king player

Would you please help me with this?
hasanalizxc is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-17-2018 , 21:14   Re: Ban Names
Reply With Quote #7

You can handle this with Restrict Names by using RegEx.
__________________
fysiks is offline
hasanalizxc
Senior Member
Join Date: May 2018
Old 05-17-2018 , 22:14   Re: Ban Names
Reply With Quote #8

Quote:
Originally Posted by fysiks View Post
You can handle this with Restrict Names by using RegEx.
I don't know RegEx and i couldnt understand it. But amir siaoud's plugin is too simple and works like a charm. But plugin cannot detect if there is a gap (space) in nick. I want to solve this problem in this plugin. if you know how can i make it help me..
hasanalizxc is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:19.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode