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

CS 1.6 Ban Name Plugin Modification


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
hasanalizxc
Senior Member
Join Date: May 2018
Old 05-17-2018 , 14:08   CS 1.6 Ban Name Plugin Modification
Reply With Quote #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?

You can find the plugin in this link and in the attachment zip file.

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;
}
Attached Files
File Type: zip ban_name.zip (5.2 KB, 181 views)

Last edited by hasanalizxc; 05-18-2018 at 07:03.
hasanalizxc is offline
CrAzY MaN
Senior Member
Join Date: Mar 2017
Location: India
Old 05-17-2018 , 14:31   Re: CS 1.6 Ban Name Plugin Modification
Reply With Quote #2

Search for "Restrict Names"
__________________
CrAzY MaN is offline
hasanalizxc
Senior Member
Join Date: May 2018
Old 05-17-2018 , 14:39   Re: CS 1.6 Ban Name Plugin Modification
Reply With Quote #3

Quote:
Originally Posted by CrAzY MaN View Post
Search for "Restrict Names"
restrict names plugin is very sophisticated i couldnt understand .ini file. my plugin is too simple.

Last edited by hasanalizxc; 05-17-2018 at 14:42.
hasanalizxc is offline
tarsisd2
Veteran Member
Join Date: Feb 2016
Location: brazil
Old 05-17-2018 , 18:02   Re: CS 1.6 Ban Name Plugin Modification
Reply With Quote #4

Quote:
Originally Posted by hasanalizxc View Post
restrict names plugin is very sophisticated i couldnt understand .ini file. my plugin is too simple.
nonsense, that plugin does exactly what you want and better

in cvar you can put like
restnames_default_name "Nick Not Allowed"

in restrictnames.ini

whatevernick "change your nick" 0
secondnick "change your nick" 0

that means that whoever has those nicks, will receive a msg "change your nick" and it will be changed to "Nick Not Allowed"

you can set everything as you desire, can't be hard to understand
tarsisd2 is offline
hasanalizxc
Senior Member
Join Date: May 2018
Old 05-17-2018 , 18:26   Re: CS 1.6 Ban Name Plugin Modification
Reply With Quote #5

Quote:
Originally Posted by tarsisd2 View Post
nonsense, that plugin does exactly what you want and better

in cvar you can put like
restnames_default_name "Nick Not Allowed"

in restrictnames.ini

whatevernick "change your nick" 0
secondnick "change your nick" 0

that means that whoever has those nicks, will receive a msg "change your nick" and it will be changed to "Nick Not Allowed"

you can set everything as you desire, can't be hard to understand

For example i have a blacklist and could you please show me how can i add these? I couldnt understand regex logic. Please update .ini file and reupload with these nicks.

No Name ^ . ^
Hades Underwold ; CS
Ccash ! Ccomedy
[Anti]'Biyotik

And i have a question can plugin detect nicks with spaces (gap) between them like above?
hasanalizxc is offline
tarsisd2
Veteran Member
Join Date: Feb 2016
Location: brazil
Old 05-17-2018 , 21:22   Re: CS 1.6 Ban Name Plugin Modification
Reply With Quote #6

Quote:
Originally Posted by hasanalizxc View Post
For example i have a blacklist and could you please show me how can i add these? I couldnt understand regex logic. Please update .ini file and reupload with these nicks.

No Name ^ . ^
Hades Underwold ; CS
Ccash ! Ccomedy
[Anti]'Biyotik

And i have a question can plugin detect nicks with spaces (gap) between them like above?
should be simple, like this

"No Name ^ . ^" "change your nick" 0
"Hades Underwold ; CS" "change your nick" 0
"Ccash ! Ccomedy" "change your nick" 0
[Anti]'Biyotik "change your nick" 0


can't be easier than that!
tarsisd2 is offline
hasanalizxc
Senior Member
Join Date: May 2018
Old 05-17-2018 , 22:11   Re: CS 1.6 Ban Name Plugin Modification
Reply With Quote #7

Quote:
Originally Posted by tarsisd2 View Post
should be simple, like this

"No Name ^ . ^" "change your nick" 0
"Hades Underwold ; CS" "change your nick" 0
"Ccash ! Ccomedy" "change your nick" 0
[Anti]'Biyotik "change your nick" 0


can't be easier than that!
i did but it didnt worked for me.

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
CrAzY MaN
Senior Member
Join Date: Mar 2017
Location: India
Old 05-17-2018 , 22:26   Re: CS 1.6 Ban Name Plugin Modification
Reply With Quote #8

[Use "king player"
Put double quotes!
__________________
CrAzY MaN is offline
hasanalizxc
Senior Member
Join Date: May 2018
Old 05-18-2018 , 06:57   Re: CS 1.6 Ban Name Plugin Modification
Reply With Quote #9

Quote:
Originally Posted by CrAzY MaN View Post
[Use "king player"
Put double quotes!
i tested but doesnt work. i want to simple modification to the first share. is it too hard for alliedmods members?
hasanalizxc is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 05-18-2018 , 12:45   Re: CS 1.6 Ban Name Plugin Modification
Reply With Quote #10

Just remove trim from the script
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Reply


Thread Tools
Display Modes

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 04:48.


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