OnVehiclePaintjob
#1

Код:
public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
	SafeGivePlayerMoney(playerid, -500);
        return 1;
}
When you select paintjob server take 500 $ from you,if you cancel buying server take more 500$ from you.
Reply
#2

Quote:
Originally Posted by CloW
Посмотреть сообщение
Код:
public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
	SafeGivePlayerMoney(playerid, -500);
        return 1;
}
When you select paintjob server take 500 $ from you,if you cancel buying server take more 500$ from you.
Yea, that's gonna be a bug, but more bug with your code.


Make a check to check if it was applied or not, and THEN charge them if it's changed.

It's changing the paintjob on the car for the preview, which is what the callback is picking up. Your code is simply taking 500 each change that it makes.
Reply
#3

Quote:
Originally Posted by Sew_Sumi
Посмотреть сообщение
Yea, that's gonna be a bug, but more bug with your code.


Make a check to check if it was applied or not, and THEN charge them if it's changed.

It's changing the paintjob on the car for the preview, which is what the callback is picking up. Your code is simply taking 500 each change that it makes.
Try changing your current line to take money to printf("%d", paintjobid); as see what it outputs then check against that, its not a Bug with sa-mp, its a 'bug'/issue with your code as Sew said.
Reply
#4

Could do a check, that it checks when you change the paintjob, but only charges you once you leave if you have enough money. (You'd also need to see if you can find a way of checking the paintjob though maybe.

https://sampwiki.blast.hk/wiki/OnVehiclePaintjob Returns the paintjobid.

https://sampwiki.blast.hk/wiki/OnEnterExitModShop Calls when the vehicle enters and exits.

Like, a new variable
Код:
InModShop[playerid]
, and when they exit the mod shop then they get charged. The distance they go from the interior to the exterior should be enough to trigger the payments needed.


When the player exits out of the mod shop not modding it, the paintjob will go back to the original, so a
Код:
CarPaintjob [vehicleid] = paintjobid;
could be an option to track this.

You will need to monitor fenders,skirts,roofmods, NOS, Hydraulics as well though to make it encompassing of all of the features offered in that store.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)