PDA

View Full Version : Help about OnPlayerText (when player write somthing...)


Equality
06/07/2014, 03:48 AM
hello.
i need help about somthing in the public OnPlayerText,
i want to set color on specific word when a player write that.
exmple:
if the player will write the sentence:
"Hello my name is jackey and im from Island."
i want it to be like that:
"Hello my name is "COLOR_RED"jackey"COLOR_WHITE" and im from Island."

???

mahardika
06/07/2014, 04:18 AM
use Color embedding (wiki.sa-mp.com/wiki/Colors_List#Color_embedding) ( {RRGGBB} color ),
like
"Hello my name is {FF0000}jackey{FFFFFF} and im from Island."
or
#define COLOR_RED_EMBED "{FF0000}"

SendClientMessage(playerid, -1, "This is white and "COLOR_RED_EMBED"this is red.");
or
#define COLOR_RED_EMBED "FF0000"

SendClientMessage(playerid, -1, "This is white and {"COLOR_RED_EMBED"}this is red.");

you can use This : www.psyclops.com/tools/rgb/ to find RGB color

Equality
06/07/2014, 04:16 PM
use Color embedding (wiki.sa-mp.com/wiki/Colors_List#Color_embedding) ( {RRGGBB} color ),
like
"Hello my name is {FF0000}jackey{FFFFFF} and im from Island."
or
#define COLOR_RED_EMBED "{FF0000}"

SendClientMessage(playerid, -1, "This is white and "COLOR_RED_EMBED"this is red.");
or
#define COLOR_RED_EMBED "FF0000"

SendClientMessage(playerid, -1, "This is white and {"COLOR_RED_EMBED"}this is red.");

you can use This : www.psyclops.com/tools/rgb/ to find RGB color

this not what i meant.
i meant if someone write JACKEY in the chat so its simbols it in the colour i want.
-_-

DaniceMcHarley
06/07/2014, 05:03 PM
Use strfind.

Equality
07/07/2014, 02:31 AM
Use strfind.

EXMPLE PLEASE -_-

Leon9741
07/07/2014, 02:33 AM
Strfind:

if(strfind("Are you in here?", "you", true) != -1) //returns 4, because the start of 'you' (y) is at index 4 in the string
{
SendClientMessageToAll(0xFFFFFFFF, "I found you!");
}

1- Where search.
2- What search
3- ignorecase (optional)
4- Position (optional)

nmader
07/07/2014, 02:38 AM
EXMPLE PLEASE -_-

if(strfind(text, "Jackey", true))
{
new string[128];
strins(text, "{FF0000}Jackey{FFFFFF}", strfind(text, "Jackey", true));
format(string, sizeof(string), %s, text);
OnPlayerText(playerid, string);
}
NOTE: Untested.
http://wiki.sa-mp.com/wiki/Strins - Used to insert the formatting into the string.

Equality
07/07/2014, 08:58 AM
Strfind:

if(strfind("Are you in here?", "you", true) != -1) //returns 4, because the start of 'you' (y) is at index 4 in the string
{
SendClientMessageToAll(0xFFFFFFFF, "I found you!");
}

1- Where search.
2- What search
3- ignorecase (optional)
4- Position (optional)
Lol this is dumb.
because, i know how to use strfind.
i need the whole exmple.
if you are too lazy to do that, dont try to "help".
if(strfind(text, "Jackey", true))
{
new string[128];
strins(text, "{FF0000}Jackey{FFFFFF}", strfind(text, "Jackey", true));
format(string, sizeof(string), %s, text);
OnPlayerText(playerid, string);
}
NOTE: Untested.
http://wiki.sa-mp.com/wiki/Strins - Used to insert the formatting into the string.
not working :X

Vince
07/07/2014, 09:10 AM
Lol this is dumb.
because, i know how to use strfind.
i need the whole exmple.
if you are too lazy to do that, dont try to "help".


Excuse me? We are lazy? You come here, you demand help and then you expect us to heed to your command? Who do you even think you are?

Equality
07/07/2014, 10:06 AM
Excuse me? We are lazy? You come here, you demand help and then you expect us to heed to your command? Who do you even think you are?

someone that ask for help and dosent get it.
if you think youre so good so proove it instead bullshit me.