How to Disable Airplanes and Helicopters in FiveM
Are you running a FiveM server and looking to remove those pesky AI airplanes and helicopters that clutter the skies and airports? Disabling these AI elements can improve server performance and provide a cleaner experience for your players. In this tutorial, we’ll walk you through a step-by-step guide on how to disable AI airplanes and helicopters in FiveM using a simple script.
Why Disable AI Planes and Helicopters?
In FiveM, AI-controlled planes and helicopters can sometimes interfere with player activities, cause unnecessary server load, or simply not fit the theme of your server. Removing them can:
- Enhance Server Performance: Fewer AI entities mean less processing power used.
- Improve Player Experience: Reduce unwanted interactions with AI planes and helicopters.
- Increase Realism: If your server is themed around a post-apocalyptic world or a setting without air traffic, removing AI planes adds to the immersion.
Introducing gd_airport_ai_begone
O gd_airport_ai_begone
script is a resource that disables certain scenarios and removes specific AI planes, helicopters, and vehicles from the San Andreas airports and airfields. Here’s what it disables:
- Jets landing and taking off at Los Santos International Airport (LSIA)
- Shamals and Luxors taxiing around LSIA
- Lazers and Titans taxiing and taking off at Fort Zancudo
- Dusters landing on Grapeseed Airfield
- Small planes landing and taking off at Sandy Shores Airfield
- Various plane and vehicle spawns around all airport surfaces
Step-by-Step Guide to Disabling AI Planes and Helicopters
Follow these steps to add the script to your Servidor FiveM.
Step 1: Create a New Resource Folder
- Navigate to your server’s
recursos
diretório. - Create a new folder named
gd_airport_ai_begone
.
Step 2: Create the Script File
- Inside the
gd_airport_ai_begone
pasta, crie um novo arquivo chamado__recurso.lua
oufxmanifest.lua
(depending on your server version). - If you’re using the latest recommended version, create
fxmanifest.lua
and add the following content:luaCode kopierenfx_version 'cerulean' game 'gta5' client_script 'client.lua'
Step 3: Add the Script Code
- Still inside the
gd_airport_ai_begone
pasta, crie um novo arquivo chamadocliente.lua
. - Use this code (snippet):
Citizen.CreateThread(function() local SCENARIO_TYPES = { "WORLD_VEHICLE_MILITARY_PLANES_SMALL", -- Zancudo Small Planes "WORLD_VEHICLE_MILITARY_PLANES_BIG", -- Zancudo Big Planes } local SCENARIO_GROUPS = { 2017590552, -- LSIA planes 2141866469, -- Sandy Shores planes 1409640232, -- Grapeseed planes "ng_planes", -- Far up in the skies jets } local SUPPRESSED_MODELS = { "SHAMAL", -- They spawn on LSIA and try to take off "LUXOR", -- They spawn on LSIA and try to take off "LUXOR2", -- They spawn on LSIA and try to take off "JET", -- They spawn on LSIA and try to take off and land "LAZER", -- They spawn on Zancudo and try to take off "TITAN", -- They spawn on Zancudo and try to take off "BARRACKS", -- Regularly driving around the Zancudo airport surface "BARRACKS2", -- Regularly driving around the Zancudo airport surface "CRUSADER", -- Regularly driving around the Zancudo airport surface "RHINO", -- Regularly driving around the Zancudo airport surface "AIRTUG", -- Regularly spawns on the LSIA airport surface "RIPLEY", -- Regularly spawns on the LSIA airport surface } while true do for _, sctyp in next, SCENARIO_TYPES do SetScenarioTypeEnabled(sctyp, false) end for _, scgrp in next, SCENARIO_GROUPS do SetScenarioGroupEnabled(scgrp, false) end for _, model in next, SUPPRESSED_MODELS do SetVehicleModelIsSuppressed(GetHashKey(model), true) end Wait(10000) -- Re-check every 10 seconds end end)
BTW, you can also just download the full resource here: Download me
Step 4: Configure Your Server
- Open your server configuration file (
servidor.cfg
). - Add the following line to ensure the resource starts when the server does:sqlCode kopieren
start gd_airport_ai_begone
Step 5: Restart Your Server
- Restart your FiveM server to apply the changes. You can either restart the entire server or use the console to restart just the resource:Code kopieren
restart gd_airport_ai_begone
Customizing the Script
If you want to allow certain planes or vehicles to spawn, you can customize the SUPPRESSED_MODELS
array in the cliente.lua
arquivo.
- To Allow a Model to Spawn: Remove its corresponding line from the
SUPPRESSED_MODELS
list. - Exemplo: If you want jets (
JET
) to still appear in the skies, remove or comment out the"JET",
line.luaCode kopieren-- "JET", -- They spawn on LSIA and try to take off and land
Additional Tips
- Backup Your Files: Always make a backup before modifying any server files.
- Test After Changes: After restarting, join your server and check the airports to ensure the AI planes and helicopters are no longer spawning.
- Performance Monitoring: Keep an eye on server performance to see if there’s an improvement after disabling the AI entities.
Conclusão
By following this tutorial, you’ve successfully removed unwanted AI airplanes and helicopters from your FiveM server. This not only enhances the gameplay experience for your players but can also contribute to better server performance. Feel free to share this guide with other server admins who might find it useful.
If you have any questions or run into issues, leave a comment below or reach out to the FiveM community for apoiar.