[Tutorial] Language system. (Easy and understandable)
#8

Quote:
Originally Posted by JaTochNietDan
View Post
Wouldn't it be a lot better and cleaner to just use language files? Use some sort of quick ini parser and store the lines in a file for each message that's sent, then just have an array with the paths to the languages files and a variable with a value that corrosponds with the array. Doing all of the switch statements is pretty messy. Also another thing is that with that function it would probably become quite easy to go over the line length limit.

In fact you don't even need to use files, just have a multi-dimensional array with the first cell set being the message and the second cell set being the language. What I mean is this:

Code:
new languages[][][] = {
	{{"Hello"}, {"Hola"}, {"Guten tag"}},
	{{"Yes"}, {"Sн"}, {"Ja"}}
};

new pLanguage[MAX_PLAYERS];

stock SendLanguageMessage(messageid)
{
	SendClientMessage(playerid, 0xFFFFFF, languages[messageid][pLanguage[playerid]]);
	return 1;
}
So then for example SendLanguageMessage(0) would send either Hello, Hola or Guten tag, depending on what the variable is set to for that player.

Not to hijack your tutorial or anything, just a thought, it cuts out all of these switch statements and super long functions.
This (the INI method) is what YSI has been doing for about 4 years now!
Reply


Messages In This Thread
Language system. (Easy and understandable) - by Zh3r0 - 18.07.2011, 21:59
Re: Language system. (Easy and understandable) - by Pro SA:MP Craiova - 18.07.2011, 22:02
Re: Language system. (Easy and understandable) - by [MG]Dimi - 18.07.2011, 22:03
Re: Language system. (Easy and understandable) - by JaTochNietDan - 19.07.2011, 00:22
Re: Language system. (Easy and understandable) - by Zh3r0 - 19.07.2011, 05:55
Re: Language system. (Easy and understandable) - by Lorenc_ - 19.07.2011, 06:29
Re: Language system. (Easy and understandable) - by !!--Ryder_RO--!! - 19.07.2011, 06:36
Re: Language system. (Easy and understandable) - by Y_Less - 19.07.2011, 10:47
Re: Language system. (Easy and understandable) - by JaTochNietDan - 19.07.2011, 15:16
Re: Language system. (Easy and understandable) - by Zh3r0 - 19.07.2011, 15:50
Re: Language system. (Easy and understandable) - by JaTochNietDan - 19.07.2011, 16:29
Re: Language system. (Easy and understandable) - by Zh3r0 - 19.07.2011, 16:57
Re: Language system. (Easy and understandable) - by Y_Less - 19.07.2011, 20:44
Re: Language system. (Easy and understandable) - by FANEX - 21.07.2011, 19:10
Re: Language system. (Easy and understandable) - by Venice - 22.07.2011, 09:55
Re: Language system. (Easy and understandable) - by Zh3r0 - 22.07.2011, 23:59
Re: Language system. (Easy and understandable) - by Mean - 24.07.2011, 18:48
Re: Language system. (Easy and understandable) - by Zh3r0 - 25.07.2011, 22:35
Re: Language system. (Easy and understandable) - by Guest3598475934857938411 - 25.07.2011, 23:59
AW: Language system. (Easy and understandable) - by Tigerkiller - 28.07.2011, 09:50
Re: Language system. (Easy and understandable) - by hillko - 28.07.2011, 13:12
Re: Language system. (Easy and understandable) - by Berlovan - 28.07.2011, 13:19
Re: Language system. (Easy and understandable) - by hillko - 28.07.2011, 13:23
Re: Language system. (Easy and understandable) - by Venice - 31.07.2011, 11:22
Re: Language system. (Easy and understandable) - by igor_andrusenko - 02.08.2011, 11:40
Re: Language system. (Easy and understandable) - by alpha500delta - 02.08.2011, 11:41
Re: Language system. (Easy and understandable) - by ylleron - 04.08.2011, 10:57
Re: Language system. (Easy and understandable) - by Zh3r0 - 06.08.2011, 23:28
Re: Language system. (Easy and understandable) - by Godhimself - 10.08.2011, 06:44
Re: Language system. (Easy and understandable) - by fahlevy - 21.09.2014, 11:08

Forum Jump:


Users browsing this thread: 9 Guest(s)