Natives: There's a total of 10 natives, complete list:
• Allow color embedding directly on chat using it's natives.
• Allow color embedding and creating new lines for a dialog's caption directly in-game.
• Highlight any given words on a text either for client-messages/dialogs or for gametexts/textdraw.
• Highlighting can be done in two ways - One which highlights the given word a single time only, the other can highlight words even if they're repeated.
• There's also in built functions which allows you to highlight online nicknames to be used for client-messages(even chat)/dialogs or for gametexts/textdraws.
native NickHighlight_SCM(text[], scmcol[9], bool:ignorecase = false, hcol[9] = "\0");
native NickHighlight_SCMEx(text[], scmcol[9], bool:ignorecase = false, hcol[9] = "\0");
native NickHighlight_Text(text[], txcol[], hcol[], bool:ignorecase = false);
native NickHighlight_TextEx(text[], txcol[], hcol[], bool:ignorecase = false);
native WordsHighlight_SCM(text[], scmcol[9], hcol[9], words[][], bool:ignorecase = false, size = sizeof(words));
native WordsHighlight_SCMEx(text[], scmcol[9], hcol[9], words[][], bool:ignorecase = false, size = sizeof(words));
native WordsHighlight_Text(text[], txcol[], hcol[], words[][], bool:ignorecase = false, size = sizeof(words));
native WordsHighlight_TextEx(text[], txcol[], hcol[], words[][], bool:ignorecase = false, size = sizeof(words));
native ColorEmbed_SCM(text[], rchar = 'x', size = sizeof(text));
native ColorEmbed_Dialog(text[], rchar = 'x', size = sizeof(text));
/*
Parameters for both NickHighlight_SCM and NickHighlight_SCMEx
text[] = The text that has to be formatted.
scmcol[] = The color that the client message has got, usually for chat, it's white {FFFFFF}
ignorecase = If it's set to false, names will be highlighted on text only if it's exactly like how the player's nick is.
hcol[] = The highlight color to be displayed, if it's not set, GetPlayerColor will be used instead.
The difference between NickHighlight_SCM and NickHighlight_SCMEx is that if the 'text' repeats
the highlighted player's name, the latter one will highlight that too where as the first one will highlight
only once.
Example:
public OnPlayerText(playerid, text[])
{
new
temp_String[144];
strcpy(temp_String, text, sizeof(temp_String));
SendPlayerMessageToAll(playerid, NickHighlight_SCM(temp_String, "{FFFFFF}", false, "{FF0000}");
return 0;
}
//Here the highlighting color is red, {FF0000}
*/
native NickHighlight_SCM(text[], scmcol[9], bool:ignorecase = false, hcol[9] = "\0");
native NickHighlight_SCMEx(text[], scmcol[9], bool:ignorecase = false, hcol[9] = "\0");
/*
Parameters for both NickHighlight_Text and NickHighlight_TextEx
text[] = The text that has to be formatted.
txcol[] = The default color of the text. Suppose if the starting color is "~g~", txcol should also be "~g~"
hcol[] = The color used for highlighting.
ignorecase = Similar to the above function's, checks for case sensitive.
*/
native NickHighlight_Text(text[], txcol[], hcol[], bool:ignorecase = false);
native NickHighlight_TextEx(text[], txcol[], hcol[], bool:ignorecase = false);
/*
Parameters for WordsHighlight_SCM and WordsHighlight_SCMEx
text[] = The text to be formatted.
scmcol[] = Default color of the client message.
hcol[] = The color that's used for highlighting.
words[][] = Words to be highlighted.
ignorecase = Whether to ignore case sensitivity or not.
size = Number of words.
Example:
new
WORDS[][] = {"Function", "This", "Testing"};
WordsHighlight_SCM(text, "{FFFFFF}", "{FF0000}", WORDS, false, 3);
*/
native WordsHighlight_SCM(text[], scmcol[9], hcol[9], words[][], bool:ignorecase = false, size = sizeof(words));
native WordsHighlight_SCMEx(text[], scmcol[9], hcol[9], words[][], bool:ignorecase = false, size = sizeof(words));
/*
Parameters:
text[] = The text that has to be formatted.
txcol[] = The default color of the text.
hcol[] = The color that has to be used for highlighting.
words[][] = The words that has to be highlighted.
ignorecase = Whether case sensitivity has to be ignored or not.
size = Number of words.
Example:
new
WORDS[][] = {"This", "Function", "Testing"};
WordsHighlight_Text(text, "~g~", "~h~~r~", WORDS, false, sizeof(words));
*/
native WordsHighlight_Text(text[], txcol[], hcol[], words[][], bool:ignorecase = false, size = sizeof(words));
native WordsHighlight_TextEx(text[], txcol[], hcol[], words[][], bool:ignorecase = false, size = sizeof(words));
/*
Parameters:
text[] = The text to be color embedded.
rchar = The string that has to indicate color embedding, eg : {xFF0000} - If this is found when rchar = 'x', then
color embedding will take place and it will be replaced as {FF0000}
size = size of the text.
ColorEmbed_SCM is used for client messages and ColorEmbed_Dialog is used for
dialog caption. The latter one also formats "\n" and forms a new line if found.
*/
native ColorEmbed_SCM(text[], rchar = 'x', size = sizeof(text));
native ColorEmbed_Dialog(text[], rchar = 'x', size = sizeof(text));
- SA-MP passes only 144 characters on client messages, so if there's anything unusual with the color embedding, the include isn't responsible.And also thanks to KaperStone for naming this include as "L_ColorEmbed". I know that there's few more days to get on 2015, but anyways, happy new year!
Seems nice, but maybe a suggestion is to make it go to the next line if the length surpasses 144.
|
strcpy(temp_String, ColorEmbed_SCM(string), sizeof(temp_String));
new
t_Str[50];
if(strmid(t_Str, temp_String, 140, strlen(temp_String)) > 0) //140 is the start point of extraction, end point is up to the end of string.
//Some characters have been extracted from the source and passed to "t_Str"
else
//No characters were extracted from source and passed to "t_Str".
How to remove the Textdraw ? I don't know is that textdraw . The Test which appear in the middle of the screen after sending the message.
|