Guest User

Untitled

a guest
Feb 5th, 2018
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.99 KB | None | 0 0
  1. case DIALOG_SELLCAR: {
  2. if(!response) return 1;
  3. new vsid = PlayerSellCar[playerid];
  4. if(CarInfo[vsid][Spawned] == 0) return 1;
  5. VehicleOwned[CarInfo[vsid][Spawned]] = CarInfo[vsid][Spawned];
  6. VehicleSQL[CarInfo[vsid][Spawned]] = vsid;
  7.  
  8. new value;
  9. CheckVehicle(CarInfo[vsid][Spawned]);
  10. value = CarPriceValid(CarInfo[vsid][cModel]) / 2;
  11. GivePlayerCash(playerid, value);
  12. format(string, sizeof(string), "Ai primit $%s pentru ca ti-ai vandut vehiculul!",FormatNumber(value), "%%");
  13. SendClientMessage(playerid,COLOR_MONEY,string);
  14. if(strlen(CarInfo[vsid][cText]) >= 3) {
  15. DestroyDynamicObject(nameobject[CarInfo[vsid][Spawned]]);
  16. }
  17. DestroyVehicle(CarInfo[vsid][Spawned]);
  18. if(CarInfo[PlayerInfo[playerid][pCarKey][0]][Spawned] == CarInfo[vsid][Spawned] && vsid != 0) DespawnCar[playerid][0] = -1;
  19. else if(CarInfo[PlayerInfo[playerid][pCarKey][1]][Spawned] == CarInfo[vsid][Spawned] && vsid != 0) DespawnCar[playerid][1] = -1;
  20. else if(CarInfo[PlayerInfo[playerid][pCarKey][2]][Spawned] == CarInfo[vsid][Spawned] && vsid != 0) DespawnCar[playerid][2] = -1;
  21. else if(CarInfo[PlayerInfo[playerid][pCarKey][3]][Spawned] == CarInfo[vsid][Spawned] && vsid != 0) DespawnCar[playerid][3] = -1;
  22. else if(CarInfo[PlayerInfo[playerid][pCarKey][4]][Spawned] == CarInfo[vsid][Spawned] && vsid != 0) DespawnCar[playerid][4] = -1;
  23. else if(CarInfo[PlayerInfo[playerid][pCarKey][5]][Spawned] == CarInfo[vsid][Spawned] && vsid != 0) DespawnCar[playerid][5] = -1;
  24. else if(CarInfo[PlayerInfo[playerid][pCarKey][6]][Spawned] == CarInfo[vsid][Spawned] && vsid != 0) DespawnCar[playerid][6] = -1;
  25. else if(CarInfo[PlayerInfo[playerid][pCarKey][7]][Spawned] == CarInfo[vsid][Spawned] && vsid != 0) DespawnCar[playerid][7] = -1;
  26. else if(CarInfo[PlayerInfo[playerid][pCarKey][8]][Spawned] == CarInfo[vsid][Spawned] && vsid != 0) DespawnCar[playerid][8] = -1;
  27. else if(CarInfo[PlayerInfo[playerid][pCarKey][9]][Spawned] == CarInfo[vsid][Spawned] && vsid != 0) DespawnCar[playerid][9] = -1;
  28.  
  29.  
  30. mysql_format(SQL, string, sizeof(string), "DELETE FROM cars WHERE ID=%d",vsid);
  31. mysql_tquery(SQL, string, "", "");
  32.  
  33. if(PlayerInfo[playerid][pCarKey][0] == vsid) { PlayerInfo[playerid][pCarKey][0] = 0; mysql_format(SQL, string, sizeof(string), "UPDATE `users`SET CarKey1 = %d WHERE `name`='%s'",PlayerInfo[playerid][pCarKey][0],PlayerInfo[playerid][pUsername]); }
  34. if(PlayerInfo[playerid][pCarKey][1] == vsid) { PlayerInfo[playerid][pCarKey][1] = 0; mysql_format(SQL, string, sizeof(string), "UPDATE `users`SET CarKey2 = %d WHERE `name`='%s'",PlayerInfo[playerid][pCarKey][1],PlayerInfo[playerid][pUsername]); }
  35. if(PlayerInfo[playerid][pCarKey][2] == vsid) { PlayerInfo[playerid][pCarKey][2] = 0; mysql_format(SQL, string, sizeof(string), "UPDATE `users`SET CarKey3 = %d WHERE `name`='%s'",PlayerInfo[playerid][pCarKey][2],PlayerInfo[playerid][pUsername]); }
  36. if(PlayerInfo[playerid][pCarKey][3] == vsid) { PlayerInfo[playerid][pCarKey][3] = 0; mysql_format(SQL, string, sizeof(string), "UPDATE `users`SET CarKey4 = %d WHERE `name`='%s'",PlayerInfo[playerid][pCarKey][3],PlayerInfo[playerid][pUsername]); }
  37. if(PlayerInfo[playerid][pCarKey][4] == vsid) { PlayerInfo[playerid][pCarKey][4] = 0; mysql_format(SQL, string, sizeof(string), "UPDATE `users`SET CarKey5 = %d WHERE `name`='%s'",PlayerInfo[playerid][pCarKey][4],PlayerInfo[playerid][pUsername]); }
  38. if(PlayerInfo[playerid][pCarKey][5] == vsid) { PlayerInfo[playerid][pCarKey][5] = 0; mysql_format(SQL, string, sizeof(string), "UPDATE `users`SET CarKey6 = %d WHERE `name`='%s'",PlayerInfo[playerid][pCarKey][5],PlayerInfo[playerid][pUsername]); }
  39. if(PlayerInfo[playerid][pCarKey][6] == vsid) { PlayerInfo[playerid][pCarKey][6] = 0; mysql_format(SQL, string, sizeof(string), "UPDATE `users`SET CarKey7 = %d WHERE `name`='%s'",PlayerInfo[playerid][pCarKey][6],PlayerInfo[playerid][pUsername]); }
  40. if(PlayerInfo[playerid][pCarKey][7] == vsid) { PlayerInfo[playerid][pCarKey][7] = 0; mysql_format(SQL, string, sizeof(string), "UPDATE `users`SET CarKey8 = %d WHERE `name`='%s'",PlayerInfo[playerid][pCarKey][7],PlayerInfo[playerid][pUsername]); }
  41. if(PlayerInfo[playerid][pCarKey][8] == vsid) { PlayerInfo[playerid][pCarKey][8] = 0; mysql_format(SQL, string, sizeof(string), "UPDATE `users`SET CarKey9 = %d WHERE `name`='%s'",PlayerInfo[playerid][pCarKey][8],PlayerInfo[playerid][pUsername]); }
  42. if(PlayerInfo[playerid][pCarKey][9] == vsid) { PlayerInfo[playerid][pCarKey][9] = 0; mysql_format(SQL, string, sizeof(string), "UPDATE `users`SET CarKey10 = %d WHERE `name`='%s'",PlayerInfo[playerid][pCarKey][9],PlayerInfo[playerid][pUsername]); }
  43.  
  44. mysql_tquery(SQL, string, "", "");
  45. CarInfo[vsid][cID] = -2;
  46. CarInfo[vsid][Spawned] = 0;
  47. CarInfo[vsid][cValue] = 0;
  48. format(CarInfo[vsid][cText], 256, "-");
  49. }
  50.  
  51.  
  52. ============================================================================================================================
  53. ============================================================================================================================
  54.  
  55. case 5: { // sell
  56. if(CarInfo[vsid][Spawned] == 0) return SendClientMessage(playerid, COLOR_GREY, "Masina ta nu este spawnata!");
  57. if(CarInfo[vsid][cSpecial] == 1) return SendClientMessage(playerid, COLOR_GREY, "Acces interzis!");
  58. if(!PlayerToPoint(5.0,playerid,327.9443, -1512.6609, 36.1366)) return SendClientMessage(playerid, COLOR_WHITE, "{FFFFCC}{FFFFCC}Eroare: Trebuie sa fii lin fata DealerShip-ului, pentru a-ti vinde vehiculul.");
  59.  
  60. new value;
  61. value = floatround((CarInfo[vsid][cValue] * 7) / 10);
  62. format(string, sizeof(string), "Esti sigur ca vrei sa-ti vinzi vehiculul %s pentru $%s?",aVehicleNames[CarInfo[vsid][cModel]-400],FormatNumber(value));
  63. ShowPlayerDialog(playerid, DIALOG_SELLCAR, DIALOG_STYLE_MSGBOX, "Dealership Office", string, "Da", "Nu");
  64. PlayerSellCar[playerid] = vsid;
  65. if(CP[playerid] == 43 || CP[playerid] == 53) { CP[playerid] = 0; DisablePlayerCheckpoint(playerid); }
  66. }
Advertisement
Add Comment
Please, Sign In to add comment