Paying for car in car system issue
#1

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;
}
Reply
#2

Try adding a new variable(like this):
pawn Код:
case 1:
{
new vehiclemoney;
vehiclemoney = DealershipVehicles[GetPlayerVehicleID(playerid)][vPrice];
GivePlayerMoney(playerid, -vehiclemoney);
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;
}
Reply
#3

How is your [vPrice] changed/defined?
Reply
#4

Maybe you've got another money variable in your script.
For example in my script, when I add someone certain amount of cash, I don't only use GivePlayerMoney, I save it in another variable inside PlayerInfo, to avoid money cheats. Check that..
Reply
#5

Idk if its supposed to be = to 0 or what Btw that case doesn't work, it takes the money away but then for some reason it counts back up to the original amount I had like I mean it gives me the money I spent on the car back like a refund.






DealershipVehicles[vehicleid][vPrice] = 0;

and there is this

DealershipVehicles[vehicleid][vPrice] = price;
Reply
#6

*bump*
Reply
#7

*bump* again, someone help please.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)