When i spawn a lot of peds and make them attack player only 4-6 peds attack player and rest of them are just staying there. When i kill a attacking ped then a ped from “doing nothing” group comes and attacks me. I think there is some variable that says how many peds can attack me in the same time. Is there any function to make that number bigger?
client.lua
RegisterCommand('spawn', function(source, args)
-- exports['spawnmanager']:spawnPlayer()
local modelName = 'a_m_y_business_02'
local modelHash = GetHashKey(modelName)
local pl_ped = GetPlayerPed(-1)
if not IsModelInCdimage(modelName) or not IsModelAPed(modelName) then
sendMessage('Error. Not a ped or there is no ped like this.')
return
end
RequestModel(modelName)
sendMessage('[] Loading model...')
while not HasModelLoaded(modelName) do
Wait(333)
end
for i = 0, 24 do
local ped = CreatePed(4, modelHash, pos.x, pos.y, pos.z, 0.0, true, true)
TaskCombatPed(ped, pl_ped, 0, 16)
Wait(10)
end
SetModelAsNoLongerNeeded(modelName)
sendMessage('[] Ped spawned.')
end)
pos variable is set before by player executing a simple command with GetEntityCoords function inside.