FSXTim Posted September 24, 2012 Posted September 24, 2012 Hello, I have a small problem. Error (line 6): Bad argument @ 'getElementData' [expected element at argument one, got nil] function muteCheck() setTimer( function() local player = source local name = getPlayerName(player) if tonumber(getElementData(player, "Mute")) > 0 then local muteTime = tonumber(getElementData(player, "Mute")) setPlayerMuted(player, true) mTime = muteTime*60000 setTimer( function() if getElementData(player, "LoggedIn") then setPlayerMuted(player, false) outputChatBox("#FFFFFF"..name.." #00CD00kann nun wieder schreiben!", getRootElement(), 0, 205, 0, true) end end , mTime, 1, 0) end end , 50, 1) end Greets
Anderl Posted September 24, 2012 Posted September 24, 2012 Arguments aren't global, you must send them to setTimer's function.
FSXTim Posted September 24, 2012 Author Posted September 24, 2012 I have still the same error. What do I have to change? function muteCheck() setTimer( function() playerN = source playerNa = getPlayerName(playerN) if tonumber(getElementData(playerN, "Mute")) > 0 then local muteTime = tonumber(getElementData(playerN, "Mute")) setPlayerMuted(playerN, true) mTime = muteTime*60000 setTimer( function() if getElementData(playerN, "LoggedIn") then setPlayerMuted(playerN, false) outputChatBox("#FFFFFF"..playerNa.." #00CD00kann nun wieder schreiben!", getRootElement(), 0, 205, 0, true) end end , mTime, 1, 0) end end , 50, 1) end
Anderl Posted September 24, 2012 Posted September 24, 2012 I have still the same error. What do I have to change? function muteCheck() setTimer( function() playerN = source playerNa = getPlayerName(playerN) if tonumber(getElementData(playerN, "Mute")) > 0 then local muteTime = tonumber(getElementData(playerN, "Mute")) setPlayerMuted(playerN, true) mTime = muteTime*60000 setTimer( function() if getElementData(playerN, "LoggedIn") then setPlayerMuted(playerN, false) outputChatBox("#FFFFFF"..playerNa.." #00CD00kann nun wieder schreiben!", getRootElement(), 0, 205, 0, true) end end , mTime, 1, 0) end end , 50, 1) end It didn't work because you didn't change what I said. setTimer - Read argument list and their info.
FSXTim Posted September 24, 2012 Author Posted September 24, 2012 Thank you, it's working now. Greets
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