Money isn't being taken away when car is bought? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Money isn't being taken away when car is bought? (
/showthread.php?tid=234392)
Money isn't being taken away when car is bought? -
Ferrari123 - 03.03.2011
When players buy a car, their money isn't being taken away from them. It takes away the money but then it goes right back up to the amount that they had. Any ideas?
Код:
if(dialogid == DIALOG_CDBUY)
{
new string[128];
new vehicleid = GetPlayerVehicleID(playerid);
new v = GetCarDealershipVehicleId(vehicleid);
new d = GetCarDealershipId(vehicleid);
if(response)
{
if(GetPlayerMoney(playerid) < CarDealershipInfo[d][cdVehicleCost][v])
{
SendClientMessage(playerid, COLOR_GRAD1, "ERROR: You don't have enough money to buy this.");
RemovePlayerFromVehicle(playerid);
return 1;
}
new playervehicleid = GetPlayerFreeVehicleId(playerid);
if(playervehicleid == -1) return SendClientMessage(playerid, COLOR_GREY, "ERROR: You can't have more cars.");
new randcolor1 = Random(0, 126);
new randcolor2 = Random(0, 126);
new car = CreatePlayerVehicle(playerid, playervehicleid, CarDealershipInfo[d][cdVehicleModel][v], CarDealershipInfo[d][cdVehicleSpawn][0], CarDealershipInfo[d][cdVehicleSpawn][1], CarDealershipInfo[d][cdVehicleSpawn][2], CarDealershipInfo[d][cdVehicleSpawn][3], randcolor1, randcolor2);
if(car == INVALID_PLAYER_VEHICLE_ID)
{
SendClientMessage(playerid, COLOR_GREY, "ERROR: Something went wrong and the car didn't get created.");
}
else
{
format(string, sizeof(string), " Thank you for buying at %s.", CarDealershipInfo[d][cdMessage]);
SendClientMessage(playerid, COLOR_GRAD1, string);
GivePlayerMoney(playerid, -CarDealershipInfo[d][cdVehicleCost][v]);
CarDealershipInfo[d][cdTill] += ( CarDealershipInfo[d][cdVehicleCost][v] * 40 ) / ( 100 );
PutPlayerInVehicle(playerid, car, 0);
SavecDealership(editingcd[playerid]);
Re: Money isn't being taken away when car is bought? -
Mean - 03.03.2011
Maybe you have a timer somewhere that gives players money they loose.
Re: Money isn't being taken away when car is bought? -
Ferrari123 - 03.03.2011
If there was, it'd be in this portion of the code. However, I don't see any timer within it
Re: Money isn't being taken away when car is bought? -
Ferrari123 - 03.03.2011
I use pCash to take money away, how would I incorporate that into the code above?
Re: Money isn't being taken away when car is bought? -
Marricio - 03.03.2011
Maybe its caused by your anti-hack..