SA-MP Forums Archive
string problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: string problem (/showthread.php?tid=635972)



string problem - StR_MaRy - 17.06.2017

hey guys i have a command and i use a big string and i know is not right to use a bigger string than the message but without 1024 is not working...

HTML Code:
CMD:factions(playerid, params[])
{
	if(gLogged[playerid] == 0) return SendClientMessage(playerid,COLOR_ERROR, "Tu nu esti logat si nu poti sa folosesti aceasta comanda!");
  	new var[1024];
  	new coordsstring[64] = "ID\tNume\tMembrii/Sloturi\tAplicatii\n";
	for(new i = 1; i < sizeof(FactionInfo); i++)
	{
		format(gString, sizeof(gString), "%d.\t%s\t[%d/%d]\t%s\n", i, FactionInfo[i][fName], GetFactionMembers(i), FactionInfo[i][fSlots], GetFactionStatus(i));
  		strcat(var, gString);
	}
	strins(var, coordsstring, 0);
	ShowPlayerDialog(playerid, DIALOG_FACTIONS, DIALOG_STYLE_TABLIST_HEADERS, "Factiuni", var, "Inchide", "");
	return 1;
}
idea?


Re: string problem - Cypress - 17.06.2017

Quote:
Originally Posted by StR_MaRy
View Post
hey guys i have a command and i use a big string and i know is not right to use a bigger string than the message but without 1024 is not working...

HTML Code:
CMD:factions(playerid, params[])
{
	if(gLogged[playerid] == 0) return SendClientMessage(playerid,COLOR_ERROR, "Tu nu esti logat si nu poti sa folosesti aceasta comanda!");
  	new var[1024];
  	new coordsstring[64] = "ID\tNume\tMembrii/Sloturi\tAplicatii\n";
	for(new i = 1; i < sizeof(FactionInfo); i++)
	{
		format(gString, sizeof(gString), "%d.\t%s\t[%d/%d]\t%s\n", i, FactionInfo[i][fName], GetFactionMembers(i), FactionInfo[i][fSlots], GetFactionStatus(i));
  		strcat(var, gString);
	}
	strins(var, coordsstring, 0);
	ShowPlayerDialog(playerid, DIALOG_FACTIONS, DIALOG_STYLE_TABLIST_HEADERS, "Factiuni", var, "Inchide", "");
	return 1;
}
idea?
HTML Code:
CMD:factions(playerid, params[])
{
	if(!gLogged[playerid]) 
return SendClientMessage(playerid,COLOR_ERROR, "Tu nu esti logat si nu poti sa folosesti aceasta comanda!");
	for(new i = 1; i < sizeof(FactionInfo); i++)
	{
		format(gString, sizeof(gString), "%s%d.\t%s\t[%d/%d]\t%s\n", gString, i, FactionInfo[i][fName], GetFactionMembers(i), FactionInfo[i][fSlots], GetFactionStatus(i));
	}
	strins(gString, ID\tNume\tMembrii/Sloturi\tAplicatii\n, 0);
	ShowPlayerDialog(playerid, DIALOG_FACTIONS, DIALOG_STYLE_TABLIST_HEADERS, "Factiuni", gString, "Inchide", "");
	return 1;
}
Try this.


Re: string problem - StR_MaRy - 17.06.2017

Quote:
Originally Posted by Cypress
View Post
HTML Code:
CMD:factions(playerid, params[])
{
	if(!gLogged[playerid]) 
return SendClientMessage(playerid,COLOR_ERROR, "Tu nu esti logat si nu poti sa folosesti aceasta comanda!");
	for(new i = 1; i < sizeof(FactionInfo); i++)
	{
		format(gString, sizeof(gString), "%s%d.\t%s\t[%d/%d]\t%s\n", gString, i, FactionInfo[i][fName], GetFactionMembers(i), FactionInfo[i][fSlots], GetFactionStatus(i));
	}
	strins(gString, ID\tNume\tMembrii/Sloturi\tAplicatii\n, 0);
	ShowPlayerDialog(playerid, DIALOG_FACTIONS, DIALOG_STYLE_TABLIST_HEADERS, "Factiuni", gString, "Inchide", "");
	return 1;
}
Try this.
Nope is reading just 11 from 18 factions and at 1 is giving the News from that faction


Re: string problem - Cypress - 17.06.2017

Quote:
Originally Posted by StR_MaRy
View Post
Nope is reading just 11 from 18 factions and at 1 is giving the News from that faction
Your problem was that it was not working if the string size was not 1024, that's solved. The other issue is a different thing which you'd have to do some debugs before requesting any help since your code contains functions. I'd check what they return.

Plus you have somewhere else defined gString, alter it's size and see if that helps.