mancebomozo Posted October 31, 2012 Share Posted October 31, 2012 It's about making a system by which users are hungry and will lower the life every hour, forcing them to eat. function texto(texto) outputChatBox ( "Aviso: " .. texto ) end setTimer(texto,3600000,0,"Tienes hambre, come un poco") function startResource() local nivel = getElementData (source, "nivel") if nivel == 1 then setElementHealth ( source, getElementHealth ( source ) - 70 ) end setTimer(startResource, 3600000, 0, true) end addEventHandler("onResourceStart", getResourceRootElement(), startResource) Help please someone tell me the error Link to comment
Moderators IIYAMA Posted October 31, 2012 Moderators Share Posted October 31, 2012 Check your bugs:(admin) /debugscript 3 I am not sure, but should this not be a:1 setTimer(startResource, 10000,1, true) --14 Because, he is already triggering him zelf again. Don't you need to use: localPlayer ? localPlayer = getLocalPlayer ( ) Player = getLocalPlayer ( ) function texto(texto) outputChatBox ( "Aviso: " .. texto ) end setTimer(texto,3600000,0,"Tienes hambre, come un poco") function startResource() local nivel = getElementData (player, "nivel") if nivel == 1 then setElementHealth ( player, getElementHealth ( player ) - 70 ) end setTimer(startResource, 3600000, 1, true) end addEventHandler("onResourceStart", getResourceRootElement(), startResource) Link to comment
mancebomozo Posted October 31, 2012 Author Share Posted October 31, 2012 vida.lua:10: Bad argument @'getelementData' [Expected element at argument 1, got nil] Link to comment
Moderators IIYAMA Posted October 31, 2012 Moderators Share Posted October 31, 2012 That means you don't have set the element data yet, you have to set the element data first or to zero, bevore this script can be executed. Link to comment
mancebomozo Posted October 31, 2012 Author Share Posted October 31, 2012 the script is in serverside, the function is not localplayer I look Link to comment
Moderators IIYAMA Posted October 31, 2012 Moderators Share Posted October 31, 2012 You did not said it was serverside, But as I said, the element data must first be exist. Link to comment
Moderators IIYAMA Posted October 31, 2012 Moderators Share Posted October 31, 2012 you can try this: function texto(texto) outputChatBox ( "Aviso: " .. texto ) end setTimer(texto,3600000,0,"Tienes hambre, come un poco") function startResource() for k,player in ipairs(getAlivePlayers()) local nivel = getElementData (player, "nivel") if nivel == 1 then setElementHealth ( player, getElementHealth ( player ) - 70 ) end setTimer(startResource, 3600000, 1, true) end end addEventHandler("onResourceStart", getResourceRootElement(), startResource) I don't think this is going to work because.... I am to tired to rebuild it Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now