15.05.2014, 04:36
(
Последний раз редактировалось AiRaLoKa; 15.05.2014 в 04:40.
Причина: i've made a mistake
)
How To Use Multi Language
Set the player's language
Function:
Function:
Example:
Send client message to all
Function:
Example:
Show a dialog to a specific player
Function:
Example:
Function:
Example:
Show a gametext to all player
Function:
Example:
If i made a mistake, please correct me...
Set the player's language
Function:
pawn Код:
PlayerLanguage(playerid, languageid);
- First of all you ned to download Multi Language
- Then paste it on your pawno's include folder (.../pawn/iclude)
- 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... - 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 - 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 - under OnDialogResponse, put these line
- 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)
}
}
} - 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)
}
}
- option 1
- Finished!
Function:
pawn Код:
SendClientMessageLang(playerid, language id, color, message);
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
Function:
pawn Код:
SendClientMessageToAllLang(color, language id, message);
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
Function:
pawn Код:
ShowPlayerDialogLang(playerid, language id, dialog id, dialog style, caption, message, button 1, button 2);
- First define the dialog'd id
pawn Код:#define YOUR_DIALOG 100 - 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
Function:
pawn Код:
GameTextForPlayerLang(playerid, language id, message, duration, style);
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
Function:
pawn Код:
GameTextForAllLang(language id, message, duration, style);
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