17.11.2016, 21:25
I'm not sure if you can entirely prevent opening the door, but take a look at https://sampwiki.blast.hk/wiki/OnPlayerEnterVehicle, which gets called when the player starts to enter a vehicle, not when he actually has entered it (as in your code with state checking)