24.05.2015, 08:45
How to create language system ?
new language[MAX_PLAYERS];
if(language[playerid] == 1){ do something }
else if(language[playerid] == 2){ do this }
new language[MAX_PLAYERS][16];
if(!strcmp(language[playerid], "packistani")) print("India > packIStan :PP");
else if(!strcmp(language[playerid], "indion")) print("am Idia .. ");
PHP код:
|
new language[MAX_PLAYERS];
#define DIALOG_LANGUAGE 911
// Depends on where and when you want to show the dialog.
ShowPlayerDialog(playerid,DIALOG_LANGUAGE,DIALOG_STYLE_LIST,"English\nOtherLanguage\OtherLanguage","Select","Cancel");
// OnDialogResponse
switch(dialog_id)
{
case DIALOG_LANGUAGE:
{
switch(listitem)
{
case 0:
{
language[playerid] = 1; // Let's say ID 1 language is English.
}
case 1:
{
language[playerid] = 2; // What language you want.
}
// and so on
}
}
}
// OnPlayerDoesSomething
switch(language)
{
case 1:
{
SendClientMessage(playerid,-1,"Selected language English.");
}
case 2:
{
SendClientMessage(playerid,-1,"adsaidsaidsaidad");
}
}
// Don't forget to reset the variable when the player disconnects.
public OnPlayerDisconnect(playerid, reason)
{
language[playerid] = 0;
}