SA-MP Forums Archive
Locking vehicles - 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: Locking vehicles (/showthread.php?tid=665578)



Locking vehicles - m4karow - 09.04.2019

I've had issues with locking vehicle for players except the driver.

This is my whole code
HTML Code:
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicleid, engine, lights, alarm, 1, bonnet, boot, objective);

SetVehicleParamsForPlayer(vehicleid, playerid, 0, 0);
If the player is driver of the vehicle won't be unlocked for him but if he is a passenger it will be.
I had to use SetVehicleParamsForPlayer to lock the vehicle properly? If it's not necessary I do not want to, becouse I had to handle the locking if the vehicle streams to the player.
Is this a SA-MP but or what?


Re: Locking vehicles - Markski - 09.04.2019

You'll probably still need to handle streaming the vehicles parameters to the players with the first function anyways.

You'll have to use a timer or something to constantly set the params with a SetVehicleParamsForPlayer loop on MAX_PLAYERS


Re: Locking vehicles - Logic_ - 10.04.2019

Quote:
Originally Posted by Markski
View Post
You'll probably still need to handle streaming the vehicles parameters to the players with the first function anyways.

You'll have to use a timer or something to constantly set the params with a SetVehicleParamsForPlayer loop on MAX_PLAYERS
Nope.

----------------

Once the vehicle spawns, you need to set it's "Vehicle Parameters" using SetVehicleParamsEx because it is unset by default with a value of -1.

Sometimes reading the wiki properly (and debugging) helps a lot.