open.mp forum
[Pawn] [SOLVED] How use DIALOG_STYLE_TABLIST_HEADERS with loops for function wrong format - Printable Version

+- open.mp forum (https://forum.open.mp)
+-- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3)
+--- Forum: Pawn Scripting (https://forum.open.mp/forumdisplay.php?fid=10)
+--- Thread: [Pawn] [SOLVED] How use DIALOG_STYLE_TABLIST_HEADERS with loops for function wrong format (/showthread.php?tid=2049)



[SOLVED] How use DIALOG_STYLE_TABLIST_HEADERS with loops for function wrong format - PutuSuhartawan - 2021-05-25

SOLUTION:?

Put The format before for loops function

Code:
new trunkdataslot1items[1000]; format(trunkdataslot1items, sizeof(trunkdataslot1items), ""COL_RED"SQL ID\t"COL_BLUE"Items\t"COL_GREEN"Amount\n"); ? ? ? ? ? ? for(new s; s < MAX_TRUNK_SLOTS; s ) ? ? ? ? ? ? { ? ? ? ? ? ? ? ? ? ? ? ? ? ? format(trunkdataslot1items, sizeof(trunkdataslot1items), ? ? ? ? ? ? " %s %i \t"COL_GREEN" %s \t "COL_RED"%i %s \n", ? ? ? ? ? ? trunkdataslot1items, get_vehicle_trunk[closestcar][s][TRUNK_SQL_ID], GetItemInfo( get_vehicle_trunk[closestcar][s][TRUNK_ITEM_TYPE], I_NAME), get_vehicle_trunk[closestcar][s][TRUNK_ITEM_AMOUNT], GetItemInfo( get_vehicle_trunk[closestcar][s][TRUNK_ITEM_TYPE], I_NAME_COUNT)? ); ? ? ? ? ? ? printf("[TRUNK]: Slot:[%i], SQL ID:[%d], Item Type:[%d], Amount:[%d], ", s, get_vehicle_trunk[closestcar][s][TRUNK_SQL_ID], get_vehicle_trunk[closestcar][s][TRUNK_ITEM_TYPE],? get_vehicle_trunk[closestcar][s][TRUNK_ITEM_AMOUNT]); ? ? ? ? ? ? } ? ? ? ? ? ShowPlayerDialog(playerid, DIALOG_OPEN_VEHICLE_TRUNK, DIALOG_STYLE_TABLIST_HEADERS, DialogTitle , trunkdataslot1items, "Take it", "Close"); ? ? ? ? ? ?

Problem:

How put?"COL_RED"SQL ID\t"COL_BLUE"Items\t"COL_GREEN"Amount\n in the right place?

Code:
? ? ? ? ? ? for(new s; s < MAX_TRUNK_SLOTS; s ) ? ? ? ? ? ? { ? ? ? ? ? ? ? ? ? ? ? ? ? ? format(trunkdataslot1items, sizeof(trunkdataslot1items), ? ? ? ? ? ? " %s %i \t"COL_GREEN" %s \t "COL_RED"%i %s \n", ? ? ? ? ? ? trunkdataslot1items, get_vehicle_trunk[closestcar][s][TRUNK_SQL_ID], GetItemInfo( get_vehicle_trunk[closestcar][s][TRUNK_ITEM_TYPE], I_NAME), get_vehicle_trunk[closestcar][s][TRUNK_ITEM_AMOUNT], GetItemInfo( get_vehicle_trunk[closestcar][s][TRUNK_ITEM_TYPE], I_NAME_COUNT)? ); ? ? ? ? ? ? printf("[TRUNK]: Slot:[%i], SQL ID:[%d], Item Type:[%d], Amount:[%d], ", s, get_vehicle_trunk[closestcar][s][TRUNK_SQL_ID], get_vehicle_trunk[closestcar][s][TRUNK_ITEM_TYPE],? get_vehicle_trunk[closestcar][s][TRUNK_ITEM_AMOUNT]); ? ? ? ? ? ? } ? ? ? ? ? ShowPlayerDialog(playerid, DIALOG_OPEN_VEHICLE_TRUNK, DIALOG_STYLE_TABLIST_HEADERS, DialogTitle , trunkdataslot1items, "Take it", "Close"); ? ? ? ? ? ?