Jump to content

Cum sa faci o comanda in mai multe limbi.


CrystyaN

Recommended Posts

Salut, am sa va arat ce-a mai simpla metoda(cred), cum sa faci o comanda in mai multe limbi.

[glow=black,2,300]1.[/glow] [glow=black,2,400]Adaugam aceasta variablia.[/glow]

[pawn]

enum OptiuniServer {

Limba };

new Option[OptiuniServer];[/pawn]

[glow=black,2,300]2. [/glow][glow=black,2,400]Acum sa facem comanda.[/glow]

[pawn]

if(strcmp(cmd, "/cmdtest", true) == 0)

{

if(Option[Limba] ==1)SendClientMessage(playerid, 0xFFFFFFAA, "** Salut George ce faci?");else // Romana

if(Option[Limba] ==2)SendClientMessage(playerid, 0xFFFFFFAA, "** Hi Tom how are you?");else // Engleza

if(Option[Limba] ==3)SendClientMessage(playerid, 0xFFFFFFAA, "** Hola Xavi que passa?"); // Spaniola

                // s.a.m.d cate limbi doriti voi

return 1;

}[/pawn]

Acum, eu v-as recomanda sa faceti, atunci cand un player se logheaza, dupa ce scrie parola sa-i apare un dialog unde sa-si aleaga limba dorita.

[glow=black,2,300]3. [/glow][glow=black,2,400]La OnPlayerLogin pe la sfarsit facem asa.[/glow]

Dialogul:

[pawn]ShowPlayerDialog(playerid,1996,DIALOG_STYLE_LIST,"Limba/Language/Idioma","Romana\nEnghlis\nEspañol","Select", "");[/pawn]

[glow=black,2,300]4. [/glow][glow=black,2,400]La OnDialogResponse adaugam[/glow]

[pawn]

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.");

}

}

}[/pawn]

Cam atat a fost tot...

Bafta :)

 

Link to comment
Share on other sites

Guest PlayON

[pawn]if(Option[Limba] ==1)SendClientMessage(playerid, 0xFFFFFFAA, "** Salut George ce faci?");else // Romana

if(Option[Limba] ==2)SendClientMessage(playerid, 0xFFFFFFAA, "** Hi Tom how are you?");else // Engleza

if(Option[Limba] ==3)SendClientMessage(playerid, 0xFFFFFFAA, "** Hola Xavi que passa?"); // Spaniola [/pawn]

Asta se poate simplifica cu o functie gen:

[pawn]

SCML( p, color, ro[ ], eng[ ], esp[ ] )

{

if ( Option[ Limba ] == 0  ) SendClientMessage( p, color, ro );

else if ( Option[ Limba ] == 1  ) SendClientMessage( p, color, eng );

else if ( Option[ Limba ] == 2  ) SendClientMessage( p, color, esp );

else SendClientMessage( p, color, "An error has occurted" );

return 1;

}[/pawn]

Folosire

[pawn]SCML( playerid, 0xFF0000FF,"Salut", "Hello", "Ola" )[/pawn]

Mai bine ai folosi 0, 1, 2 la Option[ Limba ] si la OnGameModeInit/OnFilterScriptInit pui Option[ Limba ] = 0;

Mai bine sa incepi cu 0 decat cu 1.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.