Raised This Month: $12 Target: $400
 3% 

RTL-Chat Module?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
abdobiskra
Veteran Member
Join Date: Jul 2014
Location: Algeria
Old 07-30-2020 , 04:21   RTL-Chat Module?
Reply With Quote #1

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
__________________
abdobiskra is offline
Send a message via Skype™ to abdobiskra
simanovich
AlliedModders Donor
Join Date: Jun 2012
Location: Israel
Old 08-02-2020 , 13:14   Re: RTL-Chat Module?
Reply With Quote #2

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

Last edited by simanovich; 08-02-2020 at 13:15.
simanovich is offline
abdobiskra
Veteran Member
Join Date: Jul 2014
Location: Algeria
Old 08-02-2020 , 13:44   Re: RTL-Chat Module?
Reply With Quote #3

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.
__________________
abdobiskra is offline
Send a message via Skype™ to abdobiskra
r0ma
Senior Member
Join Date: Apr 2012
Location: Great Tomb of Nazarick
Old 08-03-2020 , 20:25   Re: RTL-Chat Module?
Reply With Quote #4

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);

__________________
Discord:FluffyDeveloper#4753
Github: https://github.com/francoromaniello
AMX-ES: https://amxmodx-es.com/r0ma'
r0ma is offline
Send a message via MSN to r0ma
abdobiskra
Veteran Member
Join Date: Jul 2014
Location: Algeria
Old 08-04-2020 , 04:04   Re: RTL-Chat Module?
Reply With Quote #5

@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
__________________

Last edited by abdobiskra; 08-04-2020 at 04:11. Reason: btw
abdobiskra is offline
Send a message via Skype™ to abdobiskra
abdobiskra
Veteran Member
Join Date: Jul 2014
Location: Algeria
Old 12-30-2021 , 11:29   Re: RTL-Chat Module?
Reply With Quote #6

«Bump»
__________________
abdobiskra is offline
Send a message via Skype™ to abdobiskra
r0ma
Senior Member
Join Date: Apr 2012
Location: Great Tomb of Nazarick
Old 12-31-2021 , 07:08   Re: RTL-Chat Module?
Reply With Quote #7

try this, needs a php script to translate from google.
__________________
Discord:FluffyDeveloper#4753
Github: https://github.com/francoromaniello
AMX-ES: https://amxmodx-es.com/r0ma'
r0ma is offline
Send a message via MSN to r0ma
abdobiskra
Veteran Member
Join Date: Jul 2014
Location: Algeria
Old 12-31-2021 , 12:52   Re: RTL-Chat Module?
Reply With Quote #8

Quote:
Originally Posted by r0ma View Post
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
__________________
abdobiskra is offline
Send a message via Skype™ to abdobiskra
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 14:20.


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