{"id":93579,"date":"2024-02-05T09:21:58","date_gmt":"2024-02-05T08:21:58","guid":{"rendered":"https:\/\/fivem-mods.net\/?p=93579"},"modified":"2026-08-16T13:42:41","modified_gmt":"2026-08-16T11:42:41","slug":"comment-reduire-la-densite-des-pnj","status":"publish","type":"post","link":"https:\/\/rpcrate.com\/fr\/how-to-reduce-npcs-density\/","title":{"rendered":"Comment r\u00e9duire la densit\u00e9 des NPC dans FiveM en toute s\u00e9curit\u00e9"},"content":{"rendered":"<p>Ambient ped and traffic density can be reduced by a client resource that applies density multipliers every frame. This changes the world players see; it does not guarantee a server-performance or FPS improvement. Check whether your existing population resource already owns these settings before adding another.<\/p>\n<p>The configuration and code examples here target FiveM for GTA V Legacy. Enhanced has different runtime and compatibility rules; check <a href=\"https:\/\/docs.fivem.net\/docs\/developers\/legacy-vs-enhanced\/\">Cfx.re\u2019s Legacy-to-Enhanced changes<\/a> before applying them to an Enhanced server.<\/p>\n<h2 id=\"create-the-resource\">Create the resource<\/h2>\n<p>Create <code data-no-translation=\"\" translate=\"no\">resources\/[local]\/npc_reducer\/<\/code>. Add <code data-no-translation=\"\" translate=\"no\">fxmanifest.lua<\/code>:<\/p>\n<pre data-no-translation=\"\" translate=\"no\"><code data-no-translation=\"\" translate=\"no\">fx_version 'cerulean'\ngame 'gta5'\nclient_script 'client.lua'<\/code><\/pre>\n<p>Add <code data-no-translation=\"\" translate=\"no\">client.lua<\/code> beside the manifest. This example starts at half the default multiplier:<\/p>\n<pre data-no-translation=\"\" translate=\"no\"><code data-no-translation=\"\" translate=\"no\">local density = 0.5\n\nCreateThread(function()\n    while true do\n        Wait(0)\n        SetPedDensityMultiplierThisFrame(density)\n        SetScenarioPedDensityMultiplierThisFrame(density, density)\n        SetVehicleDensityMultiplierThisFrame(density)\n        SetRandomVehicleDensityMultiplierThisFrame(density)\n        SetParkedVehicleDensityMultiplierThisFrame(density)\n    end\nend)<\/code><\/pre>\n<h2 id=\"start-and-adjust-it\">Start and adjust it<\/h2>\n<p>Add <code data-no-translation=\"\" translate=\"no\">ensure npc_reducer<\/code> to the server configuration. For a newly created resource, use the normal refresh\/start process or a controlled server restart. Check the server and F8 logs for loading errors.<\/p>\n<p>Edit the value, then restart the resource to load the changed client code. Editing a file alone does not change code already running on connected clients. Keep the frame wait: these native effects apply to the current frame.<\/p>\n<h2 id=\"test-the-gameplay-effect\">Test the gameplay effect<\/h2>\n<p>Compare the same route before and after the change. Check city traffic, parked vehicles, scenarios and jobs that depend on ambient peds. Script-spawned mission entities may be controlled separately. If another population script overrides the values, configure one owner instead of adding more competing loops.<\/p>\n<p>Measure client frame time and resource cost using the same scene. To roll back, stop the resource and remove its startup entry; verify the previous population behaviour after reconnecting.<\/p>\n<h2 id=\"references\">References<\/h2>\n<p><a href=\"https:\/\/docs.fivem.net\/docs\/scripting-manual\/introduction\/creating-your-first-script\/\">Cfx.re first Lua resource<\/a>; <a href=\"https:\/\/github.com\/citizenfx\/natives\">CitizenFX native documentation<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>La densit\u00e9 des pi\u00e9tons et du trafic ambiants peut \u00eatre r\u00e9duite par une ressource client qui applique des multiplicateurs de densit\u00e9 \u00e0 chaque image. Cela modifie le monde que les joueurs voient ; cela ne garantit pas une am\u00e9lioration des performances du serveur ou du FPS. V\u00e9rifiez si votre ressource de population existante g\u00e8re d\u00e9j\u00e0 ces param\u00e8tres avant d'en ajouter une autre.<\/p>","protected":false},"author":1,"featured_media":93580,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1899],"tags":[],"class_list":["post-93579","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials"],"_links":{"self":[{"href":"https:\/\/rpcrate.com\/fr\/wp-json\/wp\/v2\/posts\/93579","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rpcrate.com\/fr\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rpcrate.com\/fr\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rpcrate.com\/fr\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rpcrate.com\/fr\/wp-json\/wp\/v2\/comments?post=93579"}],"version-history":[{"count":3,"href":"https:\/\/rpcrate.com\/fr\/wp-json\/wp\/v2\/posts\/93579\/revisions"}],"predecessor-version":[{"id":217304,"href":"https:\/\/rpcrate.com\/fr\/wp-json\/wp\/v2\/posts\/93579\/revisions\/217304"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/rpcrate.com\/fr\/wp-json\/wp\/v2\/media\/93580"}],"wp:attachment":[{"href":"https:\/\/rpcrate.com\/fr\/wp-json\/wp\/v2\/media?parent=93579"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rpcrate.com\/fr\/wp-json\/wp\/v2\/categories?post=93579"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rpcrate.com\/fr\/wp-json\/wp\/v2\/tags?post=93579"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}