AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Module Coding (https://forums.alliedmods.net/forumdisplay.php?f=9)
-   -   RTL-Chat Module? (https://forums.alliedmods.net/showthread.php?t=326415)

abdobiskra 07-30-2020 04:21

RTL-Chat Module?
 
Hi, is there someone who interesting to make like this plugin for GoldSrc? or it can be done until? inferiority but valve won't do that I'm confused... I think it is necessary for me to chat.
https://forums.alliedmods.net/showthread.php?p=1649882

simanovich 08-02-2020 13:14

Re: RTL-Chat Module?
 
I don't think there is, but it can be done.

Looking at the source file of the sm plugin, it just detects when someone typed a RTL character (via UTF-8, which is really small list of languages (about 10) and just flips the relevent part of the string.

Since goldsrc supports UTF-8 text starting from steampipe update back in Aug 2013, it shouldn't be a problem.

abdobiskra 08-02-2020 13:44

Re: RTL-Chat Module?
 
Maybe if you mean with the Hebrew language then it's no problem because the words consist of separate letters from right to left if I'm not mistaken. As for the Arabic language, its letters in the word are related (its shape changes, not as it was) in order to give a clear meaning and word.
To solve this problem, I must resort to sites or programs to convert it like this site or notpad++....this takes a lot of time and a tiring way
I am looking for support to solve this problem.

r0ma 08-03-2020 20:25

Re: RTL-Chat Module?
 
test
PHP Code:

#include <amxmodx>

#pragma semicolon 1
#pragma dynamic 32768

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "alongub"

new Float:minimum 0.1;

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR);
    
    
register_clcmd("say""clcmdSay");
}

public 
clcmdSay(id) {
    new 
buffer[192], tokens[96][96], words[96][96], rtledWords;
    
    
read_args(buffercharsmax(buffer));
    
remove_quotes(buffer);
    
replace_all(buffercharsmax(buffer), "%""");
    
    new 
explode_string(buffer" "tokenssizeof tokenssizeof tokens);
    
    for(new 
ini++) {
        if(
WordAnalysis(tokens[i]) >= minimum) {
            
ReverseString(tokens[i], sizeof(tokens[]), words[n-1-i]);
            
rtledWords++;
        }
        else {
            new 
firstWord i;
            new 
lastWord i;
            
            while (
lastWord && WordAnalysis(tokens[lastWord]) < minimum)
            {
                
lastWord++;
            }
            
            for (new 
lastWord 1>= firstWordt--)
            {
                
copy(words[n-1-i], sizeof(tokens[]), tokens[t]);
                
                if (
firstWord)
                    
i++;
            }
        }
    }
    
    if(
rtledWords) {
        
implode_strings(wordsn" "buffersizeof(words[]));
        
        new 
name[33], alive is_user_alive(id);
        
get_user_name(idnamecharsmax(name));
        
        for(new 
1<= MaxClientsi++) {
            if(
id == || alive == is_user_alive(i))
                
client_print_color(iid"^x03%s^x01 : %s"namebuffer);
        }
        
        return 
PLUGIN_HANDLED;
    }
    
    return 
PLUGIN_CONTINUE;
}

stock ReverseString(str[], maxlengthbuffer[]) {
    for (new 
character strlen(str); character >= 0character--)
    {
        if (
str[character] >= 0xD6 && str[character] <= 0xDE)
            continue;
        
        if (
character && str[character 1] >= 0xD7 && str[character 1] <= 0xD9)
            
format(buffermaxlength"%s%c%c"bufferstr[character 1], str[character]);
        else
            
format(buffermaxlength"%s%c"bufferstr[character]);
    }
}

stock Float:WordAnalysis(word[]) {
    new 
count 0length strlen(word);
    
    for (new 
0length 1n++) {
        if (
IsRTLCharacter(wordn)) {
            
count++;
            
n++;
        }
    }
    
    return 
float(count) * length;
}

stock IsRTLCharacter(str[], n) {
    return (
str[n] >= 0xD6 && str[n] <= 0xDE && str[1] >= 0x80 && str[1] <= 0xBF);



abdobiskra 08-04-2020 04:04

Re: RTL-Chat Module?
 
@r0ma
Yes, it works on turning letters from left to right, but it remains separate letters and does not form a word ... Originally it must be related.
Here someone wants to fix this but don't work with me anyway
http://codepad.org/WxEArf4A
he tries to convert separate letters to attached letters form to make a word using replace_all native
check this too:
https://forums.alliedmods.net/showpo...40&postcount=6

btw even if that works, there will be unsatisfactory results (because we must check that the letter in every word if it is in the middle, beginning or end of it ... before we convert it ... a set of complications) but it is better than nothing :)

abdobiskra 12-30-2021 11:29

Re: RTL-Chat Module?
 
«Bump»

r0ma 12-31-2021 07:08

Re: RTL-Chat Module?
 
try this, needs a php script to translate from google.

abdobiskra 12-31-2021 12:52

Re: RTL-Chat Module?
 
Quote:

Originally Posted by r0ma (Post 2767328)
try this, needs a php script to translate from google.

Thanls but :
Quote:

Limitations:
- Only the languages supported in amx_langmenu are supported in this plugin.
- 2 languages in amx_langmenu are also not available on Google (Macedonian and l33t).
- Google Translations are not perfect. There will be errors sometimes of course.
- The HL1 engine cannot display some translated characters (that char will be left out of word).
amxmodx these languages are not supported and the plugin is limited


All times are GMT -4. The time now is 02:58.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.