4JOKE
04-05-2008, 10:47
I tryed to write my first plugin, but i have problem with changing color of chat text. When i write amx_f10 into console, i should see " [player] hello" in green color. But it only says in console "unknown command".
#include <amxmodx>
#include <amxmisc>
public plugin_init()
{
register_plugin("Test", AMXX_VERSION_STR, "Test Plugin");
register_clcmd("amx_test", "cmdtest", ADMIN_ALL);
}
public cmdtest(id)
{
new name[31];
new SayText;
get_user_name(id, name, 31);
static iPlayers[32], iPlayer, plnum;
get_players( iPlayers, plnum, "" );
for( new i = 0; i < plnum; i++ )
{
iPlayer = iPlayers[i];
if( !is_user_admin(iPlayer) )
continue;
new msg[128];
format(msg,127,"^x03 [ %s ] hello ",name);
message_begin(MSG_ONE,SayText,{0,0,0},iPlayer );
write_byte(iPlayer);
write_string(msg);
message_end();
}
}And here is first version of my plugin with normal color of chat text. This is working without problems.
#include <amxmodx>
#include <amxmisc>
public plugin_init()
{
register_plugin("Test", AMXX_VERSION_STR, "Test plugin")
register_clcmd("amx_test", "cmdtest", ADMIN_ALL)
}
public cmdtest(id)
{
new name[31]
get_user_name(id, name, 31)
new i
new maxPlayers
new Players[32]
new playerCount
get_players(Players, playerCount)
maxPlayers = get_maxplayers()
for(i = 0; i <= maxPlayers; i++)
{
if (!is_user_connected(i))
continue
if ( is_user_admin(Players[i]) )
continue
client_print( i, print_chat,"[ %s ] hello",name)
}
}So my question is: How I can write colored text in chat? Can someone correct the source at the top ? thnx.
#include <amxmodx>
#include <amxmisc>
public plugin_init()
{
register_plugin("Test", AMXX_VERSION_STR, "Test Plugin");
register_clcmd("amx_test", "cmdtest", ADMIN_ALL);
}
public cmdtest(id)
{
new name[31];
new SayText;
get_user_name(id, name, 31);
static iPlayers[32], iPlayer, plnum;
get_players( iPlayers, plnum, "" );
for( new i = 0; i < plnum; i++ )
{
iPlayer = iPlayers[i];
if( !is_user_admin(iPlayer) )
continue;
new msg[128];
format(msg,127,"^x03 [ %s ] hello ",name);
message_begin(MSG_ONE,SayText,{0,0,0},iPlayer );
write_byte(iPlayer);
write_string(msg);
message_end();
}
}And here is first version of my plugin with normal color of chat text. This is working without problems.
#include <amxmodx>
#include <amxmisc>
public plugin_init()
{
register_plugin("Test", AMXX_VERSION_STR, "Test plugin")
register_clcmd("amx_test", "cmdtest", ADMIN_ALL)
}
public cmdtest(id)
{
new name[31]
get_user_name(id, name, 31)
new i
new maxPlayers
new Players[32]
new playerCount
get_players(Players, playerCount)
maxPlayers = get_maxplayers()
for(i = 0; i <= maxPlayers; i++)
{
if (!is_user_connected(i))
continue
if ( is_user_admin(Players[i]) )
continue
client_print( i, print_chat,"[ %s ] hello",name)
}
}So my question is: How I can write colored text in chat? Can someone correct the source at the top ? thnx.