vMenu
vMenu copied to clipboard
Fix car locking mechanism not working (player will break glass)
Please make separate pull requests for each change. Fixing something is one thing, but adding a new feature (cruise control) is another. I can't merge this PR because I can't review them individually.
Definitly don't use SetVehicleDoorsLocked()
, SetVehicleDoorsLockedForAllPlayers()
is better, can't remember why. To fix people from smashing doors just use this loop:
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
local playerPed = PlayerPedId()
local vehicleHandle = GetVehiclePedIsTryingToEnter(playerPed)
if DoesEntityExist(vehicleHandle) then
if GetVehicleDoorsLockedForPlayer(vehicleHandle, playerPed) then
ESX.ShowNotification('This vehicle is locked')
ClearPedTasks(playerPed)
end
end
end
end)
It probably has to be run every frame or else GetVehiclePedIsTryingToEnter()
wont work. Works flawlessly for us, but I saw that vMenu doesn't have the code that checks ownership of the vehicle. You can't set GetVehicleDoorsLockedForPlayer()
on a vehicle entity you don't own, so either run the code on the player who owns it, or request entity ownership which is buggy.
Closing PR because it's abandoned.