[Tutorial] How To Use Multi Language
#1

How To Use Multi Language

Set the player's language
Function:
pawn Код:
PlayerLanguage(playerid, languageid);
  1. First of all you ned to download Multi Language
  2. Then paste it on your pawno's include folder (.../pawn/iclude)
  3. Then you need to add this line to the top of your gamemode or filterscript.

    pawn Код:
    #include <a_samp> // without this, all of your script will never work...
    #include <multilang> // without this, you will never finished this tutorial...
  4. Put these lines under the #include <multilang>

    pawn Код:
    #define EN 0
    #define ID 1 // you can add more language if you can translate it....

    #define DIALOG_LANGUAGE 1000 // define the language selection dialog
  5. Add these lines under OnPlayerConnect callback

    pawn Код:
    ShowPlayerDialog(playerid, DIALOG_LANGUAGE, DIALOG_STYLE_MSGBOX, "Language", "Please choose your language \n\nMohon pilih bahasa anda", "English", "Indonesian"); // it's only the example... you can change the message by yourself
  6. under OnDialogResponse, put these line
    1. option 1
      pawn Код:
      switch(dialogid)
      {
              case DIALOG_LANGUAGE:
              {
              if(response) // if player choose the "English" button
              {
                          PlayerLanguage(playerid, EN); // Set the player's language into EN (language id 0)
              }
              if(!response) // if player choose the "Indonesian" button
              {
                  PlayerLanguage(playerid, ID); // Set the player's language into ID (language id 1)
              }
          }
      }
    2. option 2
      pawn Код:
      if(dialogid == DIALOG_LANGUAGE)
      {
          if(response) // if player choose the "English" button
          {
                      PlayerLanguage(playerid, EN); // Set the player's language into EN (language id 0)
          }
          if(!response) // if player choose the "Indonesian" button
          {
              PlayerLanguage(playerid, ID); // Set the player's language into ID (language id 1)
          }
      }
  7. Finished!
Send a client message to a specific

Function:
pawn Код:
SendClientMessageLang(playerid, language id, color, message);
Example:
pawn Код:
SendClientMessageLang(playerid, EN, 0xFFFFFFFF, "This is the english message"); // Send the message into player if player's language is setted EN. It will not send if player's language is ID
SendClientMessageLang(playerid, ID, 0xFFFFFFFF, "This is the indonesian message"); // Send the message into player if player's language is setted ID. It will not send if player's language is EN
Send client message to all

Function:
pawn Код:
SendClientMessageToAllLang(color, language id, message);
Example:
pawn Код:
SendClientMessageToAllLang(0xFFFFFFFF, EN, "This is the English message"); // Send the message to all player with EN language
SendClientMessageToAllLang(0xFFFFFFFF, ID, "This is the Indonesian message"); // Send the message to all player with ID language
Show a dialog to a specific player

Function:
pawn Код:
ShowPlayerDialogLang(playerid, language id, dialog id, dialog style, caption, message, button 1, button 2);
Example:
  1. First define the dialog'd id
    pawn Код:
    #define YOUR_DIALOG 100
  2. Then show the dialog into the player
    pawn Код:
    ShowPlayerDialogLang(playerid, EN, YOUR_DIALOG, DIALOG_STYLE_MSGBOX, "Dialog", "English dialog", "Button1", "Button2"); // Show the English dialog into player with language id EN
    ShowPlayerDialogLang(playerid, ID, YOUR_DIALOG, DIALOG_STYLE_MSGBOX, "Dialog", "Indonesian dialog", "Button1", "Button2"); // Show the Indonesian dialog into player with language id ID
Show a gametext to a specific player

Function:
pawn Код:
GameTextForPlayerLang(playerid, language id, message, duration, style);
Example:
pawn Код:
GameTextForPlayerLang(playerid, EN, "Message in English", 10000, 2); // Show a game text to palyer with EN language for 10 second. It will not showed if player's language is not EN
GameTextForPlayerLang(playerid, ID, "Message in Indonesian", 10000, 2); // Show a game text to palyer with ID language for 10 second. It will not showed if player's language is not ID
Show a gametext to all player

Function:
pawn Код:
GameTextForAllLang(language id, message, duration, style);
Example:
pawn Код:
GameTextForAllLang(EN, "English message", 10000, 2); // Show a gametext to all player with EN language for 10 second. It will not showed if player's language is not EN
GameTextForAllLang(ID, "Indonesian Message", 10000, 2); // Show a gametext to all player with ID language for 10 second. It will not showed if player's language is not ID
If i made a mistake, please correct me...
Reply
#2

Good job
Reply
#3

Quote:
Originally Posted by JonyNguyen
Посмотреть сообщение
Good job
thanks...
Reply
#4

and if i want for example leangua english | italian if i selelect english i want too see for exmaple all announce in english and if i type italian all in italian how i can do this ?
Reply
#5

Quote:
Originally Posted by BlackEvils
Посмотреть сообщение
and if i want for example leangua english | italian if i selelect english i want too see for exmaple all announce in english and if i type italian all in italian how i can do this ?
Somehow connect your server to ****** translator, and let it crappily translate your texts.
Or you can make a triallion lines script under OnPlayerText which translates everything word by word.
Or translate both announcements by yourself.

OnTopic:
You really need to explain more what you are doing in your codes. Otherwise it isn't a tutorial. A tut shows you a tutorial of something, and a tutorial explains. Well, The only positive thing I see here is that there are barely, or not even any tuts that talks about this...
Reply
#6

cie, good job sir :3
Reply
#7

Quote:
Originally Posted by BlackEvils
Посмотреть сообщение
and if i want for example leangua english | italian if i selelect english i want too see for exmaple all announce in english and if i type italian all in italian how i can do this ?
i dont know what did you mean ?? ?? ??

Quote:
Originally Posted by NaClchemistryK
Посмотреть сообщение
You really need to explain more what you are doing in your codes. Otherwise it isn't a tutorial. A tut shows you a tutorial of something, and a tutorial explains. Well, The only positive thing I see here is that there are barely, or not even any tuts that talks about this...
ok i'll fix it later....
i really-really have no free time, i have to take care of my server...

Quote:
Originally Posted by kloning1
Посмотреть сообщение
cie, good job sir :3
thanks...
Reply
#8

It is not translating the text rather it is simply using a function to send a message in other language ( We have to translate the text our self ) .

OT :
Add some more explanation to your tutorial so that newbies might get something about what you are talking about .
Reply
#9

Quote:
Originally Posted by iAnonymous
Посмотреть сообщение
It is not translating the text rather it is simply using a function to send a message in other language ( We have to translate the text our self ) .
thats why i dont give it name AL-Translator :v becouse it just language function
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)