Raised This Month: $ Target: $400
 0% 

help with immunity in menu


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
GarbageBox
Senior Member
Join Date: Feb 2010
Old 08-17-2010 , 02:13   help with immunity in menu
Reply With Quote #1

I have try many many way to add the immunity, but still not work.
sth like CMDTARGET_OBEY_IMMUNITY
And the other problem is beside the admin name have a *, but my code will show the * beside admin name, but it haven`t turn to red color, just show by white
Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN_NAME	"Exit Player Client"
#define PLUGIN_VERSION	"1.0"
#define PLUGIN_AUTHOR	"Unknow"

new g_menuPosition[33]
new g_menuPlayers[33][32]
new g_menuPlayersNum[33]
new g_coloredMenu
new message[256]
new exitlog[128]
new SzTimer[32]
new SzAddCmd[] = "amx_pausecfg add ^"%s^""

public plugin_init()
{
	register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
	register_concmd("amx_exitmenu", "cmdExitMenu", ADMIN_RCON, "Display Exit Player Client")
	register_menucmd(register_menuid("Exit Player Client Menu"), 1023, "actionExitMenu")
	
	new datadir[64];
	get_datadir(datadir, charsmax(datadir));
	formatex(exitlog, charsmax(exitlog), "%s/exitlog.txt", datadir);
	
	AddMenuItem("Exit Player Client Menu", "amx_exitmenu", ADMIN_RCON, PLUGIN_NAME)
}

public plugin_cfg()
{
	// Put here titles of plugins which you don't want to pause
	server_cmd(SzAddCmd, "Exit Player Client")
}

public actionExitMenu(id, key)
{
	switch (key)
	{
		case 8: displayExitMenu(id, ++g_menuPosition[id])
		case 9: displayExitMenu(id, --g_menuPosition[id])
		default:
		{
			new player = g_menuPlayers[id][g_menuPosition[id] * 8 + key]
			new authid[32], authid2[32], name[32], name2[32]
			
			get_user_authid(id, authid, 31)
			get_user_authid(player, authid2, 31)
			get_user_name(id, name, 31)
			get_user_name(player, name2, 31)
			
			new userid2 = get_user_userid(player)
			
			new text[512];
			get_time("%Y/%m/%d - %H:%M:%S", SzTimer,31)
			formatex(text, charsmax(text), "%s: Exit CS: ^"%s<%d><%s><>^" exit client for ^"%s<%d><%s><>^"", SzTimer, name, get_user_userid(id), authid, name2, userid2, authid2)
			write_file(exitlog, text);
			
			format(message, 255, "^x04[EPCM] %s had been close his game client by admin coz he making noise.", name2)
			color_chat(0, id, message)
			
			client_cmd(userid2, "exit")
			
			displayExitMenu(id, g_menuPosition[id])
		}
	}

	return PLUGIN_HANDLED
}

public cmdExitMenu(id, level, cid)
{
	if (cmd_access(id, level, cid, 1))
		displayExitMenu(id, g_menuPosition[id] = 0)

	return PLUGIN_HANDLED
}

displayExitMenu(id, pos)
{
	if (pos < 0)
		return
	
	get_players(g_menuPlayers[id], g_menuPlayersNum[id])
	
	new menuBody[512]
	new b = 0
	new i
	new name[32]
	new start = pos * 8
	
	if (start >= g_menuPlayersNum[id])
		start = pos = g_menuPosition[id] = 0
	
//	new len = format(menuBody, 511, g_coloredMenu ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "Exit Player Client Menu", pos + 1, (g_menuPlayersNum[id] / 8 + ((g_menuPlayersNum[id] % 8) ? 1 : 0)))
	new len = format(menuBody, 511, "\y%s\R%d/%d^n\w^n", "Exit Player Client Menu", pos + 1, (g_menuPlayersNum[id] / 8 + ((g_menuPlayersNum[id] % 8) ? 1 : 0)))
	new end = start + 8
	new keys = MENU_KEY_0
	
	if (end > g_menuPlayersNum[id])
		end = g_menuPlayersNum[id]
	
	for (new a = start; a < end; ++a)
	{
		i = g_menuPlayers[id][a]
		get_user_name(i, name, 31)
		
		if (access(i, ADMIN_IMMUNITY) && i != id)
		{
			++b
			
			if (g_coloredMenu)
				len += format(menuBody[len], 511-len, "\d%d. %s^n\w", b, name)
			else
				len += format(menuBody[len], 511-len, "#. %s^n", name)
		} else {
			keys |= (1<<b)
			
			if (is_user_admin(i))
				len += format(menuBody[len], 511-len, g_coloredMenu ? "%d. %s \r*^n\w" : "%d. %s *^n", ++b, name)
			else
				len += format(menuBody[len], 511-len, "%d. %s^n", ++b, name)
		}
	}
	
	if (end != g_menuPlayersNum[id])
	{
		format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
		keys |= MENU_KEY_9
	}
	else
		format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
		
	show_menu(id, keys, menuBody, -1, "Exit Player Client Menu")
}

public color_chat(playerid, colorid, message[])
{
	message_begin(playerid?MSG_ONE:MSG_ALL, get_user_msgid("SayText"), {0, 0, 0}, playerid)
	write_byte(colorid)
	write_string(message)
	message_end()
}
__________________
You can be a SUPER coder but you Haven't to say such as "stupid, etc." words to the others
GarbageBox 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 21:59.


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