steamstats command not working
3 replies



28.12.17 05:01:02 am
I'm trying to get the seconds spent on server using steam data, but it always returns "false" as value.

Here is the sample script:

Here is the sample script:
Code:
1
2
3
4
5
6
2
3
4
5
6
local usgn = player(uid,"usgn")
local steam = player(uid,"steamid")
local secs=0
if usgn~=0 then secs = secs+stats(usgn,"secs") end
if steam~="0" then secs = secs+steamstats(steam,"secs") end
return secs
local steam = player(uid,"steamid")
local secs=0
if usgn~=0 then secs = secs+stats(usgn,"secs") end
if steam~="0" then secs = secs+steamstats(steam,"secs") end
return secs
Check the source of your uid variable. I assume it's wrong (e.g. mixed up parameter order in a hook). Player commands will just return false if the player does not exist.
Either make sure that uid is always a valid player ID or add a check to handle this situation. You can use
A simple
Either make sure that uid is always a valid player ID or add a check to handle this situation. You can use
if player(uid,"exists") then
to check if a player actually exists.A simple
lua print(player(1,"steamid"))
works fine for me. Buti i tested on myself (on id 1), logged in steam and the "false" message still appears
I don't need just the steamid, i need the seconds spent.
The source of "uid" is ok, because the usgn stats are showing just fine, also the player(uid,'steamid') is fine, the real problem is the steamstats command
I don't need just the steamid, i need the seconds spent.
The source of "uid" is ok, because the usgn stats are showing just fine, also the player(uid,'steamid') is fine, the real problem is the steamstats command
I've fixed it for the next version. There was unnecessary 32 bit integer assignment for 64bit long steamID.
edited 1×, last 30.12.17 10:37:10 pm



