{"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":"como-reducir-la-densidad-de-npc","status":"publish","type":"post","link":"https:\/\/rpcrate.com\/es\/how-to-reduce-npcs-density\/","title":{"rendered":"C\u00f3mo reducir la densidad de NPC en FiveM de forma segura"},"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 densidad de peatones y tr\u00e1fico ambiental se puede reducir mediante un recurso de cliente que aplica multiplicadores de densidad en cada fotograma. Esto cambia el mundo que ven los jugadores; no garantiza una mejora del rendimiento del servidor o de los FPS. Verifica si tu recurso de poblaci\u00f3n existente ya controla estas configuraciones antes de a\u00f1adir otro.<\/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\/es\/wp-json\/wp\/v2\/posts\/93579","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rpcrate.com\/es\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rpcrate.com\/es\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rpcrate.com\/es\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rpcrate.com\/es\/wp-json\/wp\/v2\/comments?post=93579"}],"version-history":[{"count":3,"href":"https:\/\/rpcrate.com\/es\/wp-json\/wp\/v2\/posts\/93579\/revisions"}],"predecessor-version":[{"id":217304,"href":"https:\/\/rpcrate.com\/es\/wp-json\/wp\/v2\/posts\/93579\/revisions\/217304"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/rpcrate.com\/es\/wp-json\/wp\/v2\/media\/93580"}],"wp:attachment":[{"href":"https:\/\/rpcrate.com\/es\/wp-json\/wp\/v2\/media?parent=93579"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rpcrate.com\/es\/wp-json\/wp\/v2\/categories?post=93579"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rpcrate.com\/es\/wp-json\/wp\/v2\/tags?post=93579"}],"curies":[{"name":"gracias","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}