NodZen Posted October 1, 2012 Posted October 1, 2012 Bueno miren. El tema es asi. Tengo echo un script con cantidad de jefes zombies "bosses" hasta hay todo bien.Pero lo que quiero es que llegue determinada hora en el server y entonces se creen todos los zombies. Miren functiob boss () if ( not isElement ( slothBot ) ) then local hours = getTime() if ( hours >= 23 ) then --aca se crea el boss todo bien ,entonces local hours = getTime() if ( hours >= 03 ) then setTimer ( destroyElement, boss, 300, 0 ) --y se destruye bien, eso pasa con todos. PERO EL PROBLEMA ES QUE CUANDO LLEGA LAS 23 EL BOT NO SE CREA , AMENOS QUE REINICIE EL SLOTHBOT , LO MISMO AL DESTRUIRLO TENGO QUE REINICIAR EL RESOURCE Y ASI SUCESIVAMENTE... ENTONCES HICE function inicio () local hours = getTime() if ( hours >= 23 ) then startResource( getResourceFromName( 'slothbot' ) ) end end addEventHandler("onResourceStart", inicio) -----top--- function alto () if ( hours >= 03 ) then restartResource( getResourceFromName( 'slothbot' ) ) end end addEventHandler("onResourceStart", alto) PERO SIGUE IGUAL, TENGO QUE ANDAR REINICIANDO EL RESOURCE. Y NECESITO QUE ESO SEA AUTOMATICO .. AYUDENME GENTE GRACIAS
BorderLine Posted October 1, 2012 Posted October 1, 2012 primero me parece que para que se ejecute una funcion como esa de restartResource deben tener agregada a la linea de Admin en la ACL segundo tu creas un evento y el segundo argumento no es el nombre de la funcion, es el elemento al cual le envias la funcion function inicio () local hours = getTime() if ( hours >= 23 ) then startResource( getResourceFromName( 'slothbot' ) ) end end addEventHandler("onResourceStart",getRootElement(), inicio) -----top--- function alto () if ( hours >= 03 ) then restartResource( getResourceFromName( 'slothbot' ) ) end end addEventHandler("onResourceStart", getRootElement(),alto)
NodZen Posted October 1, 2012 Author Posted October 1, 2012 No Yakuza no funciona , y en el mtaserver.exe salen millones de errores Agluna ayuda?
Plate Posted October 1, 2012 Posted October 1, 2012 Postea los errores que salen ^^ haci podemos saber cual es el error y corregirlo
NodZen Posted October 1, 2012 Author Posted October 1, 2012 Postea los errores que salen ^^ haci podemos saber cual es el error y corregirlo [2012-10-01 00:29:43] WARNING: TLS_zombies\boss_zombies.lua:22: Bad argument @ 'createBlipAttachedTo' [2012-10-01 00:29:43] ERROR: exports: Call to non-running server resource (slothBot) [string "?"] Salen cientos de esos y me consumen todo el cpu
BorderLine Posted October 1, 2012 Posted October 1, 2012 usa /debugscript para ver los errores del script que has posteado. Mas a fondo, en la consola muestra algunos solamente.
Renkon Posted October 2, 2012 Posted October 2, 2012 function inicio () local hours = getTime() if ( hours >= 23 ) then startResource( getResourceFromName( 'slothbot' ) ) end end addEventHandler("onResourceStart",getRootElement(), inicio) -----top--- function alto () if ( hours >= 03 ) then restartResource( getResourceFromName( 'slothbot' ) ) end end addEventHandler("onResourceStart", getRootElement(),alto) Muchos errores. Solo te nombraré dos para que vayas arreglando. Primero, en la segunda función te tendria que dar error porque la variable HOURS no esta declarada. Y segundo, la funcion getTime retorna dos valores. Por recomendación, te conviene agregar un parámetro (variable) más, aunque no lo uses.
BorderLine Posted October 2, 2012 Posted October 2, 2012 con respecto a lo que Renkon dice. Intenta esto function inicio () local hour, minutes = getTime() if ( hour >= 23 ) then startResource( getResourceFromName( 'slothBot' ) ) end end addEventHandler("onResourceStart",getRootElement(), inicio) -----top--- function alto () local hour, minutes = getTime() if ( hour >= 03 ) then restartResource( getResourceFromName( 'slothBot' ) ) end end addEventHandler("onResourceStart", getRootElement(),alto)
Plate Posted October 2, 2012 Posted October 2, 2012 [2012-10-01 00:29:43] WARNING: TLS_zombies\boss_zombies.lua:22: Bad argument @ 'createBlipAttachedTo' eso es de otra cosa por que en ningun momento vi que en tu script crearas un blip ^^ [2012-10-01 00:29:43] ERROR: exports: Call to non-running server resource (slothBot) [string "?"] y eso es que no tenes prendido el resource(que no esta iniciado) ------------------------------------------------------------------------------------------------------------------------------------------------------ function inicio () local hour, minutes = getTime() if ( hour >= 23 ) then startResource( getResourceFromName( 'slothBot' ) ) end end addEventHandler("onResourceStart",getRootElement(), inicio) -----top--- function alto () local hour, minutes = getTime() if ( hour >= 03 ) then restartResource( getResourceFromName( 'slothBot' ) ) end end
Alexs Posted October 2, 2012 Posted October 2, 2012 3 Cosas: Postea la linea de 'createBlipAttachedTo' Enciende Slothbot antes. Si te consume la CPU es por que 300 milisegundos es muy poco.
Recommended Posts