Jump to content
  • 0

Transmitere mesaj in limba selectata


Rayan

Question

Problema intalnita (descriere): Initial vreau sa fac o comanda gen SendClientMessage, in care sa trimita un mesaj ori limbi selectate pe server (/romana , /english), spre exemplu

Limba Engleza = 1 , Romana = 2

Si eu fac asa, SendClientMessage2(playerid, -1, "This command is disable.", "Aceasta comanda este dezactivata");

Daca jucatorul are limba selectata pe engleza sa ii arate mesajul in engleza, si daca o are in romana, sa ii arate mesajul in romana.

Problema mea este ca nu am nicio idee cum sa fac aceasta chestie, sau de la ce as putea porni, si speram ca ma puteti ajuta voi.


Ero(area / rile) / warning-(ul / urile): -
Liniile de cod / sursa / script-ul(obligatoriu):-
Imagini / Video (optional):-
Ati incercat sa rezolvati singur?: nu am nicio idee.

Edited by Rayan
Link to comment
Share on other sites

12 answers to this question

Recommended Posts

  • 0

Faci publicul SendClientMessage2(playerid,color,tring1,string2)

{

If(limba[playerid]==1)

SendClientMessage(playerid,color,string1)

Else

SendClientMessage (playerid,color,string2)

}

 

 

    __  ____      __           
   /  |/  (_)____/ /____  _____
  / /|_/ / / ___/ __/ _ \/ ___/
 / /  / / (__  ) /_/  __/ /    
/_/  /_/_/____/\__/\___/_/     
SERVICII SCRIPTING DE CALITATE
Pagina     Scripting     pawn
Link to comment
Share on other sites

  • 0
26 minutes ago, Mister said:

Faci publicul SendClientMessage2(playerid,color,tring1,string2)

{

If(limba[playerid]==1)

SendClientMessage(playerid,color,string1)

Else

SendClientMessage (playerid,color,string2)

}

 

Am trecut forward: 

forward SS(playerid, color, string1, string2);

SI public-ul arata asa, insa imi dau 3 errori:

public SS(playerid, color, string1, string2)
{
    if(PlayerInfo[playerid][pLanguage] == 1)
    {
        SendClientMessage(playerid,color,string1)
    }
    else if(PlayerInfo[playerid][pLanguage] == 2)
    {
        SendClientMessage(playerid,color,string2)
    }
    return 1;
}

errori:

(20933) : error 035: argument type mismatch (argument 3)
(20937) : error 035: argument type mismatch (argument 3)
(41219) : error 035: argument type mismatch (argument 3)

Lini:

20933 -

SendClientMessage(playerid,color,string1)

20937 -

SendClientMessage(playerid,color,string2)

41219- e de la o comanda - e doar de test facuta

CMD:dd(playerid,params[])
{
    if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_RED2, "Nu poti folosi nicio comanda pentru ca nu esti logat.");
    SS(playerid, COLOR_ERROR, "You need to be admin 5+.", "Ai nevoie de a fi admin level 5+.");
    return 1;
}

si linia:

SS(playerid, COLOR_ERROR, "You need to be admin 5+", "Ai nevoie de a fi admin level 5+.");
Edited by Rayan
Link to comment
Share on other sites

  • 0
7 hours ago, Rayan said:

Am trecut forward: 

forward SS(playerid, color, string1, string2);

SI public-ul arata asa, insa imi dau 3 errori:

public SS(playerid, color, string1, string2)
{
    if(PlayerInfo[playerid][pLanguage] == 1)
    {
        SendClientMessage(playerid,color,string1)
    }
    else if(PlayerInfo[playerid][pLanguage] == 2)
    {
        SendClientMessage(playerid,color,string2)
    }
    return 1;
}

errori:

(20933) : error 035: argument type mismatch (argument 3)
(20937) : error 035: argument type mismatch (argument 3)
(41219) : error 035: argument type mismatch (argument 3)

Lini:

20933 -

SendClientMessage(playerid,color,string1)

20937 -

SendClientMessage(playerid,color,string2)

 

41219- e de la o comanda - e doar de test facuta

CMD:dd(playerid,params[])
{
    if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_RED2, "Nu poti folosi nicio comanda pentru ca nu esti logat.");
    SS(playerid, COLOR_ERROR, "You need to be admin 5+.", "Ai nevoie de a fi admin level 5+.");
    return 1;
}

si linia:

SS(playerid, COLOR_ERROR, "You need to be admin 5+", "Ai nevoie de a fi admin level 5+.");

Unde ai public SS(bla-bla, string1, string2)

Trebuie să pui [] după string1 si string2

Adică așa

String1[], string2[]

**********************************

Servicii Scripting de calitate:

*********************************

Future Project: ExpertGame

*********************************

Link to comment
Share on other sites

  • 0

Normal ca ii da erori nici macar nu mi-a citit codul pur si simplu il ia si il pune in gm

