19.01.2017, 00:56
Hello, I'm trying to implement vehicle price to dialog title and I'm trying to use loop to get correct price from model id.
I got this codes;
So when a player in vehicle model 400 I want it to show "40000" on dialog title but instead of this it shows "60500" which is for veh model 602.
Here is my looping codes;
So, it gets the vehicle name from the vehiclenames correctly but it doesn't loop vehicle price correctly, it starts from the end.
So, how can I fix this code or do you guys have any other suggestions for this.
I got this codes;
Code:
new VehiclePrices[47][47] = { // {model, price} {400, 40000}, //Landstalker {600, 44000}, //Picador {602, 60500} //Alpha };
Here is my looping codes;
Code:
stock ShowVehicleDialog(playerid) { for ( new i = 0; i < sizeof(VehiclePrices); i++ ) { new vid = GetPlayerVehicleID(playerid), model = GetVehicleModel(vid); new price = VehiclePrices[i][1]; new str[256]; format(str, sizeof(str), "%s %d "COL_DGREEN"$%d", VehicleNames[GetVehicleModel(GetPlayerVehicleID(playerid))-400], model, FormatNumber(price); Dialog_Show(playerid, BUYVEHICLE, DIALOG_STYLE_LIST, str,"Test", "Seз", "İptal"); } return 1; }
So, how can I fix this code or do you guys have any other suggestions for this.