GetVehicleParamsEx = -1
#1

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.
Reply
#2

Under OnGameModeInit:

pawn Код:
ManualVehicleEngineAndLights();
Reply
#3

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
Reply
#4

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.
Reply
#5

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

Use OnVehicleCreate to reset the parameters.
Reply
#6

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


Forum Jump:


Users browsing this thread: 2 Guest(s)