Dialogs with strcat
#1

Код:
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?
Reply
#2

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;
}
Reply
#3

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;
}

Reply
#4

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

ty
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)