Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [182] = {
- -- L toggle Vehicle Lock
- group = 1,
- pressed = function()
- player = GetPlayerPed(-1)
- vehicle = GetVehiclePedIsIn(player, false)
- isPlayerInside = IsPedInAnyVehicle(player, true)
- lastVehicle = GetPlayersLastVehicle()
- px, py, pz = table.unpack(GetEntityCoords(player, true))
- coordA = GetEntityCoords(player, true)
- for i = 1, 32 do
- coordB = GetOffsetFromEntityInWorldCoords(player, 0.0, (6.281)/i, 0.0)
- local rayHandle = CastRayPointToPoint(coordA.x, coordA.y, coordA.z, coordB.x, coordB.y, coordB.z, 10, GetPlayerPed(-1), 0)
- local a, b, c, d, rayVehicle = GetRaycastResult(rayHandle)
- targetVehicle = rayVehicle
- if targetVehicle ~= nil and targetVehicle ~= 0 then
- vx, vy, vz = table.unpack(GetEntityCoords(targetVehicle, false))
- if GetDistanceBetweenCoords(px, py, pz, vx, vy, vz, false) then
- distance = GetDistanceBetweenCoords(px, py, pz, vx, vy, vz, false)
- break
- end
- end
- end
- if distance ~= nil and distance <= 5 and targetVehicle ~= 0 or vehicle ~= 0 then
- if vehicle ~= 0 then
- plate = GetVehicleNumberPlateText(vehicle)
- else
- vehicle = targetVehicle
- plate = GetVehicleNumberPlateText(vehicle)
- end
- HKserver.canUserLockVehicle({plate, vehicle, isPlayerInside})
- end
- end,
- released = function()
- -- Do nothing on release because it's toggle.
- end,
- },
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement