Raised This Month: $ Target: $400
 0% 

how to make colored messages?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Owyn
Veteran Member
Join Date: Nov 2007
Old 01-29-2009 , 09:25   how to make colored messages?
Reply With Quote #1

how to make printed text green?
here is msg sending function
Code:
public cmdChat(id, level, cid)
{
    if (!cmd_access(id, level, cid, 2))
        return PLUGIN_HANDLED

    new message[192], name[32], players[32], inum, authid[32], userid
    
    read_args(message, 191)
    remove_quotes(message)
    get_user_authid(id, authid, 31)
    get_user_name(id, name, 31)
    userid = get_user_userid(id)
    get_players(players, inum)
    
    log_amx("Chat: ^"%s<%d><%s><>^" chat ^"%s^"", name, userid, authid, message)
    log_message("^"%s<%d><%s><>^" triggered ^"amx_chat^" (text ^"%s^")", name, userid, authid, message)
    
    format(message, 191, "(ADMINS) %s :   %s", name, message)
    console_print(id, "%s", message)
    
    for (new i = 0; i < inum; ++i)
    {
        if (access(players[i], g_AdminChatFlag))
            client_print(players[i], print_chat, "%s", message)
    }
    
    return PLUGIN_HANDLED
}
Owyn is offline
Send a message via ICQ to Owyn
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 01-29-2009 , 09:35   Re: how to make colored messages?
Reply With Quote #2

.Owyn., there are already a lot of threads about colored message in chat, try to search a bit before, please.
Arkshine is offline
Owyn
Veteran Member
Join Date: Nov 2007
Old 01-29-2009 , 09:49   Re: how to make colored messages?
Reply With Quote #3

i've seen some topics but if i try
format(message, 191, "(ADMINS) %s : ^x04%s", name, message) it doesn't work
Owyn is offline
Send a message via ICQ to Owyn
BOYSplayCS
BANNED
Join Date: Apr 2008
Location: Gainesville, FL
Old 01-29-2009 , 10:29   Re: how to make colored messages?
Reply With Quote #4

PHP Code:
static GREEN[] = "^x04"

new gameSayText

public plugin_int() {
     
gameSayText get_user_msgid("SayText")
}

public 
some_function(id) {
     new 
messge[124]
     
format(message,123,"^x04TEXTGOESHERE")    
     
print_message(id,message)


print_message(idmesg[]) {
     
message_begin(MSG_ONEgameSayText, {0,0,0}, id)
     
write_byte(id)
     
write_string(mesg)
     
message_end()

BOYSplayCS is offline
Owyn
Veteran Member
Join Date: Nov 2007
Old 01-29-2009 , 10:54   Re: how to make colored messages?
Reply With Quote #5

thank you i got it to work, but what for did you make static GREEN? =0
Owyn is offline
Send a message via ICQ to Owyn
BOYSplayCS
BANNED
Join Date: Apr 2008
Location: Gainesville, FL
Old 01-29-2009 , 10:57   Re: how to make colored messages?
Reply With Quote #6

Your welcome.

static GREEN[] doesn't equal zero. It equals ^x04, it can't contain anything else.

However, you can make different colors with different values.
BOYSplayCS is offline
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 01-29-2009 , 11:21   Re: how to make colored messages?
Reply With Quote #7

Quote:
Originally Posted by .Owyn. View Post
thank you i got it to work, but what for did you make static GREEN? =0
Quote:
Originally Posted by BOYSplayCS View Post
static GREEN[] doesn't equal zero. It equals ^x04, it can't contain anything else.
He didn't mean anything with equaling or zero, it was only a smile like

Anyway, ye "^x04" means green, to see the colors -> Search.
SnoW is offline
Send a message via MSN to SnoW
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 01-29-2009 , 11:18   Re: how to make colored messages?
Reply With Quote #8

it didnt was used in your code
__________________
xPaw is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 01-29-2009 , 12:34   Re: how to make colored messages?
Reply With Quote #9

My version (using it in my plugins).
Code:
#include <amxmodx>   new g_iSayText, g_iMaxPlayers;   public plugin_cfg() {         g_iSayText = get_user_msgid("SayText");         g_iMaxPlayers = get_maxplayers(); }   stock print(iCl, const szMsg[], {Float, Sql, Result,_}:...) {         static szBuffer[192];         szBuffer[0] = 0x01;         vformat(szBuffer[1], 190, szPrefix, 3);         if (iCl && iCl <= g_iMaxPlayers)         {                 message_begin(MSG_ONE, g_iSayText, {0, 0, 0}, iCl);                 write_byte(iCl);                 write_string(szBuffer);                 message_end();         }         else if (!iCl)         {                 for (iCl = 1; iCl <= g_iMaxPlayers; iCl++)                 {                         if (!is_user_connected(iCl))                                 continue;                                                 message_begin(MSG_ONE, g_iSayText, {0, 0, 0}, iCl);                         write_byte(iCl);                         write_string(szBuffer);                         message_end();                 }         }           return 1; }
__________________
hleV is offline
Owyn
Veteran Member
Join Date: Nov 2007
Old 01-29-2009 , 13:21   Re: how to make colored messages?
Reply With Quote #10

О__о
i can't understand it
Owyn is offline
Send a message via ICQ to Owyn
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 01:37.


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