Jump to content

Why it got nil ?


Newbie

Recommended Posts

[2014-03-16 11:52:10] WARNING: oshEE\panel_server.lua:86: Bad argument @ 'setAccountData' [Expected account at argument 1, got nil]

function UpdateMinuteS ( ) 
    for index, player in ipairs ( getElementsByType "account" ) do 
        setAccountData( account,"Time",tostring( getAccountData( account,"Time" ) or 0 )+1 ) 
    end 
end 
setTimer ( UpdateMinuteS, 60000, 0 ) 

From top:

            local rWins = getAccountData( account,"Wins" ) or 0 
            local rDeaths = getAccountData( account,"Deaths" ) or 0 
            local rTime = getAccountData( account,"Time" ) or 0 
            setElementData( source,"Wins",tostring( rWins ) ) 
            setElementData( source,"Deaths",tostring( rDeaths ) ) 
            setElementData( source,"Time",tostring( rTime ) ) 

Link to comment

"Account" exists look:

addEventHandler( "onPlayerLogin",root, 
    function ( ) 
        local account = getPlayerAccount( source ) 
        if account then 
            if isGuestAccount( account ) then return end 
            local rWins = getAccountData( account,"Wins" ) or 0 
            local rDeaths = getAccountData( account,"Deaths" ) or 0 
            local rTime = getAccountData( account,"Time" ) or 0 
            setElementData( source,"Wins",tostring( rWins ) ) 
            setElementData( source,"Deaths",tostring( rDeaths ) ) 
            setElementData( source,"Time",tostring( rTime ) ) 
        end 
   end 

I think i failed here:

function UpdateMinuteS ( ) 
    for index, player in ipairs ( getElementsByType "account" ) do 
        setAccountData( account,"Time",tostring( getAccountData( account,"Time" ) or 0 )+1 ) 
    end 
end 
setTimer ( UpdateMinuteS, 60000, 0 ) 

Link to comment
function UpdateMinuteS ( ) 
    for index, account in ipairs ( getAccounts (        ) ) do 
        if getAccountPlayer ( account ) then 
            setAccountData( account,"Time",tostring( getAccountData( account,"Time" ) or 0 )+1 ) 
        end 
    end 
end 
setTimer ( UpdateMinuteS, 60000, 0 ) 

And you forgot '(' To close the event.

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