Castillo Posted September 8, 2010 Share Posted September 8, 2010 hey, i've got a problem with a script of account data dunno why it keeps saying bad argument at triggerClientEvent and all seems fine, here is a piece of my code, function onLoginStuff() local acc = getPlayerAccount ( source ) local zombieKills = getAccountData(acc, "zombieKills") if (tonumber(getAccountData (acc,"level")) == 1) then killsTimer = setTimer (function ( ) local killsData = getAccountData(acc,"zombieKills") triggerClientEvent(source,"updateKills",source,killsData,100) end,1000,0) elseif (tonumber(getAccountData (acc,"level")) == 2) then killsTimer = setTimer (function ( ) local killsData = getAccountData(acc,"zombieKills") triggerClientEvent(source,"updateKills",source,killsData,200) end,1000,0) end end addEventHandler( "onPlayerLogin", getRootElement(), onLoginStuff) Link to comment
Tuna Posted September 8, 2010 Share Posted September 8, 2010 I think it might be because you need pass source to that function inside the timer. so: killsTimer = setTimer (function ( ) local to: killsTimer = setTimer (function (source) local and you may also need to put source as an arguement in setTimer so: triggerClientEvent(source,"updateKills",source,killsData,200) end,1000,0) to: triggerClientEvent(source,"updateKills",source,killsData,200) end,1000,0,source) Link to comment
Castillo Posted September 8, 2010 Author Share Posted September 8, 2010 I think it might be because you need pass source to that function inside the timer.so: killsTimer = setTimer (function ( ) local to: killsTimer = setTimer (function (source) local and you may also need to put source as an arguement in setTimer so: triggerClientEvent(source,"updateKills",source,killsData,200) end,1000,0) to: triggerClientEvent(source,"updateKills",source,killsData,200) end,1000,0,source) thanks it worked. 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