Files
Elite-Gaming-FiveM/resources/AI-Vehiclelock/server.lua
T
Jacob 90dfcd0feb AI Vehicle lock added (50% chance)
+ Added AI-Vehiclelock.
+ Set it to 50% chance.
2022-04-29 00:46:04 +01:00

19 lines
531 B
Lua

AddEventHandler('entityCreated', function(entity)
-- not valid anymore?
if not DoesEntityExist(entity) then return end
-- rest of core remains the same
local entityType = GetEntityType(entity)
-- not a vehicle? bail out
if entityType ~= 2 then return end
-- only for 'random' population cars
if GetEntityPopulationType(entity) > 5 then return end
-- if >0.5 (50% chance of locking), bail out
if math.random() > 0.5 then return end
-- lock!
SetVehicleDoorsLocked(entity, 2)
end)