Platin Posted February 11, 2015 Posted February 11, 2015 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.
Tomas Posted February 12, 2015 Posted February 12, 2015 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)
Platin Posted February 12, 2015 Author Posted February 12, 2015 ¿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?
Tomas Posted February 12, 2015 Posted February 12, 2015 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.
Platin Posted February 12, 2015 Author Posted February 12, 2015 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
UserToDelete Posted February 12, 2015 Posted February 12, 2015 y si lo tomas con onPedWasted, Que pasa?
Tomas Posted February 13, 2015 Posted February 13, 2015 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.
Platin Posted February 22, 2015 Author Posted February 22, 2015 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.
alex17 Posted February 22, 2015 Posted February 22, 2015 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)
Platin Posted February 22, 2015 Author Posted February 22, 2015 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
Recommended Posts