SA-MP Forums Archive
Scripting Issue [With Money Costs] - 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)
+--- Thread: Scripting Issue [With Money Costs] (/showthread.php?tid=453368)



Scripting Issue [With Money Costs] - UnknownGamer - 24.07.2013

Hey Guys,

Anyone know if I've coded this wrong?

pawn Код:
new vipcost;
vipcost = GetVehiclePrice(idcar) / 15;
GivePlayerMoney(playerid,-vipcost);
How would I make it say something like, VIPCOST = Price of car - 15%.

I've tested that above and it doesn't work, thanks.


Re: Scripting Issue [With Money Costs] - JimmyCh - 24.07.2013

As far as I see, the code is right, but that's not 15%.
You see, you're currently dividing the price on 15, it's like 1/15 = 0.066666 off.

You probably missed the difference from the money because they didn't give you -0.06666 so to remove 15% you need to calculate it right.


Respuesta: Scripting Issue [With Money Costs] - Xabi - 24.07.2013

pawn Код:
new vipcost = floatround(GetVehiclePrice(idcar) * 0.85);
GivePlayerMoney(playerid,-vipcost);
Use floatround as giveplayermoney need an integer value.