Color Parsing
#1

Hi all.

Today i was looking for some new RolePlay features, so i thinked about color parsing on chat.
I mean that, when you write * * in chat, next between the two * * will change color.

Here an example:
"Hello! *Waving*"

Result:
"Hello *Waving*"

I know i must use strcmp, but i don't exactly know how to detect when it starts and when it finish.
I already see this in many RolePlay servers.
Hope someone will help me!
Reply
#2

PHP код:
public OnPlayerText(playeridtext[])
{
    if(
strfind(text"**"))
    {
        new 
colour[7], pos[4];
        for(new 
0sizeof(text); i++)
        {
            if(
text[i] == '*')
            {
                for(new 
04j++)
                {
                    if(
pos[j] == 0pos[j] = i;
                }
             }
         }
         
strmid(colourtextpos[1], pos[2]);
    return 
colour
Now, you've the colour.
Do the rest.
Reply
#3

Quote:
Originally Posted by S4t3K
Посмотреть сообщение
PHP код:
public OnPlayerText(playeridtext[])
{
    if(
strfind(text"**"))
    {
        new 
colour[7], pos[4];
        for(new 
0sizeof(text); i++)
        {
            if(
text[i] == '*')
            {
                for(new 
04j++)
                {
                    if(
pos[j] == 0pos[j] = i;
                }
             }
         }
         
strmid(colourtextpos[0], pos[3];
    return 
colour
Now, you've the colour.
Do the rest.
This will fetch when there's a * ?
Reply
#4

This will take everything between the bold chars **FF0000* (but it won't take the bold chars) and store it in the colour array.

I mean, if it is not what you wanted, sorry.
I believed that you wanted the player putting the color he wants for chatting.
If you just want to apply the same colour to the whole text at each time, simply remake my code. (I've done the hardest way)
Reply
#5

Uhm i don't think you get what i'm looking for >.<
I want just to colour into purple every text between this tag: *

The idea is to implement an action command into a normal chatting text.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)