Skocz do zawartości

Witamy w Nieoficjalnym polskim support'cie AMX Mod X

Witamy w Nieoficjalnym polskim support'cie AMX Mod X, jak w większości społeczności internetowych musisz się zarejestrować aby móc odpowiadać lub zakładać nowe tematy, ale nie bój się to jest prosty proces w którym wymagamy minimalnych informacji.
  • Rozpoczynaj nowe tematy i odpowiedaj na inne
  • Zapisz się do tematów i for, aby otrzymywać automatyczne uaktualnienia
  • Dodawaj wydarzenia do kalendarza społecznościowego
  • Stwórz swój własny profil i zdobywaj nowych znajomych
  • Zdobywaj nowe doświadczenia

Dołączona grafika Dołączona grafika

Guest Message by DevFuse
 

Wklejka 21v2h9s53mpwo dodana przez , 22.07.2013 00:44
Typ:



1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
#include <amxmodx>
#include <amxmisc>
#include <celltrie>
 
new Trie:dictionary;
new lang[33];
new slang[130];
 
public plugin_precache(){
    dictionary=TrieCreate();
}
 
public register_translate(file[128]){
    // registers multilang translations, because default amxx multilang sucks
 
    new dictionary_file[128], line[1024], len, key[130], translate[896], lang[3];
    get_datadir(dictionary_file, 127);
    format(dictionary_file, 127, "%s/lang/%s", dictionary_file, file);
 
    if(file_exists(dictionary_file)){
        for(new i=0; read_file(dictionary_file, i, line, 1023, len); ++i){
            if(len && !equali(line, ";", 1) && !(len>=2 && equali(line, "/", 2))){
                if(len>=4 && equali(line[0], "[", 1) && equali(line[3], "]", 1)){
                    copy(lang, 2, line[1]);
                } else {
                    strtok(line, key, 127, translate, 895, '=', 1);
                    if(equali(translate, "=", 1)){
                        copy(translate, 895, translate[1]);
                    }
                    trim(translate);
                    add(key, 129, lang);
                    TrieSetString(dictionary, key, translate);
                }
            }
        }
    }
}
 
public translate(id, key[128]){
    new lng[130], translation[896];
    if(id){
        copy(lng, 127, key);
        add(lng, 129, lang[id]);
        id=TrieKeyExists(dictionary, lng);
    }
    if(!id){
        copy(lng, 127, key);
        add(lng, 129, slang);
    }
    if(TrieKeyExists(dictionary, lng)){
        TrieGetString(dictionary, lng, translation, 895);
    } else {
        copy(translation, 127, "ERR[MLNG]: No translation for ");
        add(translation, 895, key);
        log_error(AMX_ERR_NOTFOUND, translation);
    }
    return translation;
}

Dodanych wklejek: 11179
Powered By (Pav32) Pastebin © 2011