19.07.2011, 10:47
Quote:
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; } Not to hijack your tutorial or anything, just a thought, it cuts out all of these switch statements and super long functions. |