How could i?
#1

pawn Код:
stock SendLangMessageToAll(const eng[],const esp[])
{
    new string[250];
    for(new i = 0; i < MAX_PLAYERS;i++)
    {
        if(GetLang(i) == 1)
        {
            format(string,sizeof(string),"%s",eng);
        }
        if(GetLang(i) == 2)
        {
            format(string,sizeof(string),"%s",esp);
        }
        SendClientMessage(i,green2,string);
    }
    return 1;
}
That when i do in a function or command SendLangMessageToAll("Hello","Hola");
But how could i make that so i can do SendLangMessageToAll("Hello there %s","Hola %s",GetPlayerName(playerid,pName,sizeof(pName));
Reply
#2

Quote:
Originally Posted by FireCat
Посмотреть сообщение
pawn Код:
stock SendLangMessageToAll(const eng[],const esp[])
{
    new string[250];
    for(new i = 0; i < MAX_PLAYERS;i++)
    {
        if(GetLang(i) == 1)
        {
            format(string,sizeof(string),"%s",eng);
        }
        if(GetLang(i) == 2)
        {
            format(string,sizeof(string),"%s",esp);
        }
        SendClientMessage(i,green2,string);
    }
    return 1;
}
That when i do in a function or command SendLangMessageToAll("Hello","Hola");
But how could i make that so i can do SendLangMessageToAll("Hello there %s","Hola %s",GetPlayerName(playerid,pName,sizeof(pName));
Format the string and send it like parameter. E.g.:
PHP код:
format(stringsizeof(string), "Hello there %s""FireCat");
format(string1sizeof(string), "Hola %s""FireCat");
SendLangMessageToAll(stringstring1); 
And your function can be edited a bit:
PHP код:
stock SendLangMessageToAll(const eng[], const esp[])
{
    for(new 
0MAX_PLAYERSi++)
    {
        if(!
IsPlayerConnected(i)) continue;
        
SendClientMessage(igreen2, (!(GetLang(i) == 2) ? (eng) : (esp)));
    }
    return 
1;

Reply
#3

pawn Код:
#if !defined SendLanguageMessage
    static
        __langString[128]
    ;
    #define SendLanguageMessage(%0,%1,%2,%3,%4,%5) \
        format(__langString, sizeof(__langString), (%2) ? (%3) : (%4), %5), SendClientMessage((%0), (%1), __langString)
   
    #pragma unused __langString
#endif
Then just create a global variable (or PVar) where you assign the language. (0 for English, 1 for your language).
pawn Код:
SendLanguageMessage(playerid, color, IndexLanguageVar, "Hello there %s", "Hola %s", GetName(playerid));
Reply
#4

Quote:
Originally Posted by RyDeR`
Посмотреть сообщение
pawn Код:
#if !defined SendLanguageMessage
    static
        __langString[128]
    ;
    #define SendLanguageMessage(%0,%1,%2,%3,%4,%5) \
        format(__langString, sizeof(__langString), (%2) ? (%3) : (%4), %5), SendClientMessage((%0), (%1), __langString)
   
    #pragma unused __langString
#endif
Then just create a global variable (or PVar) where you assign the language. (0 for English, 1 for your language).
pawn Код:
SendLanguageMessage(playerid, color, IndexLanguageVar, "Hello there %s", "Hola %s", GetName(playerid));
I didn't understand that. Explain better
I really need it fast, it's crashing my server! :@
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)