Parent : [[INDEX-FIVEM-GAMEPLAY]]
FiveM - IPL Loader : chargement massif d'intérieurs via RequestIpl et liste statique
Problème
L'île de Cayo Perico (et d'autres intérieurs DLC) nécessite le chargement de dizaines d'IPLs (Interior Proxy List) pour apparaître correctement. Les gérer un par un est fastidieux.
Solution
Chargement massif de IPLs via une simple liste de strings et RequestIpl, avec RemoveIpl pour la décharge.
-- Cayo Perico IPLs
local requestedIpl = {
-- Terrain
"h4_mph4_terrain_occ_09",
"h4_mph4_terrain_occ_06",
"h4_mph4_terrain_occ_05",
"h4_mph4_terrain_occ_01",
"h4_mph4_terrain_occ_00",
"h4_islandx_terrain_04",
"h4_islandx_terrain_02",
"h4_islandx_terrain_01",
-- Props
"h4_islandx_yacht_01_lod",
"h4_islandx_yacht_02_int",
"h4_islandx_yacht_02",
"h4_yacht",
"h4_yacht_strm_0",
"h4_yacht_long_0",
-- Bâtiments
"h4_mph4_airstrip_interior_0_airstrip_hanger",
"h4_mph4_beach",
"h4_mph4_dock",
"h4_mph4_h4_terrain_01_lod",
"h4_mph4_h4_terrain_05_lod",
"h4_mph4_island_beach",
-- Lumières
"island_distantlights",
"island_lodlights",
"h4_islandx_yacht_01_lod"
}
-- Chargement
CreateThread(function()
for i = 1, #requestedIpl do
RequestIpl(requestedIpl[i])
end
print('[^2INFO^7] ' .. #requestedIpl .. ' IPLs chargées pour Cayo Perico')
end)
-- Fonction de déchargement (pour toggle)
function UnloadCayoIpls()
for i = 1, #requestedIpl do
RemoveIpl(requestedIpl[i])
end
end
function LoadCayoIpls()
for i = 1, #requestedIpl do
RequestIpl(requestedIpl[i])
end
end
-- Toggle par commande (admin)
RegisterCommand('togglecayo', function(source)
local src = source
if IsPlayerAceAllowed(src, 'command.togglecayo') then
if IsIplActive(requestedIpl[1]) then
UnloadCayoIpls()
TriggerClientEvent('chat:addMessage', src, { args = { '[^3Cayo^7]', 'Désactivé' } })
else
LoadCayoIpls()
TriggerClientEvent('chat:addMessage', src, { args = { '[^3Cayo^7]', 'Activé' } })
end
end
end, false)
Pourquoi
RequestIplest le native GTA pour charger des intérieurs- Liste statique permet la maintenance facile (ajouter/supprimer des IPLs)
RemoveIplpermet de toggler pour éviter les conflits de LOD
Quand l'utiliser
- Cartes personnalisées (Cayo Perico, North Yankton)
- Intérieurs DLC (casino, arcades, appartements)
- MLO custom (intérieurs créés par la communauté)
Quand NE PAS l'utiliser
- Props isolés (utiliser
CreateObjectouCreateObjectNoOffset) - Si les IPLs sont déjà chargées par le serveur ou un autre resource
Exemples
Correct
-- IPL loader générique avec catégories
local IplCategories = {
cayo = {
label = 'Cayo Perico',
ipls = { "h4_mph4_terrain_occ_09", "h4_islandx_terrain_04", ... }
},
casino = {
label = 'Diamond Casino',
ipls = { "hei_dlc_casino_aircon", "hei_dlc_casino_exterior", ... }
}
}
function LoadCategory(categoryName)
local cat = IplCategories[categoryName]
if not cat then return end
for _, ipl in ipairs(cat.ipls) do
RequestIpl(ipl)
end
print(('[^2INFO^7] Catégorie %s chargée (%s IPLs)'):format(cat.label, #cat.ipls))
end
function UnloadCategory(categoryName)
local cat = IplCategories[categoryName]
if not cat then return end
for _, ipl in ipairs(cat.ipls) do
RemoveIpl(ipl)
end
end
Incorrect
-- Chargement un par un sans boucle → maintenance impossible
CreateThread(function()
RequestIpl("h4_mph4_terrain_occ_09")
Wait(100)
RequestIpl("h4_mph4_terrain_occ_06")
Wait(100)
RequestIpl("h4_mph4_terrain_occ_05")
-- ... 100 lignes plus tard
end)
Références
- Cayo/cayo.lua L1-80
- GTA V Native DB : REQUEST_IPL / REMOVE_IPL