I've recently adapted Locoweeds chat script to my MP game (online not LAN). I was wondering if anyone had any idea how to make YOUR text YOU type one color, and the clients (or other players) that type on your screen another color. Code is below:

Code:

bmap pcxChat = <Chat.pcx>; // Chat Panel

// Chat strings
string strChat0[100]; // Chat entries
string strChat1[100];
string strChat2[100];
string strChat3[100];
string strChat4[100];
string strChat5[100];
string strChat6[100];
string strChat7[100];
string strChat8[100];
string strChatEntry[80]; // current chat entry
string strSendChat[100]; // chat to send

// text for chat panel
text txtChat
{
pos_x = 2;
pos_y = 0;
layer = 30;
font _a4font;
strings = 9;
string = strChat0, strChat1, strChat2, strChat3, strChat4,
strChat5, strChat6, strChat7, strChat8;
}

// text for chat entry
text txtChatEntry
{
pos_x = 2;
pos_y = 0;
layer = 30;
font _a4font;
string strChatEntry;
}

// chat panel
panel pnlChat
{
bmap = pcxChat;
layer = 18;
pos_x = 0;
pos_y = 0;
flags = overlay,transparent,refresh;
}

// Call this in your main function,..
function init_chat()
{
// if host or client set up chat
if (connection == 2 || connection == 3)
{
pnlChat.pos_y = screen_size.y - 100;
txtChat.pos_y = screen_size.y - 100;
txtChatEntry.pos_y = screen_size.y - 15;
pnlChat.visible = ON;
txtChat.visible = ON;
txtChatEntry.visible = OFF;
}
}

function chat_entry()
{
// if host or client
if (connection == 2 || connection == 3)
{
// if inkey already open return
if (inkey_active == 1) { return; }

txtChatEntry.visible = ON;
inkey(strChatEntry); // get chat entry

// if entry was empty don't process
if(str_cmp(strChatEntry,"")) { return; }

txtChatEntry.visible = OFF;

str_cpy(strSendChat,player_name); // put players name before entry
str_cat(strSendChat,": ");
str_cat(strSendChat,strChatEntry);

// if Host go ahead and do chat manipulation
if (connection == 3)
{
send_string(strSendChat);
str_cpy(strChat0, strChat1);
str_cpy(strChat1, strChat2);
str_cpy(strChat2, strChat3);
str_cpy(strChat3, strChat4);
str_cpy(strChat4, strChat5);
str_cpy(strChat5, strChat6);
str_cpy(strChat6, strChat7);
str_cpy(strChat7, strChat8);
str_cpy(strChat8, strSendChat);
str_cpy(strSendChat,"");
}
else // if client send entry to server for processing
{
send_string(strSendChat);
}

str_cpy(strSendChat,""); // clear the strings for client and
str_cpy(strChatEntry,""); // server called functions
}
}

//--------------------------------------------------------------------
// Function Server_Called(): server was called
//--------------------------------------------------------------------

function server_called()
{
// chat stuff
if (event_type == event_string)
{
if (!str_cmp(strSendChat,""))
{
ifdef server;

send_string(strSendChat); // send string to clients
str_cpy(strChat0, strChat1); // move old chat entries up 1
str_cpy(strChat1, strChat2);
str_cpy(strChat2, strChat3);
str_cpy(strChat3, strChat4);
str_cpy(strChat4, strChat5);
str_cpy(strChat5, strChat6);
str_cpy(strChat6, strChat7);
str_cpy(strChat7, strChat8);
str_cpy(strChat8, strSendChat);
str_cpy(strSendChat,"");

endif;
}
}
}

//--------------------------------------------------------------------
// Function Client_Called(): client was called
//--------------------------------------------------------------------

function client_called()
{
// string event
if (event_type == event_string)
{
// chat entry sent from server, process
if (!str_cmp(strSendChat,""))
{
str_cpy(strChat0, strChat1); // move old chat entries up 1
str_cpy(strChat1, strChat2);
str_cpy(strChat2, strChat3);
str_cpy(strChat3, strChat4);
str_cpy(strChat4, strChat5);
str_cpy(strChat5, strChat6);
str_cpy(strChat6, strChat7);
str_cpy(strChat7, strChat8);
str_cpy(strChat8, strSendChat);
str_cpy(strSendChat,"");
}
}
}

on_server = server_called; // on server event, call server_called()
on_client = client_called; // on client event, call client_called()
on_enter = chat_entry; // on <enter> start chat entry




Ground Tactics - Coming Soon
Ground Tactics OFFICIAL WEBSITE