SA-MP Forums Archive
Format message - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Format message (/showthread.php?tid=638804)



SendFormatMessageL - RedGun2015 - 06.08.2017

Hello,

I want to know how can I use 2 languges in one message using format.

something like this:
Код:
SendFormatMessageL(playerid, COLOR_WHITE, "Hello %s!", "Ciao %s!", GetName(playerid));
I know how to send a normal format message (format(string, sizeof(string)....) but i don't know how to use format to use 2 languages.

Can someone help me?

And yes, my english is very bad.

Thanks.


Respuesta: Format message - RedGun2015 - 07.08.2017

bump


Re: Format message - Kraeror - 07.08.2017

I think it can help you:
Quote:

new string[256];
if(Language == 1)
{
format(string, sizeof(string), "Hello %s!");
}
if(Language == 2)
{
format(string, sizeof(string), "Ciao%s!");
}
SendClientMessage(playerid, COLOR_WHITE, string);




Re: Format message - DarkZero - 07.08.2017

You can also use a specific variable for that.

pawn Код:
#define DIALOG_LANGUAGE 500

new PlayerLanguage[MAX_PLAYERS];

//under onplayerconnect for example
ShowPlayerDialog(playerid, DIALOG_LANGUAGE, DIALOG_STYLE_MSGBOX,"Language","Heyho. Please select a language.","English","Portuguese"); //or whatever your second lang is

//ondialogresponse
if(dialogid == DIALOG_LANGUAGE)
{
if(response)
{
PlayerLanguage[playerid] == 0; //english
}
else
{
PlayerLanguage[playerid] == 1;
}
}

//now you need (or can use) a stock to have a shortcut
stock SendLanguageMessage(playerid, color, msg_en[], msg_pr[])
{
if(PlayerLanguage[playerid] == 0)
SendClientMessage(playerid, color, msg_en);
else
SendClientMessage(playerid, color, msg_pr);
}

//and now you can do something like this:
new string[144], string2[144];
format(string, sizeof string, "Hello %s!", GetName(playerid));
format(string2, sizeof string2, "Ciao %s!", GetName(playerid));
SendLanguageMessage(playerid, color, string, string2);