Jump to content

SetTimer Problem


MasterTobi

Recommended Posts

hey

my Code:

function test() 
account = getClientAccount (source) 
Job =  getAccountData (account,"Job") 
Team =  getAccountData (account, "Team") 
end 
setTimer(test,10000,1) 
  

now if the function start then i have the following error :

Bad Argument @ 'getClientAccount --line3

Bad Argument @ 'getClientAccount --line4

where is the problem ?

thx

Link to comment
hey

my Code:

function test() 
account = getClientAccount (source) 
Job =  getAccountData (account,"Job") 
Team =  getAccountData (account, "Team") 
end 
setTimer(test,10000,1) 
  

now if the function start then i have the following error :

Bad Argument @ 'getClientAccount --line3

Bad Argument @ 'getClientAccount --line4

where is the problem ?

thx

Hi there, there are a few problems with your code.

Firstly timers have to be declared in a function, your best bet is to do that in a function linked to the onResourceStart Event

Secondly you cannot call the variable 'source' unless it is from an event. Info: Source

Link to comment

and what is the source of your function? i think that function cant gets the source of function (sounds not good :P) so thats why you have a warning..

May be you should get all players on server and get their account datas?

Something like this:

function test () 
    for k,players in ipairs (getElementsByType("players")) do 
        local account = getClientAccount ( players ) 
        if not isGuestAccount (account) then 
            local job = getAccountData ( account, "Job" ) 
            local team = getAccountData ( account, "Team" ) 
        end 
    end 
end 
setTimer ( test, 10000, 1 ) 

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