Raised This Month: $ Target: $400
 0% 

Solved [H3LP] Show Banned Users


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
DarthMan
Veteran Member
Join Date: Aug 2011
Old 04-15-2017 , 05:01   [H3LP] Show Banned Users
Reply With Quote #1

Hello. I've been working on a ban plug-in, and I have an issue with showing banned users in console.
Everything else works fine.

Code:
public cmdShowBans(id, level, cid)
{
	if (!cmd_access(id, level, cid, 1))
		return PLUGIN_HANDLED;
	
	new flags = get_user_flags(id);
	
	if ((is_user_connected(id)) && (!(flags & ADMIN_BAN)))
	{
		client_print(id,print_console,"You do not have access to use this command.");
	}
	new readdata[256]
	new cfgdir[256]
	new cfgpath[256]
	new max_bans
	
	new parsedid[33], parsedname[64], parsedadmin[64];

	get_configsdir(cfgdir, 256-1)

	format(cfgpath, charsmax(cfgpath), "%s/bans.ini", cfgdir)
	new f;
	if (!file_exists(cfgpath))
	{
			client_print(id, print_console, "Ban file is missing")
			return 0;
	}
	f=fopen(cfgpath, "rt")
	parse(readdata, parsedid, charsmax(parsedid), parsedname, charsmax(parsedname), parsedadmin, charsmax(parsedadmin));
	if (!fgets(f,readdata,sizeof(readdata)))
	{
		client_print(id, print_console, "No clients are banned.");
		return PLUGIN_HANDLED;
	}
	else while(fgets(f,readdata,sizeof(readdata)))
	{
		trim(readdata)
		if( !readdata[0] || readdata[0] == ';' || readdata[0] == '/' ) continue; 
		if (contain(readdata,parsedname))
		{
			max_bans++;
			client_print(id, print_console, "%d. %s", max_bans, readdata)
		}
		else
		{
			max_bans++;
			client_print(id, print_console, "%d. No client name found on line %d!", max_bans,  max_bans)
		}
		
	}
	fclose(f)
	return PLUGIN_HANDLED;
}

Last edited by DarthMan; 04-15-2017 at 15:08. Reason: Solved
DarthMan 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 17:50.


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