[Tutorial] How to make an order in several languages
#1

Hello, I will show you the easiest way (I think), how to make an order in several languages.

1.Add this variable.
Код:
enum OptiuniServer {
Limba };
new Option[OptiuniServer];
2.Now create command
Код:
	if(strcmp(cmd, "/cmdtest", true) == 0)
	{
		if(Option[Limba] ==1)SendClientMessage(playerid, 0xFFFFFFAA, "** Salut George ce faci?");else // Romanian
		if(Option[Limba] ==2)SendClientMessage(playerid, 0xFFFFFFAA, "** Hi Tom how are you?");else // English
		if(Option[Limba] ==3)SendClientMessage(playerid, 0xFFFFFFAA, "** Hola Xavi que passa?"); // Spanish 
                
		return 1;
	}
Now, I would recommend you to do when a player logs in, after i write the password to a dialog appears where you choose your language.
3.At the end OnPlayerLogin do so.
Код:
ShowPlayerDialog(playerid,1996,DIALOG_STYLE_LIST,"Limba/Language/Idioma","Romana\nEnghlis\nEspaГ±ol","Select", "");
4.Add to OnDialogResponse
Код:
		if(dialogid == 1996)
		{
			if(response)
			{
            	if(listitem == 0)
				{
                	Option[Limba] = 1;
                	SendClientMessage(playerid, 0xFFFFFFAA, "** Ai selectat limba romana.");
				}
				if(listitem == 1)
				{
			      	Option[Limba] = 2;
			      	SendClientMessage(playerid, 0xFFFFFFAA, "** You have selected enghlish language."); 
				}
				if(listitem == 2)
				{
			      	Option[Limba] = 3;
			      	SendClientMessage(playerid, 0xFFFFFFAA, "** Lengua espaГ±ola se ha seleccionado."); 
				}
			}
		}
So much was it ...
Reply
#2

Terribly indented and Never explained what each function does.
Reply
#3

0/10, this is NOT a tutorial, go to hell and come back later
Reply
#4

https://sampforum.blast.hk/showthread.php?tid=295580
Reply
#5

Don't want to make you feel bad but it's terrible
Reply
#6

Quote:
Originally Posted by mehdi-jumper
Посмотреть сообщение
0/10, this is NOT a tutorial, go to hell and come back later
Why would you tell him to go to hell rather than try to help him improve his tutorial? That's extremely rude...
Reply
#7

this code will not work properly,

af the the second player logins and select a new language it will change everyone language.

i think
pawn Код:
enum OptiuniServer {
Limba };
new Option[OptiuniServer];
would be much better like

pawn Код:
new gPlayerLang[MAX_PLAYERS];

//set it like so

gPlayerLang[playerid] = 2;
and you spell English wrong in the ShowPlayerDialog

0/10 from me.
Reply
#8

Better using YSI Language instead of variables, if you do a complex GameMode it takes a lot of memory.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)