MasterTobi Posted March 19, 2009 Share Posted March 19, 2009 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
[DKR]silverfang Posted March 19, 2009 Share Posted March 19, 2009 heymy 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
Ace_Gambit Posted March 19, 2009 Share Posted March 19, 2009 Firstly timers have to be declared in a function, your best bet is to do that in a function linked to the onResourceStart Event That's not true. You can call setTimer anywhere and anytime you want. Even when it's in the body of your script. Link to comment
[DKR]silverfang Posted March 19, 2009 Share Posted March 19, 2009 Firstly timers have to be declared in a function, your best bet is to do that in a function linked to the onResourceStart Event That's not true. You can call setTimer anywhere and anytime you want. Even when it's in the body of your script. huh never knew that... but it's just as good to put it in a function handling onResourceStart... Link to comment
DakiLLa Posted March 19, 2009 Share Posted March 19, 2009 and what is the source of your function? i think that function cant gets the source of function (sounds not good ) 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
MasterTobi Posted March 19, 2009 Author Share Posted March 19, 2009 BIG THX @ALL but you are the best @ dak =) Link to comment
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