Jump to content

[Duda] Spawn Slothbot al Matar otro Slotboth


Recommended Posts

Bueno lo que susece esque tenia un sistema de spawm de Jefes... funciono bien, pero lo modifique un poco para que lugar de que spawne cuando se maten zombis, sea cuando se mate una cantidad de slotbot, el problema es que cuando spawnea el boss si ahi 2 y matan al primero (mas Debil) recibes las 2 recompensas y e lgrande no muere :/ ademas al matar un boss se reinicia el contador de muertes de boss :/

----BOSS 
  
local colshape = createColRectangle ( -2960, -2960, 5920, 5920 ) -- estas son las coordenadas donde se va a crear el boss para cambiarlas solamente copien la posicion x e y de su admin panel 
local BosssMatados = 0 
  
local weapons = 
    { 
        
        [ 36 ] = 5 
    } 
  
function zona (attacker, weapon, bodypart) 
 if ( isElementWithinColShape ( source, colshape ) ) then 
  BosssMatados = ( BosssMatados + 1 ) 
  if ( BosssMatados == 10 ) then --Numero de Zombis por Matar 
   if ( not isElement ( Troll ) ) then 
    local x, y, z = getElementPosition(attacker) 
    local skin = 36 
    Troll = exports [ "slothbot" ]:spawnBot ( x+20, y+20, z+3, 90, skin, 0, 0, false, weapons [ skin ] or 0, "hunting" ) 
    myBlip2 = createBlipAttachedTo ( Troll, 19 ) 
    local id = getElementModel ( Troll ) 
    if id == 36 then 
        exports.extra_health:setElementExtraHealth(Troll, 500000) 
        outputChatBox ( "#ff0000 Corre HDP!!!", getRootElement(), 255, 255, 255, true) 
     
    end 
            end 
        end 
    end 
end 
  
addEventHandler ( "onBotWasted", getRootElement(), zona ) 
  
  
---Matar 1 
function bot ( attacker ) 
 if attacker == Troll then --Creo que 'tyrant' es la variable de tu 'BOSS' 
  if ( getElementType ( attacker ) == "ped" ) then 
   killPed ( source, attacker ) 
   blowVehicle ( source ) 
  end 
 end 
end 
addEventHandler("onPlayerDamage", getRootElement(), bot) 
  
  
---RepawnBots 
function restartear ( ) 
    if ( isElementWithinColShape ( source, colshape ) ) then 
        BosssMatados = 0 
   end 
end 
addEventHandler ( "onBotWasted",getRootElement(), restartear ) 
  
  
  
  
--Dinero 
  
  
addEventHandler ( "onBotWasted", root, 
  
  
function ( theKiller ) 
     
model = getElementModel( Troll ) -- slothbot 1 cambialo 
if model == 36 then 
                exports.exp_system:addPlayerEXP ( theKiller, 200000 ) 
                destroyElement(myBlip2) 
                givePlayerMoney(theKiller, 5000000) 
                local r,g,b = getPlayerNametagColor ( theKiller ) --get the player's nametag colour 
                local chatterName = getPlayerName ( theKiller ) 
                outputChatBox (  chatterName.." #FF0000ha matado al Troll!!! *", getRootElement(), r, g, b, true ) 
   end 
end 
) 
  
  
  
  
  
  
function vida() 
local vida = exports.extra_health:getElementExtraHealth(Troll) -- acordate de cambiar esto de Troll 
outputChatBox("la vida del boss es ".. vida.."", 255, 0, 255) 
end 
addCommandHandler("lavida", vida) 

Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...