Raised This Month: $ Target: $400
 0% 

[SOLVE]My code make say team message print to everyone.


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
GarbageBox
Senior Member
Join Date: Feb 2010
Old 07-29-2011 , 14:53   [SOLVE]My code make say team message print to everyone.
Reply With Quote #1

I want to re-write the say team and I'm using a stock version color chat.
But when I test it, I found out that it print the team say message to another team.
How can fix it?
Code:
new szName[32], szTag[24];
new iPlayers[32], iNum;
//...
public hook_say_team(id)
{
	new szMessages[192];
	read_args(szMessages, 191);
	remove_quotes(szMessages);	
	
	get_user_name(id, szName, 31);
	
	new szAlive = is_user_alive(id);
	
	if(szMessages[0] != '@')
	{
		new szTeam[33], szDead[33];
		if(get_user_team(id) == 1)
		{
			szTeam = "(TR)";
			szDead = "*DEAD*";
		}
		else if(get_user_team(id) == 2)
		{
			szTeam = "(CT)";
			szDead = "*DEAD*";
		}
		else if(get_user_team(id) == 3)
		{
			szTeam = "(SPEC)";
			szDead = "";
		}
		(szAlive ? client_printc(0, "^x04%s ^x03%s ^x01: %s", szTeam, szName, szMessages) : client_printc(0, "^x01%s ^x04%s ^x03%s ^x01: %s", szDead, szTeam, szName, szMessages));
	}
	else
	{
		if(get_user_flags(id) & ADMIN_ADMIN)
			szTag = "(ADMIN)"
		else
			szTag = "(PLAYER)"
			
		get_players(iPlayers , iNum , "ch");
		
		for(new i = 0; i < iNum; i++)
		{
			if(get_user_flags(iPlayers[i]) & ADMIN_CHAT)
			{
				client_printc(iPlayers[i], "^x04%s ^x03%s ^x01: %s", szTag, szName, szMessages[1]);
			}
			if(get_user_flags(iPlayers[i]) & ADMIN_USER)
			{
				client_printc(id, "^x04%s ^x03%s ^x01: %s", szTag, szName, szMessages[1]);
			}
		}
	}
}

stock client_printc(const id, const string[], {Float, Sql, Resul,_}:...)
{
	new msg[191], players[32], count = 1;
	vformat(msg, sizeof msg - 1, string, 3);
	
	replace_all(msg,190,"\g","^4");
	replace_all(msg,190,"\y","^1");
	replace_all(msg,190,"\t","^3");
	
	if(id)
		players[0] = id;
	else
		get_players(players,count,"ch");
	
	new index;
	for (new i = 0 ; i < count ; i++)
	{
		index = players[i];
		message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"),_, index);
		write_byte(index);
		write_string(msg);
		message_end();  
	}  
}
__________________
You can be a SUPER coder but you Haven't to say such as "stupid, etc." words to the others

Last edited by GarbageBox; 07-30-2011 at 06:28.
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 01:10.


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