NodZen Posted October 1, 2012 Share 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 Link to comment
BorderLine Posted October 1, 2012 Share 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) Link to comment
NodZen Posted October 1, 2012 Author Share Posted October 1, 2012 Lo pruevo y te digo si funciona Link to comment
NodZen Posted October 1, 2012 Author Share Posted October 1, 2012 No Yakuza no funciona , y en el mtaserver.exe salen millones de errores Agluna ayuda? Link to comment
Plate Posted October 1, 2012 Share Posted October 1, 2012 Postea los errores que salen ^^ haci podemos saber cual es el error y corregirlo Link to comment
NodZen Posted October 1, 2012 Author Share 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 Link to comment
BorderLine Posted October 1, 2012 Share Posted October 1, 2012 usa /debugscript para ver los errores del script que has posteado. Mas a fondo, en la consola muestra algunos solamente. Link to comment
Renkon Posted October 2, 2012 Share 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. Link to comment
BorderLine Posted October 2, 2012 Share 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) Link to comment
Plate Posted October 2, 2012 Share 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 Link to comment
Alexs Posted October 2, 2012 Share 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. Link to comment
Recommended Posts