Raised This Month: $ Target: $400
 0% 

say_team - minor problem


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 07-31-2010 , 13:20   Re: say_team - minor problem
Reply With Quote #7

No, it's not, learn to go through the code and try to simulate in your mind what it does.

Yours, apart from the verry repeatitive call of is_user_alive(), you're calling it wrong, you need to check if the sender is alive, not the receiver.

Code:
public say_team(id)
{
	static name[32], mes[200], players[32], player, alive, num, i, CsTeams:team;

	read_args(mes, 199);
	remove_quotes(mes);
	trim(mes);

	get_user_name(id, name, 31);
	alive = is_user_alive(id);
	team = cs_get_user_team(id);

	num = get_playersnum();
	get_players(players, num, "c");

	for (i = 0; i < num; i++)
	{
		player = players[i];

		/* you could replace is_user_connected(player) with is_user_alive(player) == alive if you don't want dead-alive chat. */

		if(is_user_connected(player) && cs_get_user_team(player) == team)
			chat(player, "!team[Team] *%s* !g%s !y: !team%s", (alive ? "ALIVE" : "DEAD"), name, mes);
	}

	return PLUGIN_HANDLED;
}
__________________

Last edited by Hunter-Digital; 07-31-2010 at 13:24. Reason: rasn fasn vbulletin X(
Hunter-Digital 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 00:16.


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