Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CMD:buyvehicle(playerid, params[])
- {
- if(gLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_ERROR, "Tu nu esti logat si nu poti sa folosesti aceasta comanda!");
- if(IsPlayerInRangeOfPoint(playerid,5.0,328.7707,-1513.1094,36.0391))
- {
- ShowPlayerDialog(playerid, DIALOG_DSG, DIALOG_STYLE_LIST, "Buy a vehicle", "Cheap cars\nRegular cars\nExpensive cars\nBikes\nAir Vehicles","Select", "Cancel");
- }
- else SendClientMessage(playerid, COLOR_ERROR,"You are not at dealership.");
- return 1;
- }
- if(dialogid == DIALOG_DSG)
- {
- if(response)
- {
- new var[1280];
- new coordsstring[64] = "Name\tPrice\tStock\n";
- if(listitem == 0)
- {
- for(new d = 0; d < sizeof(D1Info); d++)
- {
- if(D1Info[d][d1Model] >= 400)
- {
- format(gString, sizeof(gString), "%s\t$%s\t(%d)\n", VehicleNames[D1Info[d][d1Model] - 400], FormatNumber(D1Info[d][d1Price]), D1Info[d][d1Stock]);
- strcat(var, gString);
- }
- }
- strins(var, coordsstring, 0);
- ShowPlayerDialog(playerid, DIALOG_DS1, DIALOG_STYLE_TABLIST_HEADERS, "Buy a car", var, "Select", "Cancel");
- }
- else if(listitem == 1)
- {
- for(new d = 0; d < sizeof(D2Info); d++)
- {
- if(D2Info[d][d2Model] >= 400)
- {
- format(gString, sizeof(gString), "%s\t$%s\t(%d)\n", VehicleNames[D2Info[d][d2Model] - 400], FormatNumber(D2Info[d][d2Price]), D2Info[d][d2Stock]);
- strcat(var, gString);
- }
- }
- strins(var, coordsstring, 0);
- ShowPlayerDialog(playerid, DIALOG_DS2, DIALOG_STYLE_TABLIST_HEADERS, "Buy a car", var, "Select", "Cancel");
- }
- else if(listitem == 2)
- {
- for(new d = 0; d < sizeof(D3Info); d++)
- {
- if(D3Info[d][d3Model] >= 400)
- {
- format(gString, sizeof(gString), "%s\t$%s\t(%d)\n", VehicleNames[D3Info[d][d3Model] - 400], FormatNumber(D3Info[d][d3Price]), D3Info[d][d3Stock]);
- strcat(var, gString);
- }
- }
- strins(var, coordsstring, 0);
- ShowPlayerDialog(playerid, DIALOG_DS3, DIALOG_STYLE_TABLIST_HEADERS, "Buy a car", var, "Select", "Cancel");
- }
- else if(listitem == 3)
- {
- for(new d = 0; d < sizeof(D4Info); d++)
- {
- if(D4Info[d][d4Model] >= 400)
- {
- format(gString, sizeof(gString), "%s\t$%s\t(%d)\n", VehicleNames[D4Info[d][d4Model] - 400], FormatNumber(D4Info[d][d4Price]), D4Info[d][d4Stock]);
- strcat(var, gString);
- }
- }
- strins(var, coordsstring, 0);
- ShowPlayerDialog(playerid, DIALOG_DS4, DIALOG_STYLE_TABLIST_HEADERS, "Buy a car", var, "Select", "Cancel");
- }
- else if(listitem == 4)
- {
- for(new d = 0; d < sizeof(D5Info); d++)
- {
- if(D5Info[d][d5Model] >= 400)
- {
- format(gString, sizeof(gString), "%s\t$%s\t(%d)\n", VehicleNames[D5Info[d][d5Model] - 400], FormatNumber(D5Info[d][d5Price]), D5Info[d][d5Stock]);
- strcat(var, gString);
- }
- }
- strins(var, coordsstring, 0);
- ShowPlayerDialog(playerid, DIALOG_DS5, DIALOG_STYLE_TABLIST_HEADERS, "Buy a car", var, "Select", "Cancel");
- }
- }
- }
- if(dialogid == DIALOG_DS1)
- {
- if(response)
- {
- CreateVeh(playerid, 1, listitem, 1);
- }
- }
- if(dialogid == DIALOG_DS2)
- {
- if(response)
- {
- CreateVeh(playerid, 2, listitem, 1);
- }
- }
- if(dialogid == DIALOG_DS3)
- {
- if(response)
- {
- CreateVeh(playerid, 3, listitem, 1);
- }
- }
- if(dialogid == DIALOG_DS4)
- {
- if(response)
- {
- CreateVeh(playerid, 4, listitem, 2);
- }
- }
- if(dialogid == DIALOG_DS5)
- {
- if(response)
- {
- CreateVeh(playerid, 5, listitem, 3);
- }
- }
Add Comment
Please, Sign In to add comment