[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


Messages In This Thread
How To Use Multi Language - by AiRaLoKa - 15.05.2014, 04:36
Re: How To Use Multi Language - by JonyNguyen - 15.05.2014, 04:43
Re: How To Use Multi Language - by AiRaLoKa - 15.05.2014, 04:51
Re: How To Use Multi Language - by BlackEvils - 19.05.2014, 14:22
Re: How To Use Multi Language - by NaClchemistryK - 19.05.2014, 15:45
Re: How To Use Multi Language - by kloning1 - 20.05.2014, 08:09
Re: How To Use Multi Language - by AiRaLoKa - 20.05.2014, 11:57
Re: How To Use Multi Language - by iAnonymous - 20.05.2014, 12:43
Re: How To Use Multi Language - by AiRaLoKa - 20.05.2014, 22:08

Forum Jump:


Users browsing this thread: 1 Guest(s)