Jump to content

Expected element at argument one, got nil


FSXTim

Recommended Posts

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

Link to comment

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 

Link to comment
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.

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...