Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- case DIALOG_SELLCAR: {
- if(!response) return 1;
- new vsid = PlayerSellCar[playerid];
- if(CarInfo[vsid][Spawned] == 0) return 1;
- VehicleOwned[CarInfo[vsid][Spawned]] = CarInfo[vsid][Spawned];
- VehicleSQL[CarInfo[vsid][Spawned]] = vsid;
- new value;
- CheckVehicle(CarInfo[vsid][Spawned]);
- value = CarPriceValid(CarInfo[vsid][cModel]) / 2;
- GivePlayerCash(playerid, value);
- format(string, sizeof(string), "Ai primit $%s pentru ca ti-ai vandut vehiculul!",FormatNumber(value), "%%");
- SendClientMessage(playerid,COLOR_MONEY,string);
- if(strlen(CarInfo[vsid][cText]) >= 3) {
- DestroyDynamicObject(nameobject[CarInfo[vsid][Spawned]]);
- }
- DestroyVehicle(CarInfo[vsid][Spawned]);
- if(CarInfo[PlayerInfo[playerid][pCarKey][0]][Spawned] == CarInfo[vsid][Spawned] && vsid != 0) DespawnCar[playerid][0] = -1;
- else if(CarInfo[PlayerInfo[playerid][pCarKey][1]][Spawned] == CarInfo[vsid][Spawned] && vsid != 0) DespawnCar[playerid][1] = -1;
- else if(CarInfo[PlayerInfo[playerid][pCarKey][2]][Spawned] == CarInfo[vsid][Spawned] && vsid != 0) DespawnCar[playerid][2] = -1;
- else if(CarInfo[PlayerInfo[playerid][pCarKey][3]][Spawned] == CarInfo[vsid][Spawned] && vsid != 0) DespawnCar[playerid][3] = -1;
- else if(CarInfo[PlayerInfo[playerid][pCarKey][4]][Spawned] == CarInfo[vsid][Spawned] && vsid != 0) DespawnCar[playerid][4] = -1;
- else if(CarInfo[PlayerInfo[playerid][pCarKey][5]][Spawned] == CarInfo[vsid][Spawned] && vsid != 0) DespawnCar[playerid][5] = -1;
- else if(CarInfo[PlayerInfo[playerid][pCarKey][6]][Spawned] == CarInfo[vsid][Spawned] && vsid != 0) DespawnCar[playerid][6] = -1;
- else if(CarInfo[PlayerInfo[playerid][pCarKey][7]][Spawned] == CarInfo[vsid][Spawned] && vsid != 0) DespawnCar[playerid][7] = -1;
- else if(CarInfo[PlayerInfo[playerid][pCarKey][8]][Spawned] == CarInfo[vsid][Spawned] && vsid != 0) DespawnCar[playerid][8] = -1;
- else if(CarInfo[PlayerInfo[playerid][pCarKey][9]][Spawned] == CarInfo[vsid][Spawned] && vsid != 0) DespawnCar[playerid][9] = -1;
- mysql_format(SQL, string, sizeof(string), "DELETE FROM cars WHERE ID=%d",vsid);
- mysql_tquery(SQL, string, "", "");
- 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]); }
- 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]); }
- 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]); }
- 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]); }
- 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]); }
- 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]); }
- 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]); }
- 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]); }
- 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]); }
- 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]); }
- mysql_tquery(SQL, string, "", "");
- CarInfo[vsid][cID] = -2;
- CarInfo[vsid][Spawned] = 0;
- CarInfo[vsid][cValue] = 0;
- format(CarInfo[vsid][cText], 256, "-");
- }
- ============================================================================================================================
- ============================================================================================================================
- case 5: { // sell
- if(CarInfo[vsid][Spawned] == 0) return SendClientMessage(playerid, COLOR_GREY, "Masina ta nu este spawnata!");
- if(CarInfo[vsid][cSpecial] == 1) return SendClientMessage(playerid, COLOR_GREY, "Acces interzis!");
- 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.");
- new value;
- value = floatround((CarInfo[vsid][cValue] * 7) / 10);
- format(string, sizeof(string), "Esti sigur ca vrei sa-ti vinzi vehiculul %s pentru $%s?",aVehicleNames[CarInfo[vsid][cModel]-400],FormatNumber(value));
- ShowPlayerDialog(playerid, DIALOG_SELLCAR, DIALOG_STYLE_MSGBOX, "Dealership Office", string, "Da", "Nu");
- PlayerSellCar[playerid] = vsid;
- if(CP[playerid] == 43 || CP[playerid] == 53) { CP[playerid] = 0; DisablePlayerCheckpoint(playerid); }
- }
Advertisement
Add Comment
Please, Sign In to add comment