02.12.2016, 21:07
Show how you put the arrays into ShowPlayerDialog/ShowPlayerPreviewModelDialog function argument.
Show how you put the arrays into ShowPlayerDialog/ShowPlayerPreviewModelDialog function argument.
|
enum objsale { Name[25], ObjectID } new Objects[][objsale] = { {"Whiskey", 1520, 1}, {"Milk", 19570, 1} }; // OnDialogResponse new list[800]; for(new i; i < sizeof(Objects); ++i) { format(list, sizeof(list), "%s%d\tID: %d\n", list, Objects[i][ObjectID], i); } ShowPlayerDialog(playerid, DIALOG_OBJ_SELECT, DIALOG_STYLE_PREVMODEL, "Avaliable", list, "Buy", "Return");
Код:
enum objsale { Name[25], ObjectID } new Objects[][objsale] = { {"Whiskey", 1520, 1}, {"Milk", 19570, 1} }; // OnDialogResponse new list[800]; for(new i; i < sizeof(Objects); ++i) { format(list, sizeof(list), "%s%d\tID: %d\n", list, Objects[i][ObjectID], i); } ShowPlayerDialog(playerid, DIALOG_OBJ_SELECT, DIALOG_STYLE_PREVMODEL, "Avaliable", list, "Buy", "Return"); |
COMMAND:testanim(playerid, params[]) { ShowPlayerDialog(playerid, 1, DIALOG_STYLE_PREVMODEL_LIST, "Selection", "2039\tItem1\n19565\tItem2\n19897\tItem3\n19998\tItem4", "OK", " "); return 1; }
COMMAND:testanim2(playerid, params[]) { new models[] = {2039, 19565, 19897, 19998}; new labels[][] = {"Item1", "Item2", "Item3", "Item4"}; ShowPlayerPreviewModelDialog(playerid, 0, DIALOG_STYLE_PREVMODEL, "Selection", models, labels, "Select", "Cancel"); return 1; }
new SKINS[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49, 50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96, 97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131, 132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166, 167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201, 202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236, 237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271, 272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299 }; CMD:skins(playerid) { static array[1][1]; ShowPlayerPreviewModelDialog(playerid, 0, DIALOG_STYLE_PREVMODEL, "Skin selection dialog", SKINS, array, "Select", "Cancel"); return 1; } public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if (dialogid == 0) { if (response) SetPlayerSkin(playerid, SKINS[listitem]); // SKINS[listitem]- returns you the skin id from the index we input as "listitemid" } return 1; }
stock SearchName(id, item, slot) { new sNazev[50]; if(item == 157){ sNazev = "Kolo - Offroad"; } if(item == 158){ sNazev = "Kolo - Shadow"; } if(item == 159){ sNazev = "Kolo - Mega"; } if(item == 160){ sNazev = "Kolo - Rimshine"; } if(item == 161){ sNazev = "Kolo - Wires"; } if(item == 162){ sNazev = "Kolo - Classic"; } if(item == 163){ sNazev = "Kolo - Twist"; } if(item == 164){ sNazev = "Kolo - Cutter"; } if(item == 165){ sNazev = "Kolo - Switch"; } if(item == 166){ sNazev = "Kolo - Grove"; } if(item == 167){ sNazev = "Kolo - Import"; } if(item == 168){ sNazev = "Kolo - Dollar"; } if(item == 169){ sNazev = "Kolo - Trance"; } if(item == 170){ sNazev = "Kolo - Atomic"; } if(item == 171){ sNazev = "Kolo - Ahab"; } if(item == 172){ sNazev = "Kolo - Virtual"; } if(item == 173){ sNazev = "Kolo - Access"; } if(slot == 1){ strmid(Vozidlo[id][tuning_1_nazev], sNazev, 0, 50, 50); } return 1; } new const gAttachments[][e_ATTACHMENTS] = { {1025, "Kolo~n~Offroad"}, {1073, "Kolo~n~Shadow"}, {1074, "Kolo~n~Mega"}, {1075, "Kolo~n~Rimshine"}, {1076, "Kolo~n~Wires"}, {1077, "Kolo~n~Classic"}, {1078, "Kolo~n~Twist"}, {1079, "Kolo~n~Cutter"}, {1080, "Kolo~n~Switch"}, {1081, "Kolo~n~Grove"}, {1082, "Kolo~n~Import"}, {1083, "Kolo~n~Dollar"}, {1084, "Kolo~n~Trance"}, {1085, "Kolo~n~Atomic"}, {1096, "Kolo~n~Ahab"}, {1097, "Kolo~n~Virtual"}, {1098, "Kolo~n~Access"} }; switch(listitem) { case 0: { TuningEditSlot[playerid] = 1; new k = GetPVarInt(playerid, "VehicleITuning"); if(Vozidlo[k][tuning_1_objectid] == 0) { const size = sizeof(gAttachments) ; new models[size], labels[size][25] ; for (new x; x < size; x++) { models[x] = gAttachments[x][attachModel]; strcat(labels[x], gAttachments[x][attachName]); } ShowPlayerPreviewModelDialog(playerid, DIALOG_TUNING_SEARCH, DIALOG_STYLE_PREVMODEL, "Vyber modelu:", models, labels, "Zvolit", "Zavrit"); Dialog_SetModelRot(playerid, 157, .z = 35.0, .zoom = 1.3); // Wheel Offroad Dialog_SetModelRot(playerid, 158, .z = 35.0, .zoom = 1.3); Dialog_SetModelRot(playerid, 159, .z = 35.0, .zoom = 1.3); Dialog_SetModelRot(playerid, 160, .z = 35.0, .zoom = 1.3); Dialog_SetModelRot(playerid, 161, .z = 35.0, .zoom = 1.3); Dialog_SetModelRot(playerid, 162, .z = 35.0, .zoom = 1.3); Dialog_SetModelRot(playerid, 163, .z = 35.0, .zoom = 1.3); Dialog_SetModelRot(playerid, 164, .z = 35.0, .zoom = 1.3); Dialog_SetModelRot(playerid, 165, .z = 35.0, .zoom = 1.3); Dialog_SetModelRot(playerid, 166, .z = 35.0, .zoom = 1.3); Dialog_SetModelRot(playerid, 167, .z = 35.0, .zoom = 1.3); Dialog_SetModelRot(playerid, 168, .z = 35.0, .zoom = 1.3); Dialog_SetModelRot(playerid, 169, .z = 35.0, .zoom = 1.3); Dialog_SetModelRot(playerid, 170, .z = 35.0, .zoom = 1.3); Dialog_SetModelRot(playerid, 171, .z = 35.0, .zoom = 1.3); Dialog_SetModelRot(playerid, 172, .z = 35.0, .zoom = 1.3); Dialog_SetModelRot(playerid, 173, .z = 35.0, .zoom = 1.3); } else { ShowPlayerDialog(playerid, DIALOG_TUNING_EDIT, DIALOG_STYLE_LIST, "Tuning", "Upravit doplněk\nSmazat doplněk\nZměnit barvu doplňku", "Vybrat", "Zavřнt"); } } }