Raised This Month: $ Target: $400
 0% 

[SOLVED]Admin chat function problems again.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GarbageBox
Senior Member
Join Date: Feb 2010
Old 07-31-2011 , 13:05   [SOLVED]Admin chat function problems again.
Reply With Quote #1

I felt confused about my code which highlighted in red color.
As I won't use adminchat.amxx but I still want to use the ADMIN channel function, so I put it in my code, but it seems doesn't work correctly.
If I don't have any flags, I can't see what I said.
But the admin who has chat flags can see.
Code:
public cmdHookSayTeam(id)
{
	new iMessages[192];
	read_args(iMessages, 191);
	remove_quotes(iMessages);	
	
	get_user_name(id, iUserName, 31);
	
	if(iMessages[0] != '@')
	{
		static player;
		
		for(player = 1; player <= gMaxplayers; player++)
		{
			//...
		}
	}
	else
	{
		if(get_user_flags(id) & ADMIN_ADMIN)
			iTag = "(ADMIN)"
		else
			iTag = "(PLAYER)"
		
		new iPlayers[32], iNum;
		get_players(iPlayers, iNum, "ch");
		
		for(new i = 0; i < iNum; i++)
		{
			if(get_user_flags(iPlayers[i]) & ADMIN_CHAT)
			{
				client_color(iPlayers[i], id, "^x04%s ^x03%s ^x01: %s", iTag, iUserName, iMessages[1]);
			}
			else if(!is_user_admin(iPlayers[i]))
			{
				client_color(iPlayers[i], id, "^x04%s ^x03%s ^x01: %s", iTag, iUserName, iMessages[1]);
			}
		}
	}
	return PLUGIN_HANDLED;
}
__________________
You can be a SUPER coder but you Haven't to say such as "stupid, etc." words to the others

Last edited by GarbageBox; 08-01-2011 at 03:49.
GarbageBox is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-31-2011 , 16:12   Re: Admin chat function problems again.
Reply With Quote #2



PHP Code:
    for(new 0iNumi++)
    {
        if(
get_user_flags(iPlayers[i]) & ADMIN_CHAT && id != iPlayers[i])
        {
            
client_color(iPlayers[i], id"^x04%s ^x03%s ^x01: %s"iTagiUserNameiMessages[1]);
        }
    }
    
client_color(idid"^x04%s ^x03%s ^x01: %s"iTagiUserNameiMessages[1]); 
Your client_color() function is certaintly wrong. Why would the second parameter be "id"? I would recommend this.
__________________
fysiks is offline
GarbageBox
Senior Member
Join Date: Feb 2010
Old 08-01-2011 , 03:49   Re: [SOLVED]Admin chat function problems again.
Reply With Quote #3

Thank you again.
BTW, I will try it.
__________________
You can be a SUPER coder but you Haven't to say such as "stupid, etc." words to the others
GarbageBox is offline
Reply



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 03:31.


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