Help about OnPlayerText (when player write somthing...)
#1

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."

Reply
#2

use 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
Reply
#3

Quote:
Originally Posted by mahardika
Посмотреть сообщение
use 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.
-_-
Reply
#4

Use strfind.
Reply
#5

Quote:
Originally Posted by DaniceMcHarley
Посмотреть сообщение
Use strfind.
EXMPLE PLEASE -_-
Reply
#6

Strfind:

pawn Код:
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)
Reply
#7

Quote:
Originally Posted by Equality
Посмотреть сообщение
EXMPLE PLEASE -_-
pawn Код:
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.
https://sampwiki.blast.hk/wiki/Strins - Used to insert the formatting into the string.
Reply
#8

Quote:
Originally Posted by Leon9741
Посмотреть сообщение
Strfind:

pawn Код:
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".
Quote:
Originally Posted by nmader
Посмотреть сообщение
pawn Код:
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.
https://sampwiki.blast.hk/wiki/Strins - Used to insert the formatting into the string.
not working :X
Reply
#9

Quote:
Originally Posted by Equality
Посмотреть сообщение
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?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)