Zeex / sampgdk

Write SA-MP gamemodes in C/C++
http://zeex.github.io/sampgdk
Apache License 2.0
156 stars 83 forks source link

Change GetVehicleParamsEx params to char/int or something insted of bool #137

Closed ghost closed 9 years ago

ghost commented 9 years ago

GetVehicleParamsEx can return as VEHICLE_PARAMS_UNSET (-1), when vehicle params hasn't been set.

Please fix this.

http://wiki.sa-mp.com/wiki/GetVehicleParamsEx

ghost commented 9 years ago

Sorry but you misunderstood me. You should change the return type of paremters, insted of function.

from: int GetVehicleParamsEx([in] int vehicleid, [out] bool engine, [out] bool lights, [out] bool alarm, [out] bool doors, [out] bool bonnet, [out] bool boot, [out] bool objective);

to:

bool GetVehicleParamsEx([in] int vehicleid, [out] int engine, [out] int lights, [out] int alarm, [out] int doors, [out] int bonnet, [out] int boot, [out] int objective);

See here: https://github.com/kurta999/YSF/blob/YSF_/src/Functions.cpp#L87

ghost commented 9 years ago

Please do the same thing with:

SetVehicleParamsEx SetVehicleParamsCarDoors SetVehicleParamsCarWindows

These callbacks need to accept VEHICLE_PARAMS_UNSET, then them won't do anything. Where I need this? Vehicle streamer for streamer plugin.

Thanks.

ikkentim commented 9 years ago

I don't think you can set vehicle params to 'unset' right? wouldn't that be rather pointless?

karimcambridge commented 9 years ago

Any function with 'VehicleParam' in it has 3 return types for their parameters.

-1, 0 and 1.

But the functions themselves only return true or false if the vehicle exists or not.

ikkentim commented 9 years ago

The parameter types for the getters are already int pointers, he's talking about the setters now.

ghost commented 9 years ago

In PAWN you too use int to get vehicle door parameters, get door will return -1 and you will set it to -1 too and nothing will happen. I want to do that in C, now I need to convert char variables to bool because of this function.

Zeex commented 9 years ago

So you can set vehicle parameters to "unset"? That makes no sense...

karimcambridge commented 9 years ago

Yea, thats what I'm saying.

Any vehicle funciton in sa-mp that has 'param' in it, carries '-1, 0 and 1' 'VEHICLE_PARAM_UNSET (OFF, ON)' in there parameters... Only function that doesn't carry this is 'SetVehicleParamsForPlayer'.

ghost commented 9 years ago

Another example :D

I want to onvehicle engine, but I don't want to touch ex. objective and other parameters. Then I would just set engine to 1 and leave another 6 parameter as unset because I don't want to change them.

Zeex commented 9 years ago

OK, it's probably not as bad as I thought. But still, I think it could be done without adding VEHICLE_PARAM_UNSET - just call GetVehicleParamsEx and pass back the values it returned for those params that you don't want to change.

ghost commented 9 years ago

Thank you!!!