17.02.2013, 17:55
(
Последний раз редактировалось stormchaser206; 22.10.2013 в 12:24.
)
I am here to introduce you...
stormLang
Currently supports English, Spanish, German, and Polish - And it's easy to add more!
News
February 20, 2013: Released 1.0.1, a bug fix update. 1.0.2 will now be when i add more languages
FUNCTIONS
SetPlayerLanguage - Easily set someone's language!
SendMessage - Send a message in a language - No more files with all your strings!
GetPlayerLanguageName - Get a player's language's name!
GetPlayerLanguage - Get a player's language number!
CALLBACKS
No callbacks.
NOTES
Make sure you add a way to change language in your GM!
How to add more/change a language
So, to do this, you need to change a few things. For this example, we will use french and will be adding a line.
First, you need to go to SetPlayerLanguage.
You will see this:
Add another language line.
Then change SendMessage to this:
After that, change the other 2 stocks:
You're done!
Download:
Adf.ly: http://adf.ly/JIFZs
Direct: https://dl.dropbox.com/u/77376451/stormlang.inc
Thank you!
Please report any bugs you find.
NEWS FEED
IT'S NOT REALLY A FEED
Update 1.0.2 coming soon! Adding advanced features such as disabling certain languages! And more languages!
Coming soon is version 1.0.2!
Credits
Me (stormchaser206): For the script
pds2k12: Fixing 1.0.0 for 1.0.1
stormLang
Currently supports English, Spanish, German, and Polish - And it's easy to add more!
News
February 20, 2013: Released 1.0.1, a bug fix update. 1.0.2 will now be when i add more languages
FUNCTIONS
SetPlayerLanguage - Easily set someone's language!
pawn Код:
SetPlayerLanguage(playerid, language);
/*/Options
-1 = No language selected
0 = English
1 = Spanish
2 = German
3 = Polish
/////*/
pawn Код:
SendMessage(playerid, color, English[], Spanish[], German[], Polish[])
/*If you get an error about the line being too long, do it like:
SendMessage(playerid, yourcolorhere, "EnglishMessage", "SpanishMessage",
"GermanMessage", "PolishMessage");
See? It was on 2 lines!*/
pawn Код:
GetPlayerLanguageName(playerid); //It will return the name, for example you could do it in /stats
pawn Код:
GetPlayerLanguage(playerid); //It will return a number, for example, 0 is english.
CALLBACKS
No callbacks.
NOTES
Make sure you add a way to change language in your GM!
How to add more/change a language
So, to do this, you need to change a few things. For this example, we will use french and will be adding a line.
First, you need to go to SetPlayerLanguage.
You will see this:
pawn Код:
stock SetPlayerLanguage(playerid, language);
{
if(language == -1) return pLanguage[playerid] = -1;
if(language == 0) return pLanguage = 0;
if(language == 1) return pLanguage = 1;
if(language == 2) return pLanguage = 2;
if(language == 3) return pLanguage = 3;
}
pawn Код:
stock SetPlayerLanguage(playerid, language);
{
if(language == -1) return pLanguage[playerid] = -1;
if(language == 0) return pLanguage[playerid] = 0;
if(language == 1) return pLanguage[playerid] = 1;
if(language == 2) return pLanguage[playerid] = 2;
if(language == 3) return pLanguage[playerid] = 3;
if(language == 4) return pLanguage[playerid] = 4; //French
}
pawn Код:
stock SendMessage(playerid, color, English[], Spanish[], German[], Polish[], French[])
{
switch(pLanguage[playerid])
{
case 0: //English
{
SendClientMessage(playerid, color, English);
}
case 1: //Spanish
{
SendClientMessage(playerid, color, Spanish);
}
case 2: //German
{
SendClientMessage(playerid, color, German);
}
case 3: //Polish
{
SendClientMessage(playerid, color, Polish);
}
case 4: //French
{
SendClientMessage(playerid, color, French);
}
}
return true;
}
pawn Код:
stock GetPlayerLanguageName(playerid)
{
new name[35];
if(pLanguage[playerid] == -1)
{
name = "No Language";
}
if(pLanguage[playerid] == 0)
{
name = "English";
}
if(pLanguage[playerid] == 1)
{
name = "Espanol";
}
if(pLanguage[playerid] == 2)
{
name = "Deutsch";
}
if(pLanguage[playerid] == 3)
{
name = "Polski";
}
if(pLanguage[playerid] == 4)
{
name = "Francais"
}
return name;
}
stock GetPlayerLanguage(playerid)
{
new lan;
if(pLanguage[playerid] == -1)
{
lan = -1;
}
if(pLanguage[playerid] == 0)
{
lan = 0;
}
if(pLanguage[playerid] == 1)
{
lan = 1;
}
if(pLanguage[playerid] == 2)
{
lan = 2;
}
if(pLanguage[playerid] == 3)
{
lan = 3;
}
if(pLanguage[playerid] == 4)
{
lan = 4;
}
return lan;
}
Download:
Adf.ly: http://adf.ly/JIFZs
Direct: https://dl.dropbox.com/u/77376451/stormlang.inc
Thank you!
Please report any bugs you find.
NEWS FEED
IT'S NOT REALLY A FEED
Update 1.0.2 coming soon! Adding advanced features such as disabling certain languages! And more languages!
Coming soon is version 1.0.2!
Credits
Me (stormchaser206): For the script
pds2k12: Fixing 1.0.0 for 1.0.1