Raised This Month: $ Target: $400
 0% 

Help with hide player say again.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GarbageBox
Senior Member
Join Date: Feb 2010
Old 08-04-2010 , 01:02   Help with hide player say again.
Reply With Quote #1

I`m trying to write a plugin to my friend, A basic chat format in cs.
He say he want to change sth.
But when I finish it, I found some problems.
The plugin can not hide what player say.
This is already in the order plugin to hide player say, but it`s not work. > return PLUGIN_HANDLED
So I decided to post my code in here and want some helps.
Please correct my code if these is sth wrong.
Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>

#define PLUGIN_NAME	"Basic Chat Format"
#define PLUGIN_VERSION	"1.0"
#define PLUGIN_AUTHOR	"NoName"

new players[33][32]
new num[33]

public plugin_init()
{
	register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
	register_clcmd("say", "hook_say")
	register_clcmd("say_team", "hook_team_say")
}

public hook_say(id)
{
	new chat[192]
	read_args(chat, 191)
	remove_quotes(chat)
	
	new name[32], message[256]
	get_user_name(id, name, 31)
	
	new CsTeams:userteam =cs_get_user_team(id)
	if(equal(chat, ""))
		return PLUGIN_HANDLED_MAIN
	
	if (is_user_alive(id))
	{
		format(message, 255, "^x03%s ^x01: %s", name, chat)
		color_chat(0, id, message)
	}
	else if (!is_user_alive(id) && userteam != CS_TEAM_SPECTATOR)
	{
		format(message, 255, "^x01*DEAD* ^x03%s ^x01: %s", name, chat)
		color_chat(0, id, message)
	}
	else 
	{
		format(message, 255, "^x01*SPEC* ^x03%s ^x01: %s", name, chat)
		color_chat(0, id, message)
	}
 	return PLUGIN_CONTINUE
}

public hook_team_say(id)
{
	new chat[192]
	read_args(chat, 191)
	remove_quotes(chat)
	
	new name[32], message[256], team[32]
	get_user_name(id, name, 31)
	
	if(equal(chat, ""))
		return PLUGIN_HANDLED_MAIN
	
	new CsTeams:userteam =cs_get_user_team(id)
	if (userteam == CS_TEAM_T)
	{
		get_players(players[id], num[id], _, "TERRORIST")
		team = "(TR)"
	}
	else if (userteam == CS_TEAM_CT)
	{
		get_players(players[id], num[id], _, "CT")
		team = "(CT)"
	}
	else
	{
		get_players(players[id], num[id], _, "SPECTATOR")
		team = "(SPEC)"
	}
	for (new a = 0; a < num[id]; ++a)
	{
		new i = players[id][a]
		if (is_user_alive(id))
		{
			format(message, 255, "^x03%s %s ^x01: %s", team, name, chat)
			color_chat(i, id, message)
		}
		else if (!is_user_alive(id) && userteam != CS_TEAM_SPECTATOR)
		{
			format(message, 255, "^x01*DEAD*^x03%s %s ^x01: %s", team, name, chat)
			color_chat(i, id, message)
		}
		else
		{
			format(message, 255, "^x03%s %s ^x01: %s", team, name, chat)
			color_chat(i, id, message)
		}
	}
	return PLUGIN_CONTINUE
}

public color_chat(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()
}

/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ ansicpg936\\ deff0{\\ fonttbl{\\ f0\\ fnil\\ fcharset134 Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang2052\\ f0\\ fs16 \n\\ par }
*/
__________________
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 08-04-2010 , 02:27   Re: Help with hide player say again.
Reply With Quote #2

Quote:
Originally Posted by GarbageBox View Post
return PLUGIN_HANDLED
__________________
fysiks is offline
GarbageBox
Senior Member
Join Date: Feb 2010
Old 08-04-2010 , 02:34   Re: Help with hide player say again.
Reply With Quote #3

I have tried change all to return PLUGIN_HANDLED, but it will make other say command not work.
Just say /admin, it won`t show anything.
__________________
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 08-04-2010 , 02:36   Re: Help with hide player say again.
Reply With Quote #4

Quote:
Originally Posted by GarbageBox View Post
I have tried change all to return PLUGIN_HANDLED, but it will make other say command not work.
Just say /admin, it won`t show anything.
Then put this plugin as the last plugin in the plugins.ini. iirc
__________________
fysiks is offline
GarbageBox
Senior Member
Join Date: Feb 2010
Old 08-04-2010 , 03:04   Re: Help with hide player say again.
Reply With Quote #5

OKay.
It`s fixed now.
Thank for your help!
I`ve a question, how to make a plugin that admin could not close in the plugin menu
__________________
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-04-2010 at 03:18.
GarbageBox is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-04-2010 , 13:28   Re: Help with hide player say again.
Reply With Quote #6

Quote:
Originally Posted by GarbageBox View Post
I`ve a question, how to make a plugin that admin could not close in the plugin menu
What???? Sounds unrelated to this topic. New question = new thread.
__________________
fysiks 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 00:17.


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