AKL DOCUMENTATION
  • 👋Introduction
  • GUSTI RESOURCES
    • ⛏️gusti-minerjob
      • Setup
      • Update
    • 🚙gusti-membershipvehicle
    • 🍗gusti-butcherjob
    • 📣gusti-iosnotify
      • Setup
      • Usage
    • 🌐gusti-status server web
      • Setup
    • ⏳gusti-loadscreen
      • Setup
      • Building
    • 💎gusti-vipmenu
      • Setup
    • 🛠️gusti-welderloot
      • Common Issues
      • Setup
    • 🏃‍♂️gusti-boostsprint
      • Setup
    • 🚀gusti-boostfps
    • 📹gusti-cctv
      • Setup
    • 📅gusti-datetime
      • Setup
    • ☢️gusti-radzone
      • Setup
    • 🔫gusti-hidereticle
    • 🚗gusti-givevehicle
      • Setup
      • Usage
    • 💥gusti-duarmemek
      • Setup
      • Usage
  • 🛡️gusti-vipsystem
    • Setup
    • Usage
  • CODE SNIPPETS
    • Fix Animasi
    • Fix Spam Punch
    • Boost Fps
    • Disable Ambient
    • Send Webhook Messages
    • Spawns GTA V Online Train On Fivem
    • Removing / Adding Limit Map
    • Blacklist Name
    • Item Probability
    • Anti Duplicate Vehicle
    • How To Unbind Keys
Powered by GitBook
On this page
  1. CODE SNIPPETS

Anti Duplicate Vehicle

Detects vehicles with the same license plate and deletes all except one of them

local alwaysCheck = false -- if set to false it will only be checked when the vehicle is created, If set to true all vehicles are checked every 5 seconds

if alwaysCheck then
	CreateThread(function()
		while true do
			local plateList = {}
			local allVeh = GetAllVehicles()
			for i=1, #allVeh do
				local plate = GetVehicleNumberPlateText(allVeh[i])
				local model = GetEntityModel(allVeh[i])
				if not plateList[plate] then 
					plateList[plate] = model
				elseif model == plateList[plate] then
					DeleteEntity(allVeh[i])
				end
			end
			Wait(5000)
		end
	end)
else
	AddEventHandler("entityCreating", function(entity, data)
		if GetEntityType(entity) == 2 then
			local myVehiclePlate = GetVehicleNumberPlateText(entity)
			local myVehicleModel = GetEntityModel(entity)
			local allVeh = GetAllVehicles()
			for i=1, #allVeh do
				local veh = allVeh[i]
				if myVehiclePlate == GetVehicleNumberPlateText(veh) and myVehicleModel == GetEntityModel(veh) and entity ~= veh then
					CancelEvent()
					break
				end
			end
		end
	end)
end
PreviousItem ProbabilityNextHow To Unbind Keys

Last updated 1 year ago