Raised This Month: $ Target: $400
 0% 

custom colour


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 03-30-2011 , 17:53   Re: custom colour
Reply With Quote #6

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
 



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