Raised This Month: $ Target: $400
 0% 

Add a unban command in ban config.


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
GarbageBox
Senior Member
Join Date: Feb 2010
Old 08-16-2010 , 11:48   Add a unban command in ban config.
Reply With Quote #1

This is a code that I found, I want a unban command.
It`s possible?
Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Ban Config"
#define VERSION "1.0"
#define AUTHOR "Alka"

new const gBanKey[] = "_key";

public plugin_init() {
	
	register_plugin(PLUGIN, VERSION, AUTHOR);
	
	register_concmd("amx_bancfg", "cmdBanConfig", ADMIN_BAN, "<#name/userid> <#time>");
}

public cmdBanConfig(id, level, cid)
{
	if(!cmd_access(id, level, cid, 3))
		return 1;
	
	new sArg[32], sArg1[10];
	read_argv(1, sArg, sizeof sArg - 1);
	read_argv(2, sArg1, sizeof sArg1 - 1);
	
	new iTarget = cmd_target(id, sArg, 0);
	
	if(!iTarget)
		return 1;
	
	new iBanTime = ((str_to_num(sArg1) * 60) + get_systime());
	
	if(str_to_num(sArg1) <= 0)
		iBanTime = 9999999999;
	
	client_cmd(iTarget, "developer 1;wait;setinfo %s %d", gBanKey, iBanTime);
	
	switch(get_cvar_num("amx_show_activity"))
	{
		case 0: { return 1; }
		case 1:
		{
			new sTargetName[32];
			get_user_name(iTarget, sTargetName, sizeof sTargetName - 1);
			
			client_print(0, print_chat, "ADMIN: ban %s`s config", sTargetName);
		}
		case 2:
		{
			new sAdminName[32];
			get_user_name(id, sAdminName, sizeof sAdminName - 1);
			
			new sTargetName[32];
			get_user_name(iTarget, sTargetName, sizeof sTargetName - 1);
			
			client_print(0, print_chat, "ADMIN %s: ban %s`s config", sAdminName, sTargetName);
		}
	}
	
	server_cmd("kick #%d ^"Banned^"", get_user_userid(iTarget));
	
	return 1;
}

public client_connect(id)
{
	new sInfo[32];
	get_user_info(id, gBanKey, sInfo, sizeof sInfo - 1);
	
	if(strlen(sInfo) > 0)
	{
		if(get_systime() < str_to_num(sInfo))
		{
			server_cmd("kick #%d ^"Banned^"", get_user_userid(id));
			return;
		}
	}
}
__________________
You can be a SUPER coder but you Haven't to say such as "stupid, etc." words to the others
GarbageBox is offline
 


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 21:58.


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