mancebomozo Posted October 31, 2012 Share Posted October 31, 2012 De lo que se trata es de conseguir que a los usuarior del servidor les baje vida cada hora, y asi tengan que comer. function texto(texto) outputChatBox ( "Aviso: " .. texto ) end setTimer(texto,3600000,0,"Tienes hambre, come un poco") function startResource2() if getElementData(source, "nivel") == 1 then setElementHealth ( player, getElementHealth ( player ) - 70 ) end setTimer(startResource2, 10000, 1, true) end addEventHandler("onResourceStart", getResourceRootElement(), startResource2) Esto tengo hasta el momento, y me da el siguiente error: vida.lua:10: Bad argument @'getelementData' [Expected element at argument 1, got nil] Link to comment
NodZen Posted October 31, 2012 Share Posted October 31, 2012 (edited) function texto(texto) outputChatBox ( "Aviso: " .. texto ) end setTimer(texto,3600000,0,"Tienes hambre, come un poco") function startResource2() if getElementData(source, "nivel") == 1 then setElementHealth ( source, getElementHealth(source) - 70 ) end setTimer(startResource2, 10000, 1, true) end addEventHandler("onResourceStart", getResourceRootElement(), startResource2) Edited October 31, 2012 by Guest Link to comment
Xperia Posted October 31, 2012 Share Posted October 31, 2012 Una pregunta, ¿que tienen que comer? Link to comment
NodZen Posted October 31, 2012 Share Posted October 31, 2012 Ah otra cosa , tienes definido el 'nivel'? Link to comment
Renkon Posted October 31, 2012 Share Posted October 31, 2012 function texto(texto) outputChatBox ( "Aviso: " .. texto ) end setTimer(texto,3600000,0,"Tienes hambre, come un poco") function startResource2() for _, p in ipairs(getElementsByType("player")) do if getElementData(p, "nivel") == 1 then setElementHealth ( p, getElementHealth ( p ) - 70 ) end end setTimer(startResource2, 10000, 1, true) end addEventHandler("onResourceStart", resourceRoot, startResource2) Link to comment
mancebomozo Posted October 31, 2012 Author Share Posted October 31, 2012 Una pregunta, ¿que tienen que comer? Hay una serie de items creados que dan salud, tendria que comprar y comer esos items Link to comment
Recommended Posts