SendFormatMessage in language -
None1337 - 08.09.2017
Hello, i tried to change this function
Код:
stock SCMF(playerid, color, const fmat[], va_args<>)
{
va_format(gString, sizeof (gString), fmat, va_start<3>);
return SendClientMessage(playerid, color, gString);
}
In something like this:
Код:
stock SendFormatLangMSG(playerid, color, const ro[], const en[], va_args<>)
{
switch( PlayerInfo[ playerid ][ pLanguage ] )
{
case 1: va_format(gString, sizeof (gString), ro, en, va_start<3>); //line
case 2: va_format(gString, sizeof (gString), ro, en, va_start<3>); //line
}
return SS(playerid, gString, ro, en);
}
But i get error
Код:
error 035: argument type mismatch (argument 4)
error 035: argument type mismatch (argument 2)
Can some one help me, i want to use a format like this (example):
Код:
SendFormatLangMSG(playerid, COLOR_WHITE, "Language 1", "Language 2", GetName(playerid));
Re: SendFormatMessage in language -
10MIN - 08.09.2017
Try this:
PHP код:
SendFormatLangMSG(playerid, color, ro[], en[], va_args<>)
{
new mesaj[128];
switch( PlayerInfo[ playerid ][ pLanguage ] )
{
case 1: va_format(mesaj, sizeof (mesaj), ro, va_start<3>); //Assuming that 1 is romana
case 2: va_format(mesaj, sizeof (mesaj), en, va_start<3>); //And 2 is english
}
SendClientMessage(playerid,color,mesaj);
}
PS: Don't use stock ussualy , because it is not a keyword for "function"
Or in romana:
Nu folosi stock pentru ca el inseamna de fapt "ignora aceasta <chestie> daca nu e folosita" (unde <chestie> poate fi functie sau variabila). La fel si const care inseamna "nu lasa nimic sa modifice variabila asta"
PS2: You can use y_text and y_languages from
YSI, a tut can be found here:
https://sampforum.blast.hk/showthread.php?tid=570943
Re: SendFormatMessage in language -
Paulice - 08.09.2017
Doesn't mean he can't use stock while creating functions, but the thumb rule is to learn what it's meant for.
Re: SendFormatMessage in language -
10MIN - 08.09.2017
@Paulice I have explained to him in his native language that stock means "ignore this if not used"..
Re: SendFormatMessage in language -
None1337 - 08.09.2017
@10MIN , I tested and when i use command for ex:
Код:
cmd:beta(playerid, params[])
{
SendFormatLangMSG(playerid, -1, "Test 1 %d", "Test 2 %d", playerid);
return 1;
}
The server is crash when i use, why?
----
I-a crash serverul, de ce?
Re: SendFormatMessage in language -
None1337 - 08.09.2017
Quote:
Originally Posted by None1337
@10MIN , I tested and when i use command for ex:
Код:
cmd:beta(playerid, params[])
{
SendFormatLangMSG(playerid, -1, "Test 1 %d", "Test 2 %d", playerid);
return 1;
}
The server is crash when i use, why?
----
I-a crash serverul, de ce?
|
bump
Re: SendFormatMessage in language -
None1337 - 08.09.2017
Quote:
Originally Posted by ******
You need to change the skipped parameter count.
|
You meant this
va_start<3> ?