AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Color Chat isn't working ?! (https://forums.alliedmods.net/showthread.php?t=159669)

byetovice 06-20-2011 04:35

Color Chat isn't working ?!
 
Code:

stock chat_color(const id, const input[], any:...)
{
 new count = 1, players[32]
 static msg[191]
 vformat(msg, 190, input, 3)
 
 replace_all(msg, 190, "!g", "^4")
 replace_all(msg, 190, "!y", "^1")
 replace_all(msg, 190, "!t", "^3")
 
 if (id) players[0] = id; else get_players(players, count, "ch")
 {
  for (new i = 0; i < count; i++)
  {
  if (is_user_connected(players[i]))
  {
    message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i])
    write_byte(players[i]);
    write_string(msg);
    message_end();
  }
  }
 }
}


it's the stock. I'm using that like :
chat_color(0,"[!g%s!y] Has been !tbanned !",playername)

And its printing like This :
[ byetovice ] Has been banned!
It's just printing space :cry: Help me please

DjOptimuS 06-20-2011 05:51

Re: Color Chat isn't working ?!
 
1 Attachment(s)
try the regular colorchat.inc

use it with

PHP Code:

#include <colorchat> 

and

PHP Code:

TeamInfo get_user_msgid("TeamInfo");
SayText get_user_msgid("SayText"); 

in plugin_init()

Syntax:
PHP Code:

public ColorChat(idColor:type, const msg[], {Float,Sql,Result,_}:...) 

Example:
PHP Code:

ColorChat(idRED"message"); 


Stressful 06-21-2011 05:57

Re: Color Chat isn't working ?!
 
ColorChat Tutorial

This is better and easier .
PHP Code:

#include <colorchat> 

PHP Code:

ColorChat(0NORMAL"[^x04 Green^x01] ^x03 Team Color^x01 "); 

PHP Code:

ColorChat(0/NORMAL/GREEN/, "<>"

PHP Code:

// ColorChat(1 > Only for "Host" to see the message.) 

PHP Code:

// ColorChat(0 > For everyone to see) 


OvidiuS 09-21-2011 11:46

Re: Color Chat isn't working ?!
 
i have the same problem, that stock isn't working, and i want to use stock :S

Korxu 09-21-2011 11:56

Re: Color Chat isn't working ?!
 
I'm using this stock and works...
PHP Code:

new g_MsgSay 

PHP Code:

// in plugin_init ( )
g_MsgSay get_user_msgid "SayText" 

PHP Code:

stock print_colored ( const index, const input [ ], const any:... )
{
    new 
players 32 ]
    new 
count
    
new message 191 ]
    new 
i
    
    count 
1
    
    vformat 
message190input)
    
    
replace_all message190"!y""^1" )
    
replace_all message190"!t""^3" )
    
replace_all message190"!g""^4" )
    
    if ( 
index )
    {
        
players ] = index
    
}
        
    else
    {
        
get_players playerscount"ch" )
    }
    
    for ( 
0count++ )
    {
        if ( 
is_user_connected players ] ) )
        {
            
message_begin MSG_ONE_UNRELIABLEg_MsgSay_players ] )
            
write_byte players ] )
            
write_string message )
            
message_end ( )
        }
    }



OvidiuS 09-21-2011 12:07

Re: Color Chat isn't working ?!
 
tested, i just get empty space where !g !y !t should be

abdul-rehman 09-21-2011 12:20

Re: Color Chat isn't working ?!
 
use the colorchat stock that conner made, its much better!

OvidiuS 09-21-2011 12:41

Re: Color Chat isn't working ?!
 
tried this one simple from him, but still nothing
http://forums.alliedmods.net/showthread.php?p=1389276
just empty space

Korxu 09-21-2011 13:01

Re: Color Chat isn't working ?!
 
Quote:

Originally Posted by OvidiuS (Post 1560263)
tested, i just get empty space where !g !y !t should be

Try starting the message with a color, for example: "!y Hello!g guys".

OvidiuS 09-21-2011 13:29

Re: Color Chat isn't working ?!
 
thanks a lot, finally working :)


All times are GMT -4. The time now is 23:26.

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