Jump to content

How To Block Police Cars?


vXHazE

Recommended Posts

onVehicleEnter is triggered after the player has entered the vehicle and the animation is finished, if you goanna use removePedFromVehicle then it should be used with onVehicleEnter, otherwise it won't have any effect.

The same applies for onVehicleStartEnter which will trigger at the same moment a player presses the enter key and there is a vehicle nearby, by cancelling onVehicleStartEnter the animation won't even start so this is the best solution when it comes to blocking people from entering police cars. Also remember that removePedFromVehice won't have any effect if it's triggered from onVehicleStartEnter since the ped isn't even in the vehicle at that moment.

The example made by Nikolai96 is only useful if both onVehicleStartEnter and onVehicleEnter trigger the same function, in that case the resulting function will block players that for example is warped into a police car by a staff of the server or similar. Could be useful too but don't forget to verify that the player you tries to remove is inside the vehicle by calling:

getPedOccupiedVehicle(player thePlayer) 

If that value is nil or false then you shouldn't call removePedFromVehicle since it would cause errors.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...