BlockFighter Posted August 28, 2018 Share Posted August 28, 2018 (edited) Hi! Can not I solve this bug to fix it? Code: setTimer(function() if getElementData(thePlayer, "asd.asd") then outputChatBox("asd", thePlayer, 255, 255, 255, true) end end, 1000*3, 0) Edited August 28, 2018 by BlockFighter Link to comment
MIKI785 Posted August 28, 2018 Share Posted August 28, 2018 It's simple, the debug tells you that thePlayer is nil -> it's not defined. Link to comment
BlockFighter Posted August 28, 2018 Author Share Posted August 28, 2018 And how could it be defined on a server side? Link to comment
Dimos7 Posted August 28, 2018 Share Posted August 28, 2018 setTimer(function(thePlayer ) if getElementData(thePlayer, "asd.asd") then outputChatBox("asd", thePlayer, 255, 255, 255, true) end end, 1000*3, 0) Link to comment
BlockFighter Posted August 28, 2018 Author Share Posted August 28, 2018 It was not good, the error remained. Link to comment
Discord Moderators Pirulax Posted August 28, 2018 Discord Moderators Share Posted August 28, 2018 you need to supply 'thePlayer' as an argument to setTimer. setTimer(function(thePlayer ) if getElementData(thePlayer, "asd.asd") then outputChatBox("asd", thePlayer, 255, 255, 255, true) end end, 1000*3, 0, thePlayer) Link to comment
BlockFighter Posted August 28, 2018 Author Share Posted August 28, 2018 Still the same mistake. Link to comment
pa3ck Posted August 29, 2018 Share Posted August 29, 2018 Show the function / event where you set the timer. If that's all the code you have, do this: setTimer(function( ) for k, thePlayer in ipairs(getElementsByType("player")) do if getElementData(thePlayer, "asd.asd") then outputChatBox("asd", thePlayer, 255, 255, 255, true) end end end, 1000*3, 0) Keep in mind this will always loop through all players. If you want to only run it for X players, you should tie it to an event / function and pass the in the player element as explained in the previous replies. Link to comment
BlockFighter Posted August 29, 2018 Author Share Posted August 29, 2018 Thanks, this is already working! 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