Raised This Month: $ Target: $400
 0% 

Having Trouble Kicking or Banning Player


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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
 



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