Minus something - 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: Minus something (
/showthread.php?tid=562259)
Minus something -
Sn00Py - 07.02.2015
I want when the engine of a car starts, to decercase (sorry for my fuckin' english) with 5 the engine life.
Is it correct to be like this?: VehicleInfo[idcar][vEngineLife]-5 (where idcar is the GetPlayerVehicleID function)
Thank you in advance.
Re: Minus something -
Vince - 07.02.2015
That will subtract 5 from the variable but the result is never used or saved and thus it's useless. You need to
assign it and that means it has to have the "=" symbol in it somewhere. You can either do it like this:
pawn Код:
VehicleInfo[idcar][vEngineLife] = VehicleInfo[idcar][vEngineLife] - 5;
Or shorthand (and probably much easier):
pawn Код:
VehicleInfo[idcar][vEngineLife] -= 5;
Re: Minus something -
CalvinC - 07.02.2015
Use this:
VehicleInfo[idcar][vEngineLife] -= 5;
Re: Minus something -
Sn00Py - 07.02.2015
Thank you vince and calvin. REP +