AI Vehicle lock added (50% chance)

+ Added AI-Vehiclelock.
+ Set it to 50% chance.
This commit is contained in:
Jacob
2022-04-29 00:46:04 +01:00
parent ab98429814
commit 90dfcd0feb
3 changed files with 23 additions and 0 deletions
+3
View File
@@ -0,0 +1,3 @@
resource_manifest_version '05cfa83c-a124-4cfa-a768-c24a5811d8f9'
server_script 'server.lua'
+19
View File
@@ -0,0 +1,19 @@
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)
+1
View File
@@ -170,6 +170,7 @@ start Seat-Switcher
start Join-Transition
start CarWipe
start EGRP-Notifications
start AI-Vehiclelock
#[-----Discord Perms-----]
start discord_perms