Raised This Month: $ Target: $400
 0% 

client_infochanged query


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
hyphen
Senior Member
Join Date: Aug 2011
Old 08-13-2012 , 01:29   client_infochanged query
Reply With Quote #1

As client_infochanged is called several times while a player joins, if I want to check for a name tag in admins names is it correct approach ?

Code:
public client_infochanged(id) 
{	
	if(!get_pcvar_num(amx_admintag_enabled))
		return PLUGIN_CONTINUE
		
	new szName[32], szOldName[32]
	get_user_info(id, "name", szName, 31)
	get_user_name(id, szOldName, 31)
	
	// if(equal(szOldName, szName))
		// return PLUGIN_HANDLED
		
	new bool:bTagged = true
	new szNameTmp[32]
	for(new i=0; i<g_admintaglen; i++)
	{
		if(g_admintag[i] != szName[i])
			bTagged = false
	}
	if(get_user_flags(id) & ADMIN_KICK)
	{
		if(!bTagged)
		{
			format(szNameTmp, 31, "%s %s", g_admintag, szName)
			//client_cmd(id, "name ^"%s^"", szNameTmp)
			set_user_info(id, "name", szNameTmp)
			
			client_cmd(id, "echo %s %s", NAME_TAG_ADMIN, g_admintag)
			set_hudmessage(0, 204, 0, -1.0, 0.21)
			show_hudmessage(id, "%s %s", NAME_TAG_ADMIN, g_admintag)
		}
	}
}
hyphen is offline
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 08-13-2012 , 03:32   Re: client_infochanged query
Reply With Quote #2

instead of for loop you could use containi native
Code:
if (containi(szName, g_admintag) != 0) bTagged = false
jimaway is offline
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 05:50.


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