Jump to content

getElementData error in setTimer


Recommended Posts

  • Discord Moderators

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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