try this:
local teamZombie = createTeam("Zombies")
function onSpawnSlothBot()
local x, y, z = getElementPosition (source)
local rot = 0
local int = getElementInterior(source)
local dim = getElementDimension(source)
local weapon = 0
setTeamFriendlyFire(teamZombie,false)
local skin = math.random(math.floor(21,23)) -- Entre 21 y 23 el skin
for i = 1,10 do
exports.slothbot:spawnBot(x+i, y+i, z, rot, skin, int, dim, teamZombie, weapon)
end
end
addEvent("onBotSpawned",true)
addEventHandler("onBotSpawned",getRootElement(),onSpawnSlothBot)--it's onBotSpawned not onSpawnBot
function onBotWasted(attacker,weapon,bodypart)
local x,y,z = getElementPosition(attacker)
local rot = 0
local int = getElementInterior(attacker)
local dim = getElementDimension(attacker)
local weapon = 0
local skin = math.random(math.floor(21,23))
local dec = math.random(7,40)
exports.slothbot:spawnBot(x+y, y+dec, z, rot, skin, int, dim, teamZombie, weapon)
end
addEvent("onBotWasted",true)
addEventHandler("onBotWasted",getRootElement(),onBotWasted)