SA-MP Forums Archive
GetVehicleParamsEx = -1 - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP (https://sampforum.blast.hk/forumdisplay.php?fid=3)
+--- Forum: Bug Reports (https://sampforum.blast.hk/forumdisplay.php?fid=20)
+--- Thread: GetVehicleParamsEx = -1 (/showthread.php?tid=361084)



GetVehicleParamsEx = -1 - WackoX - 20.07.2012

Had this "bug" since always, when using GetVehicleParamsEx all the params are -1 by default.
So if your engine is off, it doesn't say 0 or false, it says -1 which is incorrect.

It is so annoying i can't use it normally, i should be able to do this;

Код:
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);

if(!engine) SendClientMessage(playerid, 0x123456FF, "Your engine is off!");
Now, because the value is actually -1 it doesn't say my engine is off, i can't make a proper engine system like this.
Everything should be 0 by default, not -1.


Re: GetVehicleParamsEx = -1 - SuperViper - 20.07.2012

Under OnGameModeInit:

pawn Код:
ManualVehicleEngineAndLights();



AW: GetVehicleParamsEx = -1 - NetKiel - 20.07.2012

It's -1 because it's unset.
That's why the defines are like this.

pawn Код:
#define VEHICLE_PARAMS_UNSET    -1
#define VEHICLE_PARAMS_OFF      0
#define VEHICLE_PARAMS_ON       1



Re: AW: GetVehicleParamsEx = -1 - WackoX - 20.07.2012

Quote:
Originally Posted by SuperViper
Посмотреть сообщение
Under OnGameModeInit:

pawn Код:
ManualVehicleEngineAndLights();
Yes i use that function.

Quote:
Originally Posted by NetKiel
Посмотреть сообщение
It's -1 because it's unset.
That's why the defines are like this.

pawn Код:
#define VEHICLE_PARAMS_UNSET    -1
#define VEHICLE_PARAMS_OFF      0
#define VEHICLE_PARAMS_ON       1
I know, but doesn't it seems unlogical? i mean if the engine is off, it's off, not unset.
I think everything should be 0 from default, not -1.

Anyways, i've edited https://sampwiki.blast.hk/wiki/GetVehicleParamsEx (added the NOTE) so people know that in the future.


Re: GetVehicleParamsEx = -1 - SuperViper - 20.07.2012

https://sampforum.blast.hk/showthread.php?tid=348044

Use OnVehicleCreate to reset the parameters.


Re: GetVehicleParamsEx = -1 - Kar - 20.07.2012

Use setvehicleparamsex under OnVehicleSpawn / when createvehicle is called (I made onvehiclespawn get called when createvehicle is used) and set the params.