Raised This Month: $ Target: $400
 0% 

custom colour


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
zombieplague
Veteran Member
Join Date: Apr 2009
Old 03-30-2011 , 02:43   custom colour
Reply With Quote #1

is it possible to make your own custom color like red for an example without using any include just like stock.
zombieplague is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 03-30-2011 , 02:51   Re: custom colour
Reply With Quote #2

Custom colour for what?

EDIT: Are you talking about colour chat?

Last edited by hornet; 03-30-2011 at 03:07. Reason: .
hornet is offline
mottzi
Veteran Member
Join Date: May 2010
Location: Switzerland
Old 03-30-2011 , 04:00   Re: custom colour
Reply With Quote #3

Just search, there are a few stocks.
__________________
Quote:
#define true ((rand() % 2)? true: false) //Happy debugging suckers
mottzi is offline
Send a message via MSN to mottzi
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 03-30-2011 , 07:50   Re: custom colour
Reply With Quote #4

I use this:
PHP Code:
fnColorPrint(id, const szMsg[], {FloatSqlResult,_}:...)
{
    static 
iMsgSayTextiMaxPlayers;
    if(!
iMsgSayText)
        
iMsgSayText get_user_msgid("SayText");
    
    if(!
iMaxPlayers)
        
iMaxPlayers get_maxplayers();
        
    static 
Buffer[190], Buffer2[192], iPlayer
    formatex
(Buffer2charsmax(Buffer2), "^x04[%s] ^x01%s"g_szPrefixszMsg);
    
vformat(Buffercharsmax(Buffer), Buffer23);
    
    if(!
iPlayer)
    {
        while(
iPlayer <= iMaxPlayers)
        {
            if(
is_user_connected(++iPlayer))
                break;
        }
    }
    
    
message_begin(id MSG_ONE_UNRELIABLE MSG_ALLiMsgSayText_iPlayer);
    
write_byte(iPlayer);
    
write_string(Buffer);
    
message_end();

__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
zombieplague
Veteran Member
Join Date: Apr 2009
Old 03-30-2011 , 08:01   Re: custom colour
Reply With Quote #5

how to make red and blue colour ?? i don't want to use team colour. i don't want colourchat. somehow just colour code for my stuff.
zombieplague is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 03-30-2011 , 08:30   Re: custom colour
Reply With Quote #6

You could change his team, print the msg, and set him back to his original team.
I don't know if there's another solution.
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 03-30-2011 , 17:53   Re: custom colour
Reply With Quote #7

Quote:
Originally Posted by drekes View Post
I use this:
PHP Code:
fnColorPrint(id, const szMsg[], {FloatSqlResult,_}:...)
{
    static 
iMsgSayTextiMaxPlayers;
    if(!
iMsgSayText)
        
iMsgSayText get_user_msgid("SayText");
    
    if(!
iMaxPlayers)
        
iMaxPlayers get_maxplayers();
        
    static 
Buffer[190], Buffer2[192], iPlayer
    formatex
(Buffer2charsmax(Buffer2), "^x04[%s] ^x01%s"g_szPrefixszMsg);
    
vformat(Buffercharsmax(Buffer), Buffer23);
    
    if(!
iPlayer)
    {
        while(
iPlayer <= iMaxPlayers)
        {
            if(
is_user_connected(++iPlayer))
                break;
        }
    }
    
    
message_begin(id MSG_ONE_UNRELIABLE MSG_ALLiMsgSayText_iPlayer);
    
write_byte(iPlayer);
    
write_string(Buffer);
    
message_end();

That could produce false results when printing to 1 player for the first time it is called.
For all the times after the first call, it could cause an error where the player is not connected.

Code:
fnColorPrint(id, const szMsg[], {Float, Sql, Result,_}:...) {     static iMsgSayText, iMaxPlayers;     if(!iMsgSayText)         iMsgSayText = get_user_msgid("SayText");         if(!iMaxPlayers)         iMaxPlayers = get_maxplayers();             static Buffer[190], Buffer2[192]     formatex(Buffer2, charsmax(Buffer2), "^x04[%s] ^x01%s", g_szPrefix, szMsg);     vformat(Buffer, charsmax(Buffer), Buffer2, 3);         new iPlayer = id;         if(!iPlayer)     {         while(iPlayer <= iMaxPlayers)         {             if(is_user_connected(++iPlayer))                 break;         }     }         message_begin(id ? MSG_ONE_UNRELIABLE : MSG_ALL, iMsgSayText, _, iPlayer);     write_byte(iPlayer);     write_string(Buffer);     message_end(); }
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 03-30-2011 , 23:50   Re: custom colour
Reply With Quote #8

Oh, i see.
Thanks for fixing it.
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 03-31-2011 , 01:37   Re: custom colour
Reply With Quote #9

You can pass a not connected player as argument 1, it works.

Also, would be better to use the function like this :

fnColorPrint(0, "^4[%s] ^1your name is %s", g_szPrefix, szName)

Then you can remove lot of code :
Also, you had passed iPlayer as last message_begin argument, the receiver is id and not iPlayer.

PHP Code:
fnColorPrint(id, const szMsg[], any:...) 

    static 
iMsgSayText
    if(!
iMsgSayText
        
iMsgSayText get_user_msgid("SayText"); 

    static 
Buffer[190];
    
vformat(Buffercharsmax(Buffer), Buffer23); 

    
message_begin(id MSG_ONE_UNRELIABLE MSG_ALLiMsgSayText, .player=id); 
    
write_byte(id id 1); 
    
write_string(Buffer); 
    
message_end(); 


Note that such a function doesn't allow team color change or ML when you pass id = 0 ( see my sig )
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 03-31-2011 , 02:09   Re: custom colour
Reply With Quote #10

I almost never use ML, I like something like that because i don't have to add the prefix to every sentence i write.
Thanks for the optimisation

EDIT: you forgot to change Buffer2 to szMsg
PHP Code:
vformat(Buffercharsmax(Buffer), Buffer23); 
=>
PHP Code:
vformat(Buffercharsmax(Buffer), szMsg3); 
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.

Last edited by drekes; 03-31-2011 at 02:12.
drekes is offline
Send a message via MSN to drekes
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 14:31.


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