Raised This Month: $ Target: $400
 0% 

Say_team with '@' problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GarbageBox
Senior Member
Join Date: Feb 2010
Old 06-24-2011 , 06:24   Re: Say_team with '@' problem
Reply With Quote #1

Code:
#include <amxmodx>

#define PLUGIN	"Replace Admin Chat"
#define VERSION	"1.0"
#define AUTHOR	"CCC"

new szName[32], szTag[24];

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR);
	register_clcmd("say_team", "hook_say_team");
}

public hook_say_team(id)
{
	new szText[192], szMessage[192];
	read_args(szText, 191);
	remove_quotes(szText);
	
	get_user_name(id, szName,31);
	
	new players[32], szPnum[32], tempid;
	get_players(players, szPnum[id]);
	for( new i; i<szPnum[id]; i++)
	{
		tempid = players[i]
		
		new CsTeams:szPlayerTeam = cs_get_user_team(tempid)
		new szTeam[32]
		if (szPlayerTeam == CS_TEAM_T)
		{
			szTeam = "[TE]"
		}
		else if (szPlayerTeam == CS_TEAM_CT)
		{
			szTeam = "[CT]"
		}
		else
		{
			szTeam = "[SPEC]"
		}
		
		if(is_user_alive(id))
		{
			format(szMessage, 191, "^x03%s %s ^x01: %s", szTeam, szName, szText)
			client_color(tempid, id, szMessage);
			client_print(tempid, print_console, "%s %s : %s", szTeam, szName, szText)
		}
		else
		{
			format(szMessage, 191, "^x01*DEAD* ^x03%s %s ^x01: %s", szTeam, szName, szText)
			client_color(tempid, id, szMessage);
			client_print(tempid, print_console, "*DEAD* %s %s : %s", szTeam, szName, szText)
		}
		if(contain(szText, "@") == 0)
		{
			if(get_user_flags(id) & ADMIN_ADMIN)
				szTag = "(ADMIN)"
			else
				szTag = "(PLAYER)"
			format(szMessage, 191, "^x04%s %s ^x01: %s", szTag, szName, szText)
			client_color(id, id, szMessage);
		}
	}
	return PLUGIN_HANDLED;
}

public client_color(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
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-25-2011 , 03:49   Re: Say_team with '@' problem
Reply With Quote #2

There is one thing wrong with this code and another that may or may not be wrong with your server (but you didn't describe your problem so I cannot tell you for sure!!!!!!!!)


1. No admin normally has the flag ADMIN_ADMIN. This flag is only used by access() and cmd_access() (and other related functions). You should include amxmisc.inc and use is_user_admin(id).
2. You have the original Admin Chat plugin running.

Rant:

We cannot read minds! Everybody who posts on this forum with a problem needs to accurately describe their problem in detail, if you don't you are more than likely wasting our time and yours. It's starting to get very frustrating.
__________________
fysiks is online now
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 23:34.


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