Veteran Member
Join Date: Jul 2006
Location: France (95)
|
12-28-2013
, 02:29
Re: [Dyn Native] ColorChat v0.3.2 (04 jul 2013)
|
#262
|
Here is updated ghostchat :
ghostchat
PHP Code:
#include <amxmodx>
#include <amxmisc>
#pragma semicolon 1
// Ghostchat disabled by default
new g_iGhostChat = 3; // Set to let HLTV see alive chat by default.
public plugin_init()
{
register_plugin("Ghostchat", "0.4.0", "NetRipper");
register_clcmd("say", "handle_say");
register_concmd("amx_ghostchat", "ConCmd_GhostChat", ADMIN_LEVEL_B, "<mode>");
}
// Return current setting or set new value
public ConCmd_GhostChat(id, level, cid)
{
// No switches given
if (read_argc() < 2)
{
switch( g_iGhostChat )
{
case 1:
{
console_print(id, "[AMX] Ghostchat status: Dead can read alive (NOT TEAMSAY)");
}
case 2:
{
console_print(id, "[AMX] Ghostchat status: Dead and alive can read eachother (NOT TEAMSAY)");
}
case 3:
{
console_print(id, "[AMX] Ghostchat status: HLTV can read chat of the living (NOT TEAMSAY)");
}
default:
{
console_print(id, "[AMX] Ghostchat status: Disabled (NOT TEAMSAY)");
}
}
if( cmd_access(id, level, cid, 0) )
{
console_print(id, "[AMX] Ghostchat usage: amx_ghostchat 0(disabled), 1(Dead can read alive), 2(Dead and alive can chat), 3(Only HLTV can read alive)");
}
return PLUGIN_HANDLED;
}
// If you don't have enough rights, you can't change anything
if (!cmd_access(id, level, cid, 0))
{
return PLUGIN_HANDLED;
}
new arg[2];
read_argv(1, arg, charsmax(arg));
switch( arg[0] - '0' )
{
case 0:
{
g_iGhostChat = 0;
client_print(0, print_chat, "[AMX] Ghostchat - Plugin has been disabled");
}
case 1:
{
g_iGhostChat = 1;
client_print(0, print_chat, "[AMX] Ghostchat - Dead people can read the chat of the living (NOT TEAMSAY)!");
}
case 2:
{
g_iGhostChat = 2;
client_print(0, print_chat, "[AMX] Ghostchat - Dead and living people can talk to eachother (NOT TEAMSAY)!");
}
case 3:
{
g_iGhostChat = 3;
client_print(0, print_chat, "[AMX] Ghostchat - HLTV can read chat of the living (NOT TEAMSAY)!");
}
default:
{
console_print(id, "[AMX] Ghostchat usage: amx_ghostchat 0(disabled), 1(Dead can read alive), 2(Dead and alive can chat), 3(Only HLTV can read alive)");
return PLUGIN_HANDLED;
}
}
new authid[21], name[32];
get_user_authid(id, authid, charsmax(authid));
get_user_name(id, name, charsmax(name));
log_amx("^"%s<%d><%s><>^" amx_ghostchat %s", name, get_user_userid(id), authid, arg);
return PLUGIN_HANDLED;
}
public handle_say(id)
{
// If plugin is disabled, skip the code
if (g_iGhostChat <= 0)
{
return;
}
// Gather information
new message[192];
read_args(message, charsmax(message));
remove_quotes(message);
if( !IsChatValid(message) )
{
return;
}
// Response to a specific query
if (containi(message,"[G]") != -1)
{
client_print(id,print_chat,"[AMX] Ghostchat - Type amx_ghostchat in console for current status");
}
new players[32], player_count, is_alive = is_user_alive(id);
if( is_alive )
{
switch( g_iGhostChat )
{
case 1, 2:
{
get_players(players, player_count, "bc");
}
case 3:
{
get_players(players, player_count, "h");
}
}
}
else if( g_iGhostChat == 2 )
{
get_players(players, player_count, "ac");
}
else
{
return;
}
new name[32];
get_user_name(id, name, charsmax(name));
for(--player_count; player_count>=0; player_count--)
{
client_print_color(players[player_count], id, "^2[G]*%s*%s : %s", is_alive ? "ALIVE" : "DEAD", name, message);
}
}
IsChatValid( const szChat[] )
{
new cChar, iCharCounter;
while ( ( cChar = szChat[ iCharCounter++ ] ) != EOS )
{
if ( cChar != ' ' )
{
return 1;
}
}
return 0;
}
If you want to force red, then you need to start the string with something else than ^2 (^1 ^3 or ^4) and use ^3 for team color for the words you want to color in red, also use Red as 2nd param instead of 'id'.
__________________
|
|