new dialog styles with formatting
#1

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
Reply
#2

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

Код:
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");
Reply
#4

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


Forum Jump:


Users browsing this thread: 1 Guest(s)