Format message
#1

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.
Reply
#2

bump
Reply
#3

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

Reply
#4

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);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)