SA-MP Forums Archive
Dialog 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: Dialog problem (/showthread.php?tid=569405)



Dialog problem - maximthepain - 30.03.2015

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.


Re: Dialog problem - CalvinC - 30.03.2015

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


Re: Dialog problem - maximthepain - 30.03.2015

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?


Re: Dialog problem - CalvinC - 30.03.2015

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



Re: Dialog problem - maximthepain - 30.03.2015

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