29.10.2015, 16:38
PHP код:
new rand = random(sizeof(randomDS));
if(PlayerVehicleSlot[playerid][9] == -1){
if(DealerShipInfo[Player[playerid][CarCurrent]][1] != 0){
if(Player[playerid][Money] >= DealerShipInfo[Player[playerid][CarCurrent]][1]){
new VehPlate[255];
format(VehPlate, 255, "%s", GetFreeVehiclePlate());
Player[playerid][DSCar] = CreateVehicle(DealerShipInfo[Player[playerid][CarCurrent]][1],randomDS[rand][0], randomDS[rand][1], randomDS[rand][2], randomDS[rand][3],Player[playerid][TuneColorSelected1],Player[playerid][TuneColorSelected2],-1);
mysql_queryM("INSERT INTO `OwnedVehicles` (`vModelID`,`VehicleOwner`, `VehiclePlate`, `vColor1`, `vColor2`) VALUES (%d, '%s', '%s', %d, %d)",DealerShipInfo[Player[playerid][CarCurrent]][0],GetName(playerid),VehPlate,Player[playerid][TuneColorSelected1],Player[playerid][TuneColorSelected2]);
TakePlayerCash(playerid, DealerShipInfo[Player[playerid][CarCurrent]][1]);
SavedOwnedVehicles +=1;
mysql_queryS("UPDATE `ServerData` SET `SavedOwnedVehicles` = %d WHERE ID = 1", SavedOwnedVehicles);
SCM(playerid, YELLOW, "Info: You bought a car with Money!");
}else{SCM(playerid, RED, "You do not have enough money for this vehicle!");}
}else{SCM(playerid, RED, "> This car is only buyable with coins!");}
}else{SCM(playerid, RED, "> You already own 10 cars!");}
DestroyVehicle(Player[playerid][DSCar]);
Player[playerid][DSCar] = -1;
TextDrawHideForPlayer(playerid, Text:DSBG);
TextDrawHideForPlayer(playerid, Text:DSCI);
TextDrawHideForPlayer(playerid, Text:DSVName[playerid]);
TextDrawHideForPlayer(playerid, Text:DSVPM[playerid]);
TextDrawHideForPlayer(playerid, Text:DSVPC[playerid]);
Player[playerid][CarSelected] = 0;
Player[playerid][CarCurrent] = 0;
Player[playerid][TuneColorCurrent] = 0;
Player[playerid][TuneColorSelected1] = 0;
Player[playerid][TuneColorSelected2] = 0;
Player[playerid][TuneColorChange] = 0;
SetCameraBehindPlayer(playerid);
TogglePlayerControllable(playerid, true);
HideMenuForPlayer(DSBuy, playerid);
DSBeingUsed = 0;
AssignOwnedVehicles(playerid);