Jump to content

Ayuda con Esto Plis!


NodZen

Recommended Posts

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

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
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
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

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
[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
  • Recently Browsing   0 members

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