open.mp forum
[Pawn] How do I prevent a player from getting into a specific car? - Printable Version

+ open.mp forum (https://forum.open.mp)
-- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3)
--- Forum: Pawn Scripting (https://forum.open.mp/forumdisplay.php?fid=10)
--- Thread: [Pawn] How do I prevent a player from getting into a specific car? (/showthread.php?tid=1808)



How do I prevent a player from getting into a specific car? - Boxi - 2021-03-24

Hello everyone C: a question, how do I make that a player can not enter a specific car? I explain:



Code:
new carvid_0;



carvid_0?= CreateVehicle(506,539.846,-1287.868,16.946,359.176,6,0,-1);



I need that they can't get into that specific vehicle, I can do it but only using the model of the car and that would prevent them from getting into all the cars of that model, but I only want that one. Does anyone know what I have to do? thanks c:


RE: How do I prevent a player from getting into a specific car? - Virsenas - 2021-03-24

(2021-03-24, 06:49 PM)Boxi Wrote: Hello everyone C: a question, how do I make that a player can not enter a specific car? I explain:



Code:
new carvid_0;



carvid_0?= CreateVehicle(506,539.846,-1287.868,16.946,359.176,6,0,-1);



I need that they can't get into that specific vehicle, I can do it but only using the model of the car and that would prevent them from getting into all the cars of that model, but I only want that one. Does anyone know what I have to do? thanks c:



https://open.mp/docs/scripting/functions/GetPlayerVehicleID



Your vehicle id is
Quote:carvid_0



RE: How do I prevent a player from getting into a specific car? - DandoRYx - 2021-03-24

https://open.mp/docs/scripting/functions/SetVehicleParamsForPlayer
Quote:doorslocked | 0 to unlock the doors or 1 to lock them.



RE: How do I prevent a player from getting into a specific car? - Boxi - 2021-03-24

Good ideas, I will give it a try. Thanks to both of you


RE: How do I prevent a player from getting into a specific car? - Snow - 2021-03-25

Use OnPlayerStateChange. If player's oldstate is onfoot and newstate is driver, you can get the vehicleid there and remove him from vehicle.