SA-MP Forums Archive
Dialogs with strcat - 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: Dialogs with strcat (/showthread.php?tid=606931)



Dialogs with strcat - Lajko1 - 11.05.2016

Код:
YCMD:test(playerid,params[],help)
{
    new szDialog[700];
    strcat(szDialog, "{8585C2}Event Name\t{8585C2}Event Type\t{8585C2}Current Votes");
    strcat(szDialog, "\n{008000}Terrorists vs Counter Terrorists\t {800080}TDM\t{FF8000}%d Votes", EventVoteType[0]);
    strcat(szDialog, "\n{008000}I the Conquer\t {800080}DM\t{FF8000}%d Votes",EventVoteType[1]);
    strcat(szDialog, "\n{008000}Don't let them take it!\t {800080}TDM\t{FF8000}%d Votes",EventVoteType[2]);
    
	ShowPlayerDialog(playerid, DIALOG_EVENT, DIALOG_STYLE_TABLIST_HEADERS, "{0080FF}Vote for your favorite event", szDialog, "Next", "Close");
	return 1;
}
It shows the dialog but not the list things, why not?


Re: Dialogs with strcat - F1N4L - 11.05.2016

You need to format the string to insert into strcat.

Код:
YCMD:test(playerid,params[],help)
{
    new szDialog[700], String[100];
	
    strcat(szDialog, "{8585C2}Event Name\t{8585C2}Event Type\t{8585C2}Current Votes");
	format(String, sizeof String, "\n{008000}Terrorists vs Counter Terrorists\t {800080}TDM\t{FF8000}%d Votes", EventVoteType[0]);
    strcat(szDialog, String);
	format(String, sizeof String, "\n{008000}I the Conquer\t {800080}DM\t{FF8000}%d Votes",EventVoteType[1]);
    strcat(szDialog, String);
	format(String, sizeof String, "\n{008000}Don't let them take it!\t {800080}TDM\t{FF8000}%d Votes",EventVoteType[2]);
    strcat(szDialog, String);
	
	ShowPlayerDialog(playerid, DIALOG_EVENT, DIALOG_STYLE_TABLIST_HEADERS, "{0080FF}Vote for your favorite event", szDialog, "Next", "Close");
	
	return 1;
}



Re: Dialogs with strcat - Bolex_ - 11.05.2016

Try this

Quote:

YCMD:test(playerid,params[],help)
{
new szDialog[700];
strcat(szDialog, "{8585C2}Event Name\t{8585C2}Event Type\t{8585C2}Current Votes",sizeof(szDialog));
strcat(szDialog, "\n{008000}Terrorists vs Counter Terrorists\t {800080}TDM\t{FF8000}%d Votes", EventVoteType[0]",sizeof(szDialog));
strcat(szDialog, "\n{008000}I the Conquer\t {800080}DM\t{FF8000}%d Votes",EventVoteType[1]",sizeof(szDialog));
strcat(szDialog, "\n{008000}Don't let them take it!\t {800080}TDM\t{FF8000}%d Votes",EventVoteType[2]",sizeof(szDialog));

ShowPlayerDialog(playerid, DIALOG_EVENT, DIALOG_STYLE_TABLIST_HEADERS, "{0080FF}Vote for your favorite event", szDialog, "Next", "Close");
return 1;
}




Re: Dialogs with strcat - KevinReinke - 11.05.2016

Strcat doesn't support formatting. Use format then append the formatted string to szDialog with strcat.

EDIT: F1N4L's code will get the job done.


Re: Dialogs with strcat - Lajko1 - 11.05.2016

ty