20.03.2013, 16:06
(
Последний раз редактировалось Bombo; 15.10.2016 в 12:54.
Причина: update to v1.1.0
)
imessage plugin
Author: BomboVersion: 1.1.0
[+] speed up
This plugin allows a quick access to an unlimited number of named strings with translations in various languages.
Functions:
native init_ifile(in_filename[]); //set filename
native close_ifile(); //close file
native imessage(out_string[], in_str_name[], in_language[], size=sizeof out_string); //get string
The file must be UTF8 encoded, so strings keeps extended characters. A size of this file is unlimited (by the plugin).
Pattern:
Код:
#multilanguage message file #pattern file for imessage v1.0.0 by Bombo #Supported languages: "en","ru","fr","uk","es","cs","de","it","pl","tr","sr","bg","ro" # #Format of the name: "\n[MESSAGE_NAME]\n", where MESSAGE_NAME is latin only #Format of the language: "\nxx {", xx - language code, contains 2 latin characters only #Format of the end of string: "};\n", no spaces between caracters #In the end of file: "\n\n", message lost is possible in other case (!) # #Encoding: UTF8 #New line: Unix # #File size is unlimited. #Location: samp-server root [HELLO_MESSAGE] en {Set your language, please}; ru {Укажите ваш язык}; [YOUR_LANGUAGE] en {Your language: }; ru {Ваш язык: }; es {Su idioma: }; [HELPLANG] en {{00FF00}/lang <xx> {FFCC00}- set your language, xx: {FF0000}en,ru,es}; es {{00FF00}/lang <xx> {FFCC00}- seleccione su idioma, xx: {FF0000}en,ru,es}; ru {{00FF00}/lang <xx> {FFCC00}- укажите ваш язык, xx: {FF0000}en,ru,es}; [HELPSHOW] en {{00FF00}/show {FFCC00}- show you language of all online players.}; es {{00FF00}/show {FFCC00}- mostrarle país y el idioma los jugadores en línea.}; ru {{00FF00}/show {FFCC00}- язык всех онлайн игроков.}; #fr {...}; [NEWLANG] en {Your language is: }; es {Ahora su idioma: }; ru {Теперь ваш язык: }; [COMMAND_USAGE] en {Usage: }; es {Uso: }; ru {Использование команды: };
Usage:
PHP код:
#include <a_samp>
...
#include <imessage>
...
public OnFilterScriptInit()
{
...
//set filename
init_ifile("pattern.txt");
...
return 1;
}
public OnPlayerConnect(playerid) //or any other function
{
new imes[128];
...
//get string
imessage(imes, "HELLO_MESSAGE", "en");
//set the string in any function
SendClientMessage(playerid, 0xFFCC00AA, imes);
...
return 1
}
0.3e, 0.3x, 0.3z, 0.3.7 tested
You can see the plugin in work on test servers below.