SA-MP Forums Archive
new dialog styles with formatting - 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: new dialog styles with formatting (/showthread.php?tid=569392)



new dialog styles with formatting - beckzy - 30.03.2015

Is it possible to use format() to format each row with the new dialog styles? E.g:

Код:
enum weap_data
{
	weapname[10],
	weapid
}

new weapinfo[][weap_data] =
{
	{"Deagle",  24},
	{"Shotgun",  25},
	{"Micro Uzi",  28}
};
How would I use format() to create a tablist header dialog like this:

Код:
Weapon Name			Weapon ID
Deagle				24
Shotgun				25
Micro Uzi			28



Re: new dialog styles with formatting - Kar - 30.03.2015

Look at the examples in the RC3 filterscripts.

pawn Код:
TabListDialogTest(playerid)
{
      new listitems[] =
      "Deagle\t$5000\t100\n" \
      "Sawnoff\t$5000\t100\n" \
      "Pistol\t$1000\t50\n" \
      "M4\t$10000\t100\n" \
      "MP5\t$7500\t200\n" \
      "Grenade\t$500\t1\n" \
      "Parachute\t$10000\t1\n" \
      "Lorikeet\t$50000\t500\n";

      ShowPlayerDialog(playerid,2,DIALOG_STYLE_TABLIST,"Buy Weapon",listitems,"Select","Cancel");
}

//-------------------------------------------------

TabListHeadersDialogTest(playerid)
{
      new listitems[] =
      "Weapon\tPrice\tAmmo\n" \
      "Deagle\t$5000\t100\n" \
      "Sawnoff\t$5000\t100\n" \
      "Pistol\t$1000\t50\n" \
      "M4\t$10000\t100\n" \
      "MP5\t$7500\t200\n" \
      "Grenade\t$500\t1\n" \
      "Parachute\t$10000\t1\n" \
      "Lorikeet\t$50000\t500\n";

      ShowPlayerDialog(playerid,2,DIALOG_STYLE_TABLIST_HEADERS,"Buy Weapon",listitems,"Select","Cancel");
}
So just use tab, once you put the correct dialog style.

pawn Код:
format(string, sizeof(string), "Weapon Name\tWeapon ID\n%s\t%d\n%s\t%d\n%s\t%d", weapinfo[0][weapname], weapinfo[0][weapid], weapinfo[1][weapname], weapinfo[1][weapid], weapinfo[02[weapname], weapinfo[02[weapid]);
with DIALOG_STYLE_TABLIST_HEADERS


Re: new dialog styles with formatting - rootcause - 30.03.2015

Код:
new list[144];
format(list, sizeof(list), "Weapon Name\tWeapon ID\n");
for(new i; i < sizeof(weapinfo); ++i)
{
	format(list, sizeof(list), "%s%s\t%d\n", list, weapinfo[i][weapname], weapinfo[i][weapid]);
}

ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_TABLIST_HEADERS, "Weapons", list, "Select", "Cancel");



Re: new dialog styles with formatting - beckzy - 30.03.2015

It's as simple as that? I will try it out. Thanks