Jump to content
  • 0

Dialog string


marianc

Question

Problema intalnita (descriere):Imi apare doar DynamicFactions[14](ultimul if)
Ero(area / rile) / warning-(ul / urile):Nu sunt
Liniile de cod / sursa / script-ul(obligatoriu):

CMD:factions(playerid, params[])
{
    if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to login first.");
	if(IsPlayerConnected(playerid))
	{
		new stringz2[MAX_STRING];
		if(DynamicFactions[1][fApp] == 1)
		{
			format(stringz2, sizeof(stringz2),"{FFFFFF}%s [%d] {00FF00}[aplicatii deschise]\n", DynamicFactions[1][fName], GetFactionMembers(1));
		}
		else
		{
			format(stringz2, sizeof(stringz2),"{FFFFFF}%s [%d] \n", DynamicFactions[1][fName], GetFactionMembers(1));
		}
		if(DynamicFactions[2][fApp] == 1)
		{
			format(stringz2, sizeof(stringz2),"{FFFFFF}%s [%d] {00FF00}[aplicatii deschise]\n", DynamicFactions[2][fName], GetFactionMembers(2));
		}
		else
		{
			format(stringz2, sizeof(stringz2),"{FFFFFF}%s [%d] \n", DynamicFactions[2][fName], GetFactionMembers(2));
		}
		if(DynamicFactions[3][fApp] == 1)
		{
			format(stringz2, sizeof(stringz2),"{FFFFFF}%s [%d] {00FF00}[aplicatii deschise]\n", DynamicFactions[3][fName], GetFactionMembers(3));
		}
		else
		{
			format(stringz2, sizeof(stringz2),"{FFFFFF}%s [%d] \n", DynamicFactions[3][fName], GetFactionMembers(3));
		}
		if(DynamicFactions[4][fApp] == 1)
		{
			format(stringz2, sizeof(stringz2),"{FFFFFF}%s [%d] {00FF00}[aplicatii deschise]\n", DynamicFactions[4][fName], GetFactionMembers(4));
		}
		else
		{
			format(stringz2, sizeof(stringz2),"{FFFFFF}%s [%d] \n", DynamicFactions[4][fName], GetFactionMembers(4));
		}
		if(DynamicFactions[5][fApp] == 1)
		{
			format(stringz2, sizeof(stringz2),"{FFFFFF}%s [%d] {00FF00}[aplicatii deschise]\n", DynamicFactions[5][fName], GetFactionMembers(5));
		}
		else
		{
			format(stringz2, sizeof(stringz2),"{FFFFFF}%s [%d] \n", DynamicFactions[5][fName], GetFactionMembers(5));
		}
		if(DynamicFactions[6][fApp] == 1)
		{
			format(stringz2, sizeof(stringz2),"{FFFFFF}%s [%d] {00FF00}[aplicatii deschise]\n", DynamicFactions[6][fName], GetFactionMembers(6));
		}
		else
		{
			format(stringz2, sizeof(stringz2),"{FFFFFF}%s [%d] \n", DynamicFactions[6][fName], GetFactionMembers(6));
		}
		if(DynamicFactions[7][fApp] == 1)
		{
			format(stringz2, sizeof(stringz2),"{FFFFFF}%s [%d] {00FF00}[aplicatii deschise]\n", DynamicFactions[7][fName], GetFactionMembers(7));
		}
		else
		{
			format(stringz2, sizeof(stringz2),"{FFFFFF}%s [%d] \n", DynamicFactions[7][fName], GetFactionMembers(7));
		}
		if(DynamicFactions[8][fApp] == 1)
		{
			format(stringz2, sizeof(stringz2),"{FFFFFF}%s [%d] {00FF00}[aplicatii deschise]\n", DynamicFactions[8][fName], GetFactionMembers(8));
		}
		else
		{
			format(stringz2, sizeof(stringz2),"{FFFFFF}%s [%d] \n", DynamicFactions[8][fName], GetFactionMembers(8));
		}
		if(DynamicFactions[9][fApp] == 1)
		{
			format(stringz2, sizeof(stringz2),"{FFFFFF}%s [%d] {00FF00}[aplicatii deschise]\n", DynamicFactions[9][fName], GetFactionMembers(9));
		}
		else
		{
			format(stringz2, sizeof(stringz2),"{FFFFFF}%s [%d] \n", DynamicFactions[9][fName], GetFactionMembers(9));
		}
		if(DynamicFactions[10][fApp] == 1)
		{
			format(stringz2, sizeof(stringz2),"{FFFFFF}%s [%d] {00FF00}[aplicatii deschise]\n", DynamicFactions[10][fName], GetFactionMembers(10));
		}
		else
		{
			format(stringz2, sizeof(stringz2),"{FFFFFF}%s [%d] \n", DynamicFactions[10][fName], GetFactionMembers(10));
		}
		if(DynamicFactions[11][fApp] == 1)
		{
			format(stringz2, sizeof(stringz2),"{FFFFFF}%s [%d] {00FF00}[aplicatii deschise]\n", DynamicFactions[11][fName], GetFactionMembers(11));
		}
		else
		{
			format(stringz2, sizeof(stringz2),"{FFFFFF}%s [%d] \n", DynamicFactions[11][fName], GetFactionMembers(11));
		}
		if(DynamicFactions[12][fApp] == 1)
		{
			format(stringz2, sizeof(stringz2),"{FFFFFF}%s [%d] {00FF00}[aplicatii deschise]\n", DynamicFactions[12][fName], GetFactionMembers(12));
		}
		else
		{
			format(stringz2, sizeof(stringz2),"{FFFFFF}%s [%d] \n", DynamicFactions[12][fName], GetFactionMembers(12));
		}
		if(DynamicFactions[13][fApp] == 1)
		{
			format(stringz2, sizeof(stringz2),"{FFFFFF}%s [%d] {00FF00}[aplicatii deschise]\n", DynamicFactions[13][fName], GetFactionMembers(13));
		}
		else
		{
			format(stringz2, sizeof(stringz2),"{FFFFFF}%s [%d] \n", DynamicFactions[13][fName], GetFactionMembers(13));
		}
		if(DynamicFactions[14][fApp] == 1)
		{
			format(stringz2, sizeof(stringz2),"{FFFFFF}%s [%d] {00FF00}[aplicatii deschise]\n", DynamicFactions[14][fName], GetFactionMembers(14));
		}
		else
		{
			format(stringz2, sizeof(stringz2),"{FFFFFF}%s [%d] \n", DynamicFactions[14][fName], GetFactionMembers(14));
		}
		ShowPlayerDialog(playerid, DIALOG_FACTIONSLIST, DIALOG_STYLE_LIST,"Factions", string, "OK", "");
	}
	return 1;
}


