diff --git a/resources/[framework]/[addons]/rv-itemsonback/client.lua b/resources/[framework]/[addons]/rv-itemsonback/client.lua index 2d720d59..6a51b139 100644 --- a/resources/[framework]/[addons]/rv-itemsonback/client.lua +++ b/resources/[framework]/[addons]/rv-itemsonback/client.lua @@ -541,3 +541,51 @@ CreateThread(function() end end end) + +----------------------------------------- +-- Target Dummy PED (testing) +----------------------------------------- +local spawnedDummies = {} + +RegisterCommand('spawndummy', function() + local ped = PlayerPedId() + local coords = GetEntityCoords(ped) + local heading = GetEntityHeading(ped) + + -- Spawn în fața playerului + local rad = math.rad(heading) + local spawnX = coords.x - math.sin(rad) * 2.0 + local spawnY = coords.y + math.cos(rad) * 2.0 + + local models = { + 's_m_y_cop_01', 'a_m_y_business_01', 'a_m_m_farmer_01', + 'a_m_y_hipster_01', 's_m_m_paramedic_01', 'a_m_m_bevhills_01' + } + local model = GetHashKey(models[math.random(#models)]) + + RequestModel(model) + while not HasModelLoaded(model) do Wait(50) end + + local dummy = CreatePed(4, model, spawnX, spawnY, coords.z - 1.0, heading + 180.0, true, false) + SetEntityAsMissionEntity(dummy, true, true) + SetEntityInvincible(dummy, false) + SetBlockingOfNonTemporaryEvents(dummy, true) + SetPedFleeAttributes(dummy, 0, false) + SetPedCombatAttributes(dummy, 46, true) + SetPedCanRagdollFromPlayerImpact(dummy, true) + TaskStandStill(dummy, -1) + SetModelAsNoLongerNeeded(model) + + spawnedDummies[#spawnedDummies + 1] = dummy + lib.notify({ title = 'Dummy spawnat', description = '/killdummy pentru cleanup', type = 'success' }) +end, false) + +RegisterCommand('killdummy', function() + for _, dummy in ipairs(spawnedDummies) do + if DoesEntityExist(dummy) then + DeleteEntity(dummy) + end + end + spawnedDummies = {} + lib.notify({ title = 'Dummies șterse', type = 'success' }) +end, false)