language system
#1

How to create language system ?
Reply
#2

PHP код:
new language[MAX_PLAYERS];

if(
language[playerid] == 1){ do something }
else if(
language[playerid] == 2){ do this 
Reply
#3

PHP код:
new language[MAX_PLAYERS][16];
if(!
strcmp(language[playerid], "packistani")) print("India > packIStan :PP");
else if(!
strcmp(language[playerid], "indion")) print("am Idia .. "); 
Reply
#4

Quote:
Originally Posted by KingHual
Посмотреть сообщение
PHP код:
new language[MAX_PLAYERS][16];
if(!
strcmp(language[playerid], "packistani")) print("India > packIStan :PP");
else if(!
strcmp(language[playerid], "india")) print("am Idia .. "); 
Packistan, ok.

OnTopic:

Create a variable which determines the player's language selected for example you show a dialog upon connecting to select the language player would like to view.

pawn Код:
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;
}
Reply
#5

https://sampforum.blast.hk/showthread.php?tid=573825

If you need more use http://forum.sa-mp.com/search.php
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)