cstef4n Posted January 21 Posted January 21 salut, cine ma poate ajuta si pe mine? Nu afiseaza ID-ul masinii corect la Expensive Vehicles
0 ASGOOD Posted January 21 Posted January 21 Trebuie si cod sursa, dialog-ul cand il arati i.e ShowPlayerDialog si integrarea adica ce ai la OnDialogResponse asgood.ro
0 cstef4n Posted January 22 Author Posted January 22 case 1: { new szDialog2[1024], szTitle[50], xx; strcat(szDialog2, "Vehicle Name\tPrice\tStock\n"); for(new j = 0; j < MAX_PERSONAL_VEH; j++) { if(DSInfo[j][dsPrice] > 45000 && DSInfo[j][dsPrice] <= 1500000) { format(szDialog, sizeof(szDialog), "%s\t$%s\t%d\n", DSInfo[j][dsVehicleName], FormatNumber(DSInfo[j][dsPrice]), DSInfo[j][dsStock]); strcat(szDialog2, szDialog); xx++; } } format(szTitle, sizeof(szTitle), "Expensive Vehicles: %d", xx); ShowPlayerDialog(playerid, DIALOG_DEALERSHIP2, DIALOG_STYLE_TABLIST_HEADERS, szTitle, szDialog2, "Select", "Close"); } case DIALOG_DEALERSHIP2: { if(!response) return 1; new cheapcars; for(new xf = 0; xf < MAX_PERSONAL_VEH; xf++) { if(DSInfo[xf][dsPrice] > 0 && DSInfo[xf][dsPrice] <= 1500000) { cheapcars = xf; } } // new num = listitem + cheapcars + 1; new num = listitem + 2; BuyCar[playerid] = num; new string33[256], stringtitle[256]; format(stringtitle, sizeof(stringtitle), "%s ($%s) - %s available", DSInfo[num][dsVehicleName], FormatNumber(DSInfo[num][dsPrice]), FormatNumber(DSInfo[num][dsStock])); format(string33, sizeof(string33), "Vehicle name: %s\nVehicle price: %s\nNumber of cars available: %s", DSInfo[num][dsVehicleName], FormatNumber(DSInfo[num][dsPrice]), FormatNumber(DSInfo[num][dsStock])); ShowPlayerDialog(playerid, DIALOG_BUYCAR, DIALOG_STYLE_MSGBOX, stringtitle, string33, "Buy car", "Back"); }
0 cstef4n Posted January 22 Author Posted January 22 E problema de la "new num = listitem + cheapcars + 1;
0 cstef4n Posted January 22 Author Posted January 22 case DIALOG_BUYCAR: { if(!response) return 1; new num = BuyCar[playerid]; if(PlayerInfo[playerid][pCashMoney] >= DSInfo[num][dsPrice]) { if(DSInfo[num][dsStock] > 0) { GiveVehicle(playerid, num); DSInfo[num][dsStock] --; mysql_format(SQL, query, sizeof(query), "UPDATE `dealership` SET `Stock`='%d' WHERE `ID`='%d'", DSInfo[num][dsStock], num); mysql_tquery(SQL, query, "", ""); } else { new stringg[1000]; format(stringg,sizeof(stringg),"Aceasta masina numai este disponibila in Dealership. Stoc epuizat.\nYou can't buy this vehicle from the dealership. Out of stock."); ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "Out of stock", stringg, "Close",""); } } else return SendClientMessage(playerid, COLOR_GREY, "You don't have enough money to purchase this vehicle."); }
0 ASGOOD Posted January 22 Posted January 22 Codul asta n-are niciun sens. Hai sa-l facem cum trebuie ca sa-ti mearga expensive vehicles Fa o variabila globala expensiveVehicles[MAX_PERSONAL_VEH] cred. Ca sa nu stricam varianta cu cheapcars fa o variabila openedExpensive[MAX_PLAYERS] La login / connect o setezi pe 0 for(new j = 0; j < MAX_PERSONAL_VEH; j++) { if(DSInfo[j][dsPrice] > 45000 && DSInfo[j][dsPrice] <= 1500000) { format(szDialog, sizeof(szDialog), "%s\t$%s\t%d\n", DSInfo[j][dsVehicleName], FormatNumber(DSInfo[j][dsPrice]), DSInfo[j][dsStock]); strcat(szDialog2, szDialog); xx++; } } in foru asta transforma-l in asta for(new j = 0; j < MAX_PERSONAL_VEH; j++) { if(DSInfo[j][dsPrice] > 45000 && DSInfo[j][dsPrice] <= 1500000) { format(szDialog, sizeof(szDialog), "%s\t$%s\t%d\n", DSInfo[j][dsVehicleName], FormatNumber(DSInfo[j][dsPrice]), DSInfo[j][dsStock]); strcat(szDialog2, szDialog); expensiveVehicles[xx] = j; openedExpensive[playerid] = 1; xx++; } } In cod-ul de la dialog-ul asta: case DIALOG_DEALERSHIP2: { if(!response) { openedExpensive[playerid] = 0; // si linia asta return 1; } new cheapcars; for(new xf = 0; xf < MAX_PERSONAL_VEH; xf++) { if(DSInfo[xf][dsPrice] > 0 && DSInfo[xf][dsPrice] <= 1500000) { cheapcars = xf; } } // new num = listitem + cheapcars + 1; new num = listitem + 2; BuyCar[playerid] = num; if(openedExpensive[playerid] != 0) BuyCar[playerid] = num = expensiveVehicles[listitem]; // liniile astea le-am adaugat openedExpensive[playerid] = 0; // new string33[256], stringtitle[256]; format(stringtitle, sizeof(stringtitle), "%s ($%s) - %s available", DSInfo[num][dsVehicleName], FormatNumber(DSInfo[num][dsPrice]), FormatNumber(DSInfo[num][dsStock])); format(string33, sizeof(string33), "Vehicle name: %s\nVehicle price: %s\nNumber of cars available: %s", DSInfo[num][dsVehicleName], FormatNumber(DSInfo[num][dsPrice]), FormatNumber(DSInfo[num][dsStock])); ShowPlayerDialog(playerid, DIALOG_BUYCAR, DIALOG_STYLE_MSGBOX, stringtitle, string33, "Buy car", "Back"); } Eventual poti sa mai adaugi si la dialogu principal sa faca openedExpensive[playerid] = 0; 1 asgood.ro
0 ASGOOD Posted January 22 Posted January 22 Este si o varianta mai buna, dar trebuie rescris cu totul, pe Iteratori si te poti folosi de metodele iteratorilor i.e Iter_Index 1 asgood.ro
Question
cstef4n
salut,
cine ma poate ajuta si pe mine? Nu afiseaza ID-ul masinii corect la Expensive Vehicles
8 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now