BlockFighter Posted August 28, 2018 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
MIKI785 Posted August 28, 2018 Posted August 28, 2018 It's simple, the debug tells you that thePlayer is nil -> it's not defined.
BlockFighter Posted August 28, 2018 Author Posted August 28, 2018 And how could it be defined on a server side?
Dimos7 Posted August 28, 2018 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)
BlockFighter Posted August 28, 2018 Author Posted August 28, 2018 It was not good, the error remained.
Discord Moderators Pirulax Posted August 28, 2018 Discord Moderators 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)
pa3ck Posted August 29, 2018 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.
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