Jump to content

[Ayuda] Problema con Boss


Platin

Recommended Posts

Posted

Buenas, el problema que tengo es que la funcion entera no funciona, no da el dinero, no avisa que mate al boss, nada de nada.

Les dejo el código:

server side

function recompensa(attacker, weapon, bodypart) 
    boss1muerto = isPedDead(boss1) 
    if boss1muerto then 
        givePlayerMoney ( attacker, 1000 ) 
        outputChatBox("* #FFFFFF¡"..getPlayerName(attacker).." #FFFFFFmato al #00FF00Boss#FFFFFF!", getRootElement(), 0, 255, 0, true) 
    elseif boss1muerto and bodypart == 9 then 
        givePlayerMoney ( attacker, 2000 ) 
        outputChatBox("* #FFFFFF¡"..getPlayerName(attacker).." #FFFFFFmato al #00FF00Boss #FFFFFFde un #00FF00Headshot#FFFFFF!", getRootElement(), 0, 255, 0, true)         
    end 
end 
addEventHandler("onBotWasted",  getRootElement(), recompensa) 

Desde ya, muchas graicas.

Posted
  
function recompensa(attacker, weapon, bodypart) 
        givePlayerMoney ( attacker, 1000 ) 
        outputChatBox("* #FFFFFF¡"..getPlayerName(attacker).." #FFFFFFmato al #00FF00Boss#FFFFFF!", getRootElement(), 0, 255, 0, true) 
    elseif boss1muerto and bodypart == 9 then 
        givePlayerMoney ( attacker, 2000 ) 
        outputChatBox("* #FFFFFF¡"..getPlayerName(attacker).." #FFFFFFmato al #00FF00Boss #FFFFFFde un #00FF00Headshot#FFFFFF!", getRootElement(), 0, 255, 0, true)        
    end 
addEventHandler("onBotWasted",  bot1, recompensa) 
  

Posted

¿Podría ser así?

function recompensa(attacker, weapon, bodypart) 
    if bodypart == 9 then 
        givePlayerMoney ( attacker, 2000 ) 
        outputChatBox("* #FFFFFF¡"..getPlayerName(attacker).." #FFFFFFmato al #00FF00Boss #FFFFFFde un #00FF00Headshot#FFFFFF!", getRootElement(), 0, 255, 0, true) 
    else 
        givePlayerMoney ( attacker, 1000 ) 
        outputChatBox("* #FFFFFF¡"..getPlayerName(attacker).." #FFFFFFmato al #00FF00Boss#FFFFFF!", getRootElement(), 0, 255, 0, true)  
    end 
end 
addEventHandler("onBotWasted",  boss1, recompensa) 

EDIT:

addEventHandler("onBotWasted",  boss1, recompensa) 

El boss1 me lo toma como nil, ¿tiene que ser el bot no?

Posted
Agrega el addEventHandler cuando crees el bot o simplemente utiliza 'root' como objeto y agrega una condicional para detectar si el boss que ha muerto es boss1.

Lo del 'root' fue lo primero que hice. Y sobre mover addEventHandler, pues, no me sirvio

Posted
Agrega el addEventHandler cuando crees el bot o simplemente utiliza 'root' como objeto y agrega una condicional para detectar si el boss que ha muerto es boss1.

Lo del 'root' fue lo primero que hice. Y sobre mover addEventHandler, pues, no me sirvio

A mi me funciona.

y si lo tomas con onPedWasted, Que pasa?

Es lo mismo, sólo que deberá comprobar si el ped que murió es bot y si es ese bot. 'onBotWasted' hace lo mencionado anteriormente, sería una pérdida de tiempo.

  • 2 weeks later...
Posted
Agrega el addEventHandler cuando crees el bot o simplemente utiliza 'root' como objeto y agrega una condicional para detectar si el boss que ha muerto es boss1.

Lo del 'root' fue lo primero que hice. Y sobre mover addEventHandler, pues, no me sirvio

A mi me funciona.

y si lo tomas con onPedWasted, Que pasa?

Es lo mismo, sólo que deberá comprobar si el ped que murió es bot y si es ese bot. 'onBotWasted' hace lo mencionado anteriormente, sería una pérdida de tiempo.

Perdona la tardía respuesta.

Si te funciona, ¿lo podrías pasar? Sería de gran ayuda.

Posted

prueba con esto a mi me funciona

addEvent("onBotWasted") 
addEventHandler( "onBotWasted", getRootElement(), 
     function (attacker, weapon, bodypart) 
                  if getElementType(attacker)== "player" and (source == boss1) then 
                     if bodypart == 9 then 
                        givePlayerMoney ( attacker, 2000 ) 
                        outputChatBox("* #FFFFFF¡"..getPlayerName(attacker).." #FFFFFFmato al #00FF00Boss #FFFFFFde un                        #00FF00Headshot#FFFFFF!", getRootElement(), 0, 255, 0, true)  
                     else 
                        givePlayerMoney ( attacker, 1000 ) 
                        outputChatBox("* #FFFFFF¡"..getPlayerName(attacker).." #FFFFFFmato al #00FF00Boss#FFFFFF!", getRootElement(), 0, 255, 0, true) 
                    end 
                 end 
             end) 

Posted
prueba con esto a mi me funciona
addEvent("onBotWasted") 
addEventHandler( "onBotWasted", getRootElement(), 
     function (attacker, weapon, bodypart) 
                  if getElementType(attacker)== "player" and (source == boss1) then 
                     if bodypart == 9 then 
                        givePlayerMoney ( attacker, 2000 ) 
                        outputChatBox("* #FFFFFF¡"..getPlayerName(attacker).." #FFFFFFmato al #00FF00Boss #FFFFFFde un                        #00FF00Headshot#FFFFFF!", getRootElement(), 0, 255, 0, true)  
                     else 
                        givePlayerMoney ( attacker, 1000 ) 
                        outputChatBox("* #FFFFFF¡"..getPlayerName(attacker).." #FFFFFFmato al #00FF00Boss#FFFFFF!", getRootElement(), 0, 255, 0, true) 
                    end 
                 end 
             end) 

Extrañamente, me funciono. Muchas gracias ;)

  • Recently Browsing   0 members

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