Alexs Posted July 5, 2012 Posted July 5, 2012 Hola a Todos, Tengo un problema con el siguiente script: function cazeria () cazado = getRandomPlayer() outputChatBox ( "Ahora hay un Precio por la cabeza de " ..getPlayerName ( cazado )..". Matenlo y Ganaran $50.000" ) setElementData(cazado, "estado.cazeria", "True") end addEventHandler("onResourceStart", getRootElement(), cazeria) function estacazado ( attacker ) local estadocz = getElementData(source, "estado.cazeria") if (estadocz == "True") and (killer) then givePlayerMoney ( killer, 50000 ) outputChatBox ( "Lo has Matado, Ten tu Puto Dinero!", killer, 255, 0, 0, true ) setElementData(cazado, "estado.cazeria", "False") setTimer ( cazeria, 10000, 1) elseif (estadocz == "true") and not (killer) then outputChatBox ( "El Fugitivo es un Cobarde y se ha suicidado, Que Pena!" ) setElementData(cazado, "estado.cazeria", "False") setTimer ( cazeria, 10000, 1) else outputChatBox ( "Este no era el Fugitivo, deberias estar avergonzado -.-", killer, 255, 0, 0, true ) setElementHealth ( killer, getElementHealth(killer) - 25 ) end end addEventHandler ( "onPlayerWasted", getRootElement(), estacazado ) function cobardizo ( ) local estadocz2 = getElementData(source, "estado.cazeria") if (estadocz2 == "true") then setTimer ( cazeria, 10000, 1) end end addEventHandler ( "onPlayerQuit", getRootElement(), cobardizo ) Esto es el script completo, pero en los outputChatBox todos leen y no solo el killer, me dice que en la linea 21 "attempt to perform arithmetic a boolean value" y hay un bug que no se por que ocurre, pero cuando el objetivo no ha muerto sigue diciendo "Ahora hay un Precio por la cabeza de " ..getPlayerName ( cazado )..". Matenlo y Ganaran $50.000" cada 30 segundos... Developer @ MYVAL
Castillo Posted July 5, 2012 Posted July 5, 2012 totalAmmo: an integer representing the total ammo the victim had when he died.killer: an element representing the player or vehicle who was the killer. If there was no killer this is false. killerWeapon: an integer representing the killer weapon or the death reason. bodypart: an integer representing the bodypart ID the victim was hit on when he died. Esos son los argumentos, vos pusiste mal el de "killer". San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Alexs Posted July 5, 2012 Author Posted July 5, 2012 No comprendo, que le puse mal? Developer @ MYVAL
Castillo Posted July 5, 2012 Posted July 5, 2012 Mira los argumentos en tu funcion, luego mira los argumentos del evento. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Alexs Posted July 5, 2012 Author Posted July 5, 2012 Todo esto por que escribir "attacker" Edit: Lo puse asi y el problema sigue Developer @ MYVAL
Castillo Posted July 5, 2012 Posted July 5, 2012 Porque no era solo eso, pusiste como 'killer' en el primer argumento, pero ese argumento es 'totalAmmo' ( estas ciego ? o simplemente no estas prestando atencion? ). San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Alexs Posted July 5, 2012 Author Posted July 5, 2012 Corregido, Te diria Gracias pero el problema sigue solo que ahora cada 10 segundos consigue otro jugador, Que otro problema hay? Que error se ve en la linea 21? function cazeria () cazado = getRandomPlayer() outputChatBox ( "Ahora hay un Precio por la cabeza de " ..getPlayerName ( cazado )..". Matenlo y Ganaran $50.000" ) setElementData(cazado, "estado.cazeria", "True") end addEventHandler("onResourceStart", getRootElement(), cazeria) function estacazado ( totalAmmo, killer, killerWeapon, bodypart ) local estadocz = getElementData(source, "estado.cazeria") if (estadocz == "True") and (killer) then givePlayerMoney ( killer, 50000 ) outputChatBox ( "Lo has Matado, Ten tu Puto Dinero!", killer, 255, 0, 0, true ) setElementData(cazado, "estado.cazeria", "False") setTimer ( cazeria, 10000, 1) elseif (estadocz == "True") and not (killer) then outputChatBox ( "El Fugitivo es un Cobarde y se ha suicidado, Que Pena!" ) setElementData(cazado, "estado.cazeria", "False") setTimer ( cazeria, 10000, 1) else outputChatBox ( "Este no era el Fugitivo, deberias estar avergonzado -.-", killer, 255, 0, 0, true ) setElementHealth ( killer, getElementHealth(killer) - 25 ) end end addEventHandler ( "onPlayerWasted", getRootElement(), estacazado ) function cobardizo ( ) local estadocz2 = getElementData(source, "estado.cazeria") if (estadocz2 == "True") then setTimer ( cazeria, 10000, 1) end end addEventHandler ( "onPlayerQuit", getRootElement(), cobardizo ) Developer @ MYVAL
Castillo Posted July 5, 2012 Posted July 5, 2012 No veo nada malo. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Alexs Posted July 5, 2012 Author Posted July 5, 2012 El principal problema es q todos leen los outputChatBox pero nadie gana el dinero... Developer @ MYVAL
Recommended Posts