-How can I replace all letters in each word in the chat except for the last letter of each word Using the available functions?
-I specified the last letter through this function but it only works with latin (english) letters
But it didn't give the result I'm looking for in the end
Код:
stock getLastChars(const in[], out[], oLen)
{
new pos = 0, lastCharPos = 0, wordStart = 0, i = 0;
new len = strlen(in);
while (pos < len) {
if ((in[pos] & 0xC0) != 0x80) { //Verify that it is the beginning of the first letter in the letter
if (in[pos] == ' ' || in[pos] == '\n' || in[pos] == '\r' || in[pos] == '\t') { // The beginning of a new word
// Copy the last letter of the previous word into the resulting string
if (i < oLen) {
out[i] = in[lastCharPos];
i++;
}
// Determine the beginning of the new word
wordStart = pos + 1;
}
}
// Determine the beginning of the last letter of the word
lastCharPos = pos;
pos++;
}
// Copy the last letter of the last word in the text into the resulting string
if (i < oLen) {
out[i] = in[lastCharPos];
i++;
}
// Add the end of the string
if (i < oLen) {
out[i] = '\0';
} else {
out[oLen - 1] = '\0';
}
}
this my code and whati try too:
Код:
new Separate_letters_Symbol[][] = {
"ط§", "ط¨", "طھ", "ط«", "ط¬", "ط", "ط®", "ط³", "ط´", "طµ", "ط¶", "ط¹",
"ط؛", "ظپ", "ظ‚", "ظƒ", "ظ…", "ظ†", "ظٹ", "ط©", "ظ‰", "ظ‡", "ظ„",
"ط¦"
}
new Connected_letters_Symbol[][] = {
"ï؛ژ", "ï؛‘", "ï؛—", "ï؛›", "ï؛ں", "ï؛£", "ï؛§", "ï؛³", "ï؛·", "ï؛»", "ï؛؟â€ژ", "ﻋ",
"ï»ڈ", "ﻓ", "ï»—", "ï»›", "ﻣ", "ï»§", "ﻳ", "ï؛”", "ï»°", "ï»ھ", "ï»ں",
"ï؛‹"
}
public plugin_init() {
register_plugin( PLUGIN, VERSION, AUTHOR )
register_clcmd( "say", "CheckMessage" )
register_clcmd( "say_team", "CheckMessage" )
}
public CheckMessage(id) {
static said[192], said_to_utf16[192], said_to_utf8[192], name[33];
read_args( said, charsmax(said) )
remove_quotes( said )
trim( said )
MultiByteToWideChar(said, said_to_utf16)
if(isArabic(said_to_utf16)) {
ReverseString(said_to_utf16)
}
WideCharToMultiByte(said_to_utf16, said_to_utf8)
for( new i; i < sizeof Separate_letters_Symbol; i++ ) {
new len = strlen(said_to_utf8)
for (new i = 0; i < len; i++) {
if (i != len - 1) {
replace_all(said_to_utf8, charsmax(said_to_utf8), Separate_letters_Symbol[i], Connected_letters_Symbol[i]);
}
}
}
get_user_name(id, name, charsmax(name));
client_print(0, print_chat, " (AR) %s : %s",name, said_to_utf8)
return PLUGIN_HANDLED
}