28.03.2013, 23:08
So I have this car script that allows me to spawn cars etc dynamically and when you get in a dialog box pops up asking if you want to buy the car or not. When I guy it, it spawns my car and I own it and everything, but it doesn't deduct the price of the car out of my money, I have no idea how to change it either. The code for when you buy it is below and for some reason it doesn't like I said deduct the price of the car. Please help.
case 1:
{
GivePlayerMoney(playerid, -DealershipVehicles[GetPlayerVehicleID(playerid)][vPrice]);
format(string, sizeof(string), "You have purchased a %s for $%d, for more help regarding your purchase, type /carhelp.", GetVehicleName(GetPlayerVehicleID(playerid)), DealershipVehicles[GetPlayerVehicleID(playerid)][vPrice]);
SendClientMessage(playerid, YELLOW, string);
RemovePlayerFromVehicle(playerid);
TogglePlayerControllable(playerid, 1);
return 1;
}
case 1:
{
GivePlayerMoney(playerid, -DealershipVehicles[GetPlayerVehicleID(playerid)][vPrice]);
format(string, sizeof(string), "You have purchased a %s for $%d, for more help regarding your purchase, type /carhelp.", GetVehicleName(GetPlayerVehicleID(playerid)), DealershipVehicles[GetPlayerVehicleID(playerid)][vPrice]);
SendClientMessage(playerid, YELLOW, string);
RemovePlayerFromVehicle(playerid);
TogglePlayerControllable(playerid, 1);
return 1;
}