Dialog problem
#1

This code should show me all the wanted reasons for player:
Код:
case DIALOG_SUSPECTNAME3:
{
	if(!response) return 1;
	new giveplayerid;
	if(!sscanf(inputtext, "u", giveplayerid))
	{
		new info[1024], caption[96];
		Wanted[playerid] = giveplayerid;
		format(caption, sizeof(caption), "Remove wanted points to %s", GetName(giveplayerid));
		if(PlayerInfo[giveplayerid][pWanted][0] == 1)
		{
			format(info, 128, "Wanted (1) Crime: {30D5C7}%s\n", PlayerInfo[giveplayerid][WantedReason1]);
		}
		if(PlayerInfo[giveplayerid][pWanted][1] == 1)
		{
			format(info, 128, "Wanted (2) Crime: {30D5C7}%s\n", PlayerInfo[giveplayerid][WantedReason2]);
		}
		if(PlayerInfo[giveplayerid][pWanted][2] == 1)
		{
			format(info, 128, "Wanted (3) Crime: {30D5C7}%s\n", PlayerInfo[giveplayerid][WantedReason3]);
		}
		if(PlayerInfo[giveplayerid][pWanted][3] == 1)
		{
			format(info, 128, "Wanted (4) Crime: {30D5C7}%s\n", PlayerInfo[giveplayerid][WantedReason4]);
		}
		if(PlayerInfo[giveplayerid][pWanted][4] == 1)
		{
			format(info, 128, "Wanted (5) Crime: {30D5C7}%s\n", PlayerInfo[giveplayerid][WantedReason5]);
		}
		if(PlayerInfo[giveplayerid][pWanted][5] == 1)
		{
			format(info, 128, "Wanted (6) Crime: {30D5C7}%s\n", PlayerInfo[giveplayerid][WantedReason6]);
		}
		ShowPlayerDialog(playerid, DIALOG_REMOVESUSPECT, DIALOG_STYLE_LIST, caption, info, "Select", "Cancel");
	}
}
Instead it shows only 1 wanted, It shows only 1 of them, If pWanted[4] and pWanted[5] == 1 i want them both to be showed in the dialog... all those who 0 doesn't show, which is good.
Reply
#2

Using format will format the string to what you specified, while strcat will add to it.
So use strcat.
Reply
#3

Quote:
Originally Posted by CalvinC
Посмотреть сообщение
Using format will format the string to what you specified, while strcat will add to it.
So use strcat.
But I cannot use this in strcat: "%s", Reason... I need format to get the reason, can you show me how im putting this to strcat?
Reply
#4

Format the string to add, here's an example:
pawn Код:
new info2[157];
if(PlayerInfo[giveplayerid][pWanted][0] == 1)
{
    format(info2, 128, "Wanted (1) Crime: {30D5C7}%s\n", PlayerInfo[giveplayerid][WantedReason1]");
    strcat(info, info2);
}
Reply
#5

Quote:
Originally Posted by CalvinC
Посмотреть сообщение
Format the string to add, here's an example:
pawn Код:
new info2[157];
if(PlayerInfo[giveplayerid][pWanted][0] == 1)
{
    format(info2, 128, "Wanted (1) Crime: {30D5C7}%s\n", PlayerInfo[giveplayerid][WantedReason1]");
    strcat(info, info2);
}
Yes! this worked well. thank you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)