Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 5.48 KB | None | 0 0
  1. Dialog:VehicleSelect(playerid, response, listitem, inputtext[])
  2. {
  3.     if(response)
  4.     {
  5.         switch(listitem)
  6.         {
  7.             case 0:
  8.             {
  9.                 PlayerData[playerid][pDealerCar] = 410;
  10.                 PlayerData[playerid][pDealerCarPrice] = 2000;
  11.             }
  12.             case 1:
  13.             {
  14.                 PlayerData[playerid][pDealerCar] = 401;
  15.                 PlayerData[playerid][pDealerCarPrice] = 5000;
  16.             }
  17.             case 2:
  18.             {
  19.                 PlayerData[playerid][pDealerCar] = 436;
  20.                 PlayerData[playerid][pDealerCarPrice] = 7000;
  21.             }
  22.             case 3:
  23.             {
  24.                 PlayerData[playerid][pDealerCar] = 405;
  25.                 PlayerData[playerid][pDealerCarPrice] = 10000;
  26.             }
  27.             case 4:
  28.             {
  29.                 PlayerData[playerid][pDealerCar] = 445;
  30.                 PlayerData[playerid][pDealerCarPrice] = 10000;
  31.             }
  32.             case 5:
  33.             {
  34.                 PlayerData[playerid][pDealerCar] = 516;
  35.                 PlayerData[playerid][pDealerCarPrice] = 12000;
  36.             }
  37.             case 6:
  38.             {
  39.                 PlayerData[playerid][pDealerCar] = 529;
  40.                 PlayerData[playerid][pDealerCarPrice] = 13000;
  41.             }
  42.             case 7:
  43.             {
  44.                 PlayerData[playerid][pDealerCar] = 540;
  45.                 PlayerData[playerid][pDealerCarPrice] = 13000;
  46.             }
  47.             case 8:
  48.             {
  49.                 PlayerData[playerid][pDealerCar] = 547;
  50.                 PlayerData[playerid][pDealerCarPrice] = 13000;
  51.             }
  52.             case 9:
  53.             {
  54.                 PlayerData[playerid][pDealerCar] = 585;
  55.                 PlayerData[playerid][pDealerCarPrice] = 16000;
  56.             }
  57.         }
  58.         new Float:vehicle_weight = GetVehicleModelInfoAsFloat(PlayerData[playerid][pDealerCar], "fMass");
  59.         new Float:vehicle_speed = GetVehicleModelInfoAsFloat(PlayerData[playerid][pDealerCar], "TransmissionData_fMaxVelocity");
  60.         new vehicle_trans = GetVehicleModelInfoAsInt(PlayerData[playerid][pDealerCar], "TransmissionData_nDriveType");
  61.         new vehicle_engine = GetVehicleModelInfoAsInt(PlayerData[playerid][pDealerCar], "TransmissionData_nEngineType");
  62.  
  63.         static
  64.             string[2048], string2[2048], string3[2048], string4[2048];
  65.  
  66.         if(vehicle_engine == 'P')
  67.         {
  68.             format(string3, sizeof(string3), "Gasolina");
  69.         } else if(vehicle_engine == 'D') {
  70.             format(string3, sizeof(string3), "Diesel");
  71.         } else {
  72.             format(string3, sizeof(string3), "Elétrico");
  73.         }
  74.  
  75.         if(vehicle_trans == 'F')
  76.         {
  77.             format(string4, sizeof(string4), "Tração dianteira");
  78.         } else if(vehicle_engine == 'D') {
  79.             format(string4, sizeof(string4), "Tração traseira");
  80.         } else {
  81.             format(string4, sizeof(string4), "Tração 4X4");
  82.         }
  83.  
  84.         format(string, sizeof(string), "\tInformações do veículo\n");
  85.         format(string, sizeof(string), "{FFFF00}Modelo do veículo: \t\t\t{FFFFFF}%s\n", ReturnVehicleModelName(PlayerData[playerid][pDealerCar]));
  86.         strcat(string2, string, sizeof(string));
  87.         format(string, sizeof(string), "{FFFF00}Valor do veículo: \t\t\t{FFFFFF}%s\n\n", FormatNumber(PlayerData[playerid][pDealerCarPrice]));
  88.         strcat(string2, string, sizeof(string));
  89.         format(string, sizeof(string), "{FFFF00}Massa do veículo: \t\t\t{FFFFFF}%.0f KG\n", vehicle_weight);
  90.         strcat(string2, string, sizeof(string));
  91.         format(string, sizeof(string), "{FFFF00}Tração do veículo: \t\t\t{FFFFFF}%s\n", string4);
  92.         strcat(string2, string, sizeof(string));
  93.         format(string, sizeof(string), "{FFFF00}Velocidade máxima: \t\t\t{FFFFFF}%.0f KM/H\n", vehicle_speed);
  94.         strcat(string2, string, sizeof(string));
  95.         format(string, sizeof(string), "{FFFF00}Tipo de combustível: \t\t\t{FFFFFF}%s\n\n", string3);
  96.         strcat(string2, string, sizeof(string));
  97.         format(string, sizeof(string), "Você tem certeza que deseja comprar este veículo?");
  98.         strcat(string2, string, sizeof(string));
  99.         Dialog_Show(playerid, ConfirmCarPurchase, DIALOG_STYLE_MSGBOX, "Los Angeles Dealership", string2, "Comprar", "Cancelar");
  100.     }
  101.     return 1;
  102. }
  103.  
  104. stock randomEx(minnum = cellmin, maxnum = cellmax)
  105. {
  106.     return random(maxnum - minnum + 1) + minnum;
  107. }
  108.  
  109. Dialog:ConfirmCarPurchase(playerid, response, listitem, inputtext[])
  110. {
  111.     new
  112.         carid = PlayerData[playerid][pDealerCar],
  113.         price = PlayerData[playerid][pDealerCarPrice];
  114.  
  115.     if (response)
  116.     {
  117.         if(GetMoney(playerid) < price)
  118.             return SendErrorMessage(playerid, "Você não possui fundos suficientes para realizar esta compra.");
  119.  
  120.         new id = Car_Create(PlayerData[playerid][pID], carid, 1700.4398, -1540.8044, 13.3828, 180.0000, randomEx(1, 255), randomEx(1, 255));
  121.  
  122.         if(id != -1)
  123.         {
  124.             new
  125.                 string[1028];
  126.              
  127.             Tax_AddPercent(price);
  128.            
  129.             format(string, sizeof(string), "~y~Seu ~r~%s ~y~foi comprado com sucesso.", ReturnVehicleModelName(carid));
  130.             ShowPlayerGameText(playerid, string);
  131.             GiveMoney(playerid, -price);
  132.             Car_Save(id);
  133.             Car_Spawn(id);
  134.             CarData[id][carPrice] = price;
  135.             Waypoint_Set(playerid, ReturnVehicleModelName(carid), 1700.4398, -1540.8044, 13.3828);
  136.             carid = -1;
  137.             price = 0;
  138.             id = -1;
  139.         }
  140.     } else {
  141.         Dialog_Show(playerid, VehicleSelect, DIALOG_STYLE_TABLIST_HEADERS, "Los Angeles Dealership", "Veículo\tPreço\n\
  142.         Manana\t$2,000\n\
  143.         Bravura\t$5,000\n\
  144.         Previon\t$7,000\n\
  145.         Sentinel\t$10,000\n\
  146.         Admiral\t$10,000\n\
  147.         Nebula\t$12,000\n\
  148.         Willard\t$13,000\n\
  149.         Vincent\t$13,000\n\
  150.         Primo\t$13,000\n\
  151.         Emperor\t$16,000\n", "Selecionar", "Cancelar");
  152.     }
  153.     return 1;
  154. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement