SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Plugin Development

Reply
 
Thread Tools Display Modes
Old 20/03/2013, 04:06 PM   #1
Bombo
Huge Clucker
 
Bombo's Avatar
 
Join Date: Jun 2012
Posts: 286
Reputation: 76
Post imessage - fast multilanguage strings

imessage plugin

Author: Bombo
Version: 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:
Code:
#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 {Использование команды: };
It is strongly recommend to keep the file format.


Usage:
PHP Code:
#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(playerid0xFFCC00AAimes);
    ...
    return 
1

Result:


0.3e, 0.3x, 0.3z, 0.3.7 tested




You can see the plugin in work on test servers below.
Attached Files
File Type: zip imessage_100_src.zip (248.2 KB, 90 views)
File Type: zip imessage_110_src.zip (249.3 KB, 178 views)
File Type: zip lang_test.zip (210.1 KB, 128 views)
__________________
[Tool/Web/Other] SA:MP multiloader
[Plugin] Automatic chat translator
[GameMode] DayZ+ [0.3z]
[Plugin] imessage - fast multilanguage strings
[Tool/Web/Other] player search service

Last edited by Bombo; 15/10/2016 at 12:54 PM. Reason: update to v1.1.0
Bombo is offline   Reply With Quote
Old 20/03/2013, 05:12 PM   #2
Gamer_Z
Banned
 
Join Date: Jun 2009
Posts: 1,850
Reputation: 1370
Default Re: imessage - fast multilanguage strings

Fast.. well, any benchmarks?
Gamer_Z is offline   Reply With Quote
Old 20/03/2013, 05:27 PM   #3
Bombo
Huge Clucker
 
Bombo's Avatar
 
Join Date: Jun 2012
Posts: 286
Reputation: 76
Default Re: imessage - fast multilanguage strings

I'll make a benchmark later, but I have nothing to compare with
__________________
[Tool/Web/Other] SA:MP multiloader
[Plugin] Automatic chat translator
[GameMode] DayZ+ [0.3z]
[Plugin] imessage - fast multilanguage strings
[Tool/Web/Other] player search service
Bombo is offline   Reply With Quote
Old 20/03/2013, 05:40 PM   #4
leong124
High-roller
 
leong124's Avatar
 
Join Date: Jun 2008
Location: Hong Kong, China
Posts: 1,547
Reputation: 134
Default Re: imessage - fast multilanguage strings

Can this be used in non-UTF-8 clients? I use Big5 coding.
I tried Ryder's UTF-8 plugin before and it crashed the server. It's quite good to see this.
__________________
[KDT_MS]hk_shade

Sorry for my bad English and my weakness in expressing myself.
leong124 is offline   Reply With Quote
Old 20/03/2013, 06:09 PM   #5
Bombo
Huge Clucker
 
Bombo's Avatar
 
Join Date: Jun 2012
Posts: 286
Reputation: 76
Default Re: imessage - fast multilanguage strings

This plugin was specially created for non-UTF-8 clients (because the SAMP is such client). But it needs some update to support Big5 and other codes except for windows cp: 1250, 1251, 1254 and 1252
__________________
[Tool/Web/Other] SA:MP multiloader
[Plugin] Automatic chat translator
[GameMode] DayZ+ [0.3z]
[Plugin] imessage - fast multilanguage strings
[Tool/Web/Other] player search service
Bombo is offline   Reply With Quote
Old 20/03/2013, 07:36 PM   #6
Gamer_Z
Banned
 
Join Date: Jun 2009
Posts: 1,850
Reputation: 1370
Default Re: imessage - fast multilanguage strings

Quote:
Originally Posted by Bombo View Post
I'll make a benchmark later, but I have nothing to compare with
1) http://code.******.com/p/gpb/wiki/Dy...guageSpeedTest
2) http://gpb.******code.com/files/dynamic_lang.zip
3) test against sending normal "new strings" with format?
4) test against sending SendClientMessage(playerid,-1,"abcdef"); to see how much slower it is.
Gamer_Z is offline   Reply With Quote
Old 20/03/2013, 08:05 PM   #7
Bombo
Huge Clucker
 
Bombo's Avatar
 
Join Date: Jun 2012
Posts: 286
Reputation: 76
Default Re: imessage - fast multilanguage strings

Quote:
Originally Posted by Gamer_Z View Post
It is something like my plugin! This is good. Let's see, but a short while later.
__________________
[Tool/Web/Other] SA:MP multiloader
[Plugin] Automatic chat translator
[GameMode] DayZ+ [0.3z]
[Plugin] imessage - fast multilanguage strings
[Tool/Web/Other] player search service
Bombo is offline   Reply With Quote
Old 20/03/2013, 08:48 PM   #8
Rock
Huge Clucker
 
Rock's Avatar
 
Join Date: Feb 2013
Location: C:\Windows\Rock.dll
Posts: 333
Reputation: 29
Default Re: imessage - fast multilanguage strings

I don't really think it was necessary a plugin for this, it could be done in pawno too.
__________________
Just Rock
Rock is offline   Reply With Quote
Old 20/03/2013, 09:25 PM   #9
TheArcher
High-roller
 
TheArcher's Avatar
 
Join Date: Dec 2009
Location: Home
Posts: 2,416
Reputation: 251
Default Re: imessage - fast multilanguage strings

Quote:
Originally Posted by Rockk View Post
I don't really think it was necessary a plugin for this, it could be done in pawno too.
Do you know that PAWN is a scripting language and PAWNO is just a compiler?
__________________
TheArcher is offline   Reply With Quote
Old 20/03/2013, 09:59 PM   #10
Bombo
Huge Clucker
 
Bombo's Avatar
 
Join Date: Jun 2012
Posts: 286
Reputation: 76
Default Re: imessage - fast multilanguage strings

Quote:
Originally Posted by Rockk View Post
I don't really think it was necessary a plugin for this, it could be done in pawno too.
I don't really think you saw a code of my plugin before saying this.
__________________
[Tool/Web/Other] SA:MP multiloader
[Plugin] Automatic chat translator
[GameMode] DayZ+ [0.3z]
[Plugin] imessage - fast multilanguage strings
[Tool/Web/Other] player search service
Bombo is offline   Reply With Quote
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


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Plugin] imessage - очень быстрый доступ к строчкам Bombo Релизы/Releases 15 27/03/2013 07:59 AM
MultiLanguage Textdraw ko2 Scripting Help 1 09/11/2012 02:24 PM
Multilanguage System NicoBellic Scripting Help 1 18/02/2012 10:45 AM
Multilanguage help YoUnG_MoNeY Help Archive 7 02/07/2011 11:30 PM
Multilanguage option YoUnG_MoNeY Help Archive 7 01/07/2011 11:10 PM


All times are GMT. The time now is 11:17 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.