plugins/basechat.sp
changeset 2759 67086a60e829
parent 2583 d3b2571c378b
child 2810 2ceb5b2b0da0
     1.1 --- a/plugins/basechat.sp	Mon Jul 27 16:45:30 2009 -0700
     1.2 +++ b/plugins/basechat.sp	Mon Jul 27 17:02:04 2009 -0700
     1.3 @@ -190,10 +190,7 @@
     1.4  	decl String:message[192];
     1.5  	strcopy(message, 192, text[startidx+1]);
     1.6  
     1.7 -	decl String:name[64];
     1.8 -	GetClientName(client, name, sizeof(name));
     1.9 -	
    1.10 -	SendChatToAdmins(name, message);
    1.11 +	SendChatToAdmins(client, message);
    1.12  	LogAction(client, -1, "%L triggered sm_chat (text %s)", client, message);
    1.13  	
    1.14  	return Plugin_Handled;	
    1.15 @@ -313,10 +310,7 @@
    1.16  	decl String:text[192];
    1.17  	GetCmdArgString(text, sizeof(text));
    1.18  
    1.19 -	decl String:name[64];
    1.20 -	GetClientName(client, name, sizeof(name));
    1.21 -	
    1.22 -	SendChatToAdmins(name, text);
    1.23 +	SendChatToAdmins(client, text);
    1.24  	LogAction(client, -1, "%L triggered sm_chat (text %s)", client, text);
    1.25  	
    1.26  	return Plugin_Handled;	
    1.27 @@ -451,22 +445,20 @@
    1.28  	}
    1.29  }
    1.30  
    1.31 -SendChatToAdmins(String:name[], String:message[])
    1.32 +SendChatToAdmins(from, String:message[])
    1.33  {
    1.34 +	new fromAdmin = CheckCommandAccess(from, "sm_chat", ADMFLAG_CHAT);
    1.35  	for (new i = 1; i <= MaxClients; i++)
    1.36  	{
    1.37 -		if (IsClientInGame(i))
    1.38 +		if (IsClientInGame(i) && (from == i || CheckCommandAccess(i, "sm_chat", ADMFLAG_CHAT)))
    1.39  		{
    1.40 -			if (CheckCommandAccess(i, "sm_chat", ADMFLAG_CHAT))
    1.41 +			if (g_DoColor)
    1.42  			{
    1.43 -				if (g_DoColor)
    1.44 -				{
    1.45 -					PrintToChat(i, "\x04(ADMINS) %s: \x01%s", name, message);
    1.46 -				}
    1.47 -				else
    1.48 -				{
    1.49 -					PrintToChat(i, "(ADMINS) %s: %s", name, message);
    1.50 -				}
    1.51 +				PrintToChat(i, "\x04(%sADMINS) %N: \x01%s", fromAdmin ? "" : "TO ", from, message);
    1.52 +			}
    1.53 +			else
    1.54 +			{
    1.55 +				PrintToChat(i, "(%sADMINS) %N: %s", fromAdmin ? "" : "TO ", from, message);
    1.56  			}
    1.57  		}	
    1.58  	}