AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Colour text (https://forums.alliedmods.net/showthread.php?t=95541)

ƒa†es™ 06-24-2009 15:15

Colour text
 
Can i ask a question ?

PHP Code:

client_print(idprint_chat"[ZP] You has bought Counter Strike."

Anyone knows a way to add colour at [ZP]

PHP Code:

[ZP


Xellath 06-24-2009 15:17

Re: Colour text
 
ColorChat natives.

znovit 06-24-2009 15:59

Re: Colour text
 
#include <colorchat>

ColorChat(id, GREEN,"[ZP] ^x01You has bought Counter Strike.");

This will make the [ZP] tag green and the "You has bought Counter strike client's con_color color.

MagNeto 06-24-2009 16:05

Re: Colour text
 
Or
Code:

client_print(id, print_chat, "^x04[ZP] ^x01You has bought Counter Strike.")

xPaw 06-24-2009 16:12

Re: Colour text
 
It will no work.

SchlumPF* 06-24-2009 16:14

Re: Colour text
 
SayText message ->"^x04 green ^x01con_color ^x03 team_color" OR colorchat

if you want to show a red text to counter-terrorist you should use colorchat, else i would recommend writing an own little stock like this:

PHP Code:

stock chat_printplr, const message[], { FloatSqlResult}:... )
{
    static 
msg[192], saytextmaxplayers;
    
formatmsg191"^x04[ZP]^x01 " ); // (green)[ZP] (con_color)message
    
vformatmsg[7], 185message);
    
    if( !
saytext )
    {
        
saytext get_user_msgid"SayText" );
    }
    
    if( !
maxplayers )
    {
        
maxplayers get_maxplayers( );
    }

    if( 
plr <= maxplayers && plr )
    {
        
message_beginMSG_ONE_UNRELIABLEsaytext, {000}, plr );
        
write_byteplr );
        
write_stringmsg );
        
message_end( );
    }
    else if( !
plr )
    {
        for( new 
1<= maxplayersi++ )
        {
            if( !
is_user_connected) )
            {
                continue;
            }
            
            
message_beginMSG_ONE_UNRELIABLEsaytext, { 00}, );
            
write_byte);
            
write_stringmsg );
            
message_end( );
        }
    }
    
    return 
1;



ConnorMcLeod 06-24-2009 16:18

Re: Colour text
 
http://forums.alliedmods.net/showthread.php?t=94960

SchlumPF* 06-24-2009 16:21

Re: Colour text
 
Quote:

Originally Posted by ConnorMcLeod (Post 856173)

still it shouldnt be used for a case i described even though chat messages are not printed often enough to talk about efficiency!!!

ConnorMcLeod 06-24-2009 16:23

Re: Colour text
 
Depend if he uses it in other plugins or not.

ƒa†es™ 07-08-2009 03:17

Re: Colour text
 
Quote:

Originally Posted by SchlumPF* (Post 856170)
SayText message ->"^x04 green ^x01con_color ^x03 team_color" OR colorchat

if you want to show a red text to counter-terrorist you should use colorchat, else i would recommend writing an own little stock like this:

PHP Code:

stock chat_printplr, const message[], { FloatSqlResult}:... )
{
    static 
msg[192], saytextmaxplayers;
    
formatmsg191"^x04[ZP]^x01 " ); // (green)[ZP] (con_color)message
    
vformatmsg[7], 185message);
 
    if( !
saytext )
    {
        
saytext get_user_msgid"SayText" );
    }
 
    if( !
maxplayers )
    {
        
maxplayers get_maxplayers( );
    }
 
    if( 
plr <= maxplayers && plr )
    {
        
message_beginMSG_ONE_UNRELIABLEsaytext, {000}, plr );
        
write_byteplr );
        
write_stringmsg );
        
message_end( );
    }
    else if( !
plr )
    {
        for( new 
1<= maxplayersi++ )
        {
            if( !
is_user_connected) )
            {
                continue;
            }
 
            
message_beginMSG_ONE_UNRELIABLEsaytext, { 00}, );
            
write_byte);
            
write_stringmsg );
            
message_end( );
        }
    }
 
    return 
1;



I use the stock it doesn't work ? or i'm wrong.

PHP Code:

#include <amxmodx>
 
#define TIME_DELAY 1.0
#define TEXT_SAY "^x04[AMX]^x01Testing Colour." 
 
public plugin_init() 
{
        
register_plugin("Colourtext","1337","always.")
        
set_task(TIME_DELAY"Colour"0__"b")
}
 
public 
Colour()
{
        
client_print(0print_chatTEXT_SAY)
}
 
stock chat_printplr, const message[], { FloatSqlResult}:... )
{
    static 
msg[192], saytextmaxplayers;
    
formatmsg191"^x04[AMX]^x01 " );
    
vformatmsg[7], 185message);
 
    if( !
saytext )
    {
        
saytext get_user_msgid"SayText" );
    }
 
    if( !
maxplayers )
    {
        
maxplayers get_maxplayers( );
    }
 
    if( 
plr <= maxplayers && plr )
    {
        
message_beginMSG_ONE_UNRELIABLEsaytext, {000}, plr );
        
write_byteplr );
        
write_stringmsg );
        
message_end( );
    }
    else if( !
plr )
    {
        for( new 
1<= maxplayersi++ )
        {
            if( !
is_user_connected) )
            {
                continue;
            }
 
            
message_beginMSG_ONE_UNRELIABLEsaytext, { 00}, );
            
write_byte);
            
write_stringmsg );
            
message_end( );
        }
    }
 
    return 
1;


It still no colour.


All times are GMT -4. The time now is 15:42.

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