28.11.2016, 11:20
(
Last edited by CaRaM3LL; 28/11/2016 at 11:23 AM.
Reason: update, add photo for table
)
Like the title says .. i need to load and store all data at once and i tried this:
The table: https://imgur.com/a/aWM2r
And the command to display all data
To store the data (the data it is just some numbers, the numbers are skin id)
So, the question is ! Can i store all data at once looping and then store it into items_array[] ?
Code:
stock IncarcaSkinSelector() { mysql_tquery(connectionHandle, "SELECT * FROM skin_selector", "LoadModelSelectionMenu", "d", INITMSELECTION_THREAD_ID); return 1; }
Code:
//------------------- function LoadModelSelectionMenu() { new rows = cache_num_rows(); counted = 0; if(rows) { SkinSelectorInfo[0][ssSkinid] = cache_get_row_int(0, 1); SkinSelectorInfo[1][ssSkinid] = cache_get_row_int(1, 1); SkinSelectorInfo[2][ssSkinid] = cache_get_row_int(2, 1); SkinSelectorInfo[3][ssSkinid] = cache_get_row_int(3, 1); SkinSelectorInfo[4][ssSkinid] = cache_get_row_int(4, 1); SkinSelectorInfo[5][ssSkinid] = cache_get_row_int(5, 1); SkinSelectorInfo[6][ssSkinid] = cache_get_row_int(6, 1); SkinSelectorInfo[7][ssSkinid] = cache_get_row_int(7, 1); SkinSelectorInfo[8][ssSkinid] = cache_get_row_int(8, 1); SkinSelectorInfo[9][ssSkinid] = cache_get_row_int(9, 1); SkinSelectorInfo[10][ssSkinid] = cache_get_row_int(10, 1); SkinSelectorInfo[11][ssSkinid] = cache_get_row_int(11, 1); } counted = rows; printf("[Skin Selector] WARN ! Loaded %d skins from skin_selector", counted); // return 1; }
Code:
COMMAND:changeskin(playerid, params []) { for(new i; i < counted; i++) { ShowModelSelectionMenuEx(playerid, SkinSelectorInfo[i][ssSkinid], counted, "Select Skin", CUSTOM_SKINS_MENU, 16.0, 0.0, -55.0); } return 1; }
Code:
ShowModelSelectionMenuEx(playerid, items_array[], item_amount, header_text[], extraid, Float:Xrot = 0.0, Float:Yrot = 0.0, Float:Zrot = 0.0, Float:mZoom = 1.0, dialogBGcolor = 0x4A5A6BBB, previewBGcolor = 0x88888899 , tdSelectionColor = 0xFFFF00AA)