Forum

> > CS2D > Scripts > steamstats command not working
Forums overviewCS2D overview Scripts overviewLog in to reply

English steamstats command not working

3 replies
To the start Previous 1 Next To the start

old steamstats command not working

mozilla1
User Off Offline

Quote
I'm trying to get the seconds spent on server using steam data, but it always returns "false" as value.


IMG:https://i.imgur.com/lxACg8t.png


Here is the sample script:

1
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

old Re: steamstats command not working

DC
Admin Off Offline

Quote
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
if player(uid,"exists") then
to check if a player actually exists.

A simple
lua print(player(1,"steamid"))
works fine for me.

old Re: steamstats command not working

mozilla1
User Off Offline

Quote
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

old Re: steamstats command not working

SQ
Moderator Off Offline

Quote
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
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview