Raised This Month: $ Target: $400
 0% 

Having Trouble Kicking or Banning Player


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Brad
AMX Mod X Team Member
Join Date: Jun 2004
Old 05-22-2005 , 11:03   Having Trouble Kicking or Banning Player
Reply With Quote #1

Can anyone see anything inherently wrong with the following code:
Code:
kick_player(id, reasonMatch[])
{
	new userid = get_user_userid(id)
	server_cmd("amx_kick #%d inappropriate name (%s)", userid, reasonMatch)
	return PLUGIN_CONTINUE
}

ban_player(id, reasonMatch[])
{
	new userid = get_user_userid(id)
	new banTime = get_cvar_num("restnames_bantime")
	new banLength[50]

	if (banTime == 0)
		banLength = "permanently"
	else if (banTime == 1)
		banLength = "for 1 minute"
	else 
		format(banLength, 49, "for %i minutes", banTime)

	if( get_cvar_num("restnames_amxban") != 1)
	{
		server_cmd("banid %i #%i;writeid", get_cvar_num("restnames_bantime"), userid)
		server_cmd("amx_kick #%i banned %s due to inappropriate name (%s)", userid, banLength, reasonMatch)
	}
	else
	{
		new authid[32]
		get_user_authid(id, authid, 31)

		server_cmd("amx_ban %i %s inappropriate name (%s)", get_cvar_num("restnames_bantime"), authid, reasonMatch)
	}
	return PLUGIN_CONTINUE
}
I'm testing a new plugin I'm writing (my first ever) and I don't seem to be able to kick or ban myself.

Could it be because I have immunity? <moments later> Just tested that theory. I took my immunity off but it still wouldn't kick myself.
Brad is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 05-22-2005 , 11:05  
Reply With Quote #2

Post the whole code, also in [SMALL] tags. =)
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
Brad
AMX Mod X Team Member
Join Date: Jun 2004
Old 05-22-2005 , 15:32  
Reply With Quote #3

I did what you asked but then just now deleted it. The code was working. I had an unwitting player test it for me. It both kicks and bans. It just doesn't do so for admins.

So... Does banid or kick or amx_kick not work on admins?
Brad is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 05-22-2005 , 15:38  
Reply With Quote #4

Code:
cmd_target ( id, const arg[], flags = 1 ) // Flags: // 1 - obey immunity // 2 - allow yourself // 4 - must be alive // 8 - can't be bot
IE:
Code:
new arg[32] read_argv(1,arg,31) new target = cmd_target(id,arg,1)
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
Brad
AMX Mod X Team Member
Join Date: Jun 2004
Old 05-22-2005 , 17:26  
Reply With Quote #5

v3x, I'm not following why you posted that. Are you implying that if I call cmd_target, I'd be able to kick, amx_kick, or banid admins if the proper flags are set?
Brad is offline
Jinto
Member
Join Date: Jun 2004
Location: Seattle, WA
Old 05-22-2005 , 22:15  
Reply With Quote #6

don't use amx_kick. use kick. amx_kick has immunity checks.

Quote:
kick <name/userid> <reason>
Same for ban

Quote:
banid <time> <steamid>
Jinto is offline
Send a message via ICQ to Jinto Send a message via AIM to Jinto Send a message via MSN to Jinto Send a message via Yahoo to Jinto
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 16:47.


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