Intentionat l-am scris prost sa vad si eu daca macar incearca sa modifice

 

    __  ____      __           
   /  |/  (_)____/ /____  _____
  / /|_/ / / ___/ __/ _ \/ ___/
 / /  / / (__  ) /_/  __/ /    
/_/  /_/_/____/\__/\___/_/     
SERVICII SCRIPTING DE CALITATE
Pagina     Scripting     pawn
Link to comment
Share on other sites

  • 0
9 hours ago, Rayan said:

Am trecut forward: 

forward SS(playerid, color, string1, string2);

SI public-ul arata asa, insa imi dau 3 errori:

public SS(playerid, color, string1, string2)
{
    if(PlayerInfo[playerid][pLanguage] == 1)
    {
        SendClientMessage(playerid,color,string1)
    }
    else if(PlayerInfo[playerid][pLanguage] == 2)
    {
        SendClientMessage(playerid,color,string2)
    }
    return 1;
}

errori:

(20933) : error 035: argument type mismatch (argument 3)
(20937) : error 035: argument type mismatch (argument 3)
(41219) : error 035: argument type mismatch (argument 3)

Lini:

20933 -

SendClientMessage(playerid,color,string1)

20937 -

SendClientMessage(playerid,color,string2)

 

41219- e de la o comanda - e doar de test facuta

CMD:dd(playerid,params[])
{
    if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_RED2, "Nu poti folosi nicio comanda pentru ca nu esti logat.");
    SS(playerid, COLOR_ERROR, "You need to be admin 5+.", "Ai nevoie de a fi admin level 5+.");
    return 1;
}

si linia:

SS(playerid, COLOR_ERROR, "You need to be admin 5+", "Ai nevoie de a fi admin level 5+.");

Deja ai pretenții :))

**********************************

Servicii Scripting de calitate:

*********************************

Future Project: ExpertGame

*********************************

Link to comment
Share on other sites

  • 0

Na frate, sunt incepator, nu stiu sa pun fiecare lucru in parte, fiindca daca as sti, nu as mai posta...dar na..

 

Am facut asa si "error 025: function heading differs from prototype" habar nu am ce inseamna asta, nu am primit in viata mea erroarea aceasta. la linia " public SS(playerid, color, string1[], string2[]) "

Link to comment
Share on other sites

  • 0

Nu trebuie sa te chinui sa faci nu stiu ce functie sa dai mesaj dupa limba selectata.

Cand isi selecteaza limba pe server ar trebui sa o aibe salvata intr-o variabila nu? De ex eu am Data[playerid][Language].

faci 2 variabile

new RoMSG[300] = "Mesajul tau", EnMSG[300] = "Your Message";

Si dupa faci functia

SendClientMessage(playerid, -1,  (Data[playerid][Language] == 1) ? RoMSG : EnMSG); iar lui ii va aparea mesajul in limba pe care si-a selectat-o.

Link to comment
Share on other sites

  • 0
public SS(playerid, color, string1[], string2[])
{
    if(PlayerInfo[playerid][pLanguage] == 1) SendClientMessage(playerid,color,string1);
    else if(PlayerInfo[playerid][pLanguage] == 2) SendClientMessage(playerid,color,string2);
    return 1;
}

 

  • Upvote 1

Singura modalitate prin care ma puteti contacta:

http://steamcommunity.com/id/known_main

Link to comment
Share on other sites

  • 0
// Pui acest stock in Gamemode.
stock SendLanguageMessage( playerid, textColor, textEngleza[], textRomana[] )
{
	switch( PlayerInfo[ playerid ][ pLanguage ] )
	{
		case 1: SendClientMessage( playerid, textColor, textEngleza );
		case 2: SendClientMessage( playerid, textColor, textRomana );
	}
	return true;
}
// Cand o folosesti faci ceva de genul:
SendLanguageMessage( playerid, COLOR_RED, "Hello m8!", "Salut tovarase!" );

 

  • Upvote 1

Sinner.png

Link to comment
Share on other sites

  • 0

Nu înțeleg, de ce 1000 de persoane vin si postează aceeași functie, care face aceeași chestie, ii dați si mai mura.n eroarea care i.a dat putea să o rezolve singur dacă.si bătea capul.

Dar voi ii dați aceeași functie de 1000 de ori ca ii da băiatului o eroare.

Dar @Rayan folosește funtia lui @SoNNy.sys

1 hour ago, SoNNy.sys said:
// Pui acest stock in Gamemode.
stock SendLanguageMessage( playerid, textColor, textEngleza[], textRomana[] )
{
	switch( PlayerInfo[ playerid ][ pLanguage ] )
	{
		case 1: SendClientMessage( playerid, textColor, textEngleza );
		case 2: SendClientMessage( playerid, textColor, textRomana );
	}
	return true;
}
// Cand o folosesti faci ceva de genul:
SendLanguageMessage( playerid, COLOR_RED, "Hello m8!", "Salut tovarase!" );

 

Este cea mai optima.

T/C

  • Upvote 1

**********************************

Servicii Scripting de calitate:

*********************************

Future Project: ExpertGame

*********************************

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.