Imagini / Video (optional):sa_mp_018.png
Ati incercat sa rezolvati singur?: Da

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 1

Greseala la tine era ca nu includeai si stringz2 in format asa ca nu iti stoca decat ultima factiune in string.

Foloseste ce ti-am lasat mai jos si o sa-ti mearga asa cum trebuie ;)

CMD:factions(playerid, params[])
{
    if( gPlayerLogged[ playerid ] == 0 ) 
    	return SendClientMessage( playerid, COLOR_LIGHTRED, "You need to login first." );

    new factionString[ 1024 ];
    for( new fID = 1; fID <= 14; fID++ )
		if( DynamicFactions[ fID ][ fApp ] )
			format( factionString, sizeof factionString, "%s{FFFFFF}%s [%d] {00FF00}[aplicatii deschise]\n", factionString, DynamicFactions[ fID ][fName], GetFactionMembers( fID ) );
		else format( factionString, sizeof factionString, "%s{FFFFFF}%s [%d]\n", factionString, DynamicFactions[ fID ][fName], GetFactionMembers( fID ) );

	ShowPlayerDialog( playerid, DIALOG_FACTIONSLIST, DIALOG_STYLE_LIST, "Factions", factionString, "OK", "" );
	return true;
}

 

Edited by SoNNy.sys
  • Upvote 1

Sinner.png

Link to comment
Share on other sites

  • 0
3 hours ago, SoNNy.sys said:

Greseala la tine era ca nu includeai si stringz2 in format asa ca nu iti stoca decat ultima factiune in string.

Foloseste ce ti-am lasat mai jos si o sa-ti mearga asa cum trebuie ;)

CMD:factions(playerid, params[])
{
    if( gPlayerLogged[ playerid ] == 0 ) 
    	return SendClientMessage( playerid, COLOR_LIGHTRED, "You need to login first." );

    new factionString[ 1024 ];
    for( new fID = 1; fID <= 14; fID++ )
		if( DynamicFactions[ fID ][ fApp ] )
			format( factionString, sizeof factionString, "%s{FFFFFF}%s [%d] {00FF00}[aplicatii deschise]\n", factionString, DynamicFactions[ fID ][fName], GetFactionMembers( fID ) );
		else format( factionString, sizeof factionString, "%s{FFFFFF}%s [%d]\n", factionString, DynamicFactions[ fID ][fName], GetFactionMembers( fID ) );

	ShowPlayerDialog( playerid, DIALOG_FACTIONSLIST, DIALOG_STYLE_LIST, "Factions", factionString, "OK", "" );
	return true;
}

 

Multumesc de sfat.

Link to comment
Share on other sites

  • -2

Inloc de toate ifurile alea de ce nu faci un for?

For new i; i <15; i++

format(stringz2, sizeof(stringz2),"{FFFFFF}%s [%d] \n", DynamicFactions[fName], GetFactionMembers(i));

strcat string2,string);

 

E mai usor si ocupi si spatiu mai putin

 

    __  ____      __           
   /  |/  (_)____/ /____  _____
  / /|_/ / / ___/ __/ _ \/ ___/
 / /  / / (__  ) /_/  __/ /    
/_/  /_/_/____/\__/\___/_/     
SERVICII SCRIPTING DE CALITATE
Pagina     Scripting     pawn
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.