SendFormatMessage in language
#1

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

Try this:
PHP код:
SendFormatLangMSG(playeridcolorro[], en[], va_args<>)
{
        new 
mesaj[128];
    switch( 
PlayerInfoplayerid ][ pLanguage ] )
    {
        case 
1va_format(mesajsizeof (mesaj), rova_start<3>); //Assuming that 1 is romana
        
case 2va_format(mesajsizeof (mesaj), enva_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
Reply
#3

Doesn't mean he can't use stock while creating functions, but the thumb rule is to learn what it's meant for.
Reply
#4

@Paulice I have explained to him in his native language that stock means "ignore this if not used"..
Reply
#5

@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?
Reply
#6

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

Quote:
Originally Posted by ******
Посмотреть сообщение
You need to change the skipped parameter count.
You meant this va_start<3> ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)