AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Question about stats and retrieving steamID (edited) (https://forums.alliedmods.net/showthread.php?t=66796)

Bugsy 02-08-2008 22:03

Question about stats and retrieving steamID (edited)
 
Edit: Scroll down to my 2nd post

My plugin has to read a vault entry for a player (using the players SteamID) when they first connect. Will client_authorized be a 100% safe time to retrieve a players SteamID? I believe in the past I have used it but sometimes STEAM_ID_PENDING would come back (I think, it may have been client_connect). Currently I am using an event that calls my function on player spawn but I figured this is too repetitive for something that only needs to be read once per connection to the server. Anyone have a recommendation?

Xanimos 02-08-2008 22:35

Re: Safe (connect) time when players authid is definitely retrievable
 
You are correct in assuming to use client_authorized. Authorized is called after their STEAM_ID is retrieved from the steam servers.

Bugsy 02-09-2008 01:42

Re: Safe time when players authid is definitely retrievable, & stats problem
 
Now.. that works good but now I remember why I made the function at spawn and not client_authorized.

At the users first connection, the plugin saves the players kills+deaths to the vault but at client_authorized, stats are not yet able to be read (for some reason). When get_user_stats is called, it returns 0 for everything. Everything being returned rank position, and every element of stats[] and bodyhits[]. When called at spawn or round_start everything works fine. Does anyone have a solution that can handle both of my problems at once?

Summary of what I need:
When a player joins server, doesn't matter if it is instantly or not. It just has to happen at some point in time when a player joins. I need to be able to read a players stats and be able to retrieve their steamID.

I was able to fix it by doing the following but is it safe doing it this way? (stability, memory usage)

Code:
public client_authorized(id) {     set_task(10.0,"client_authorized_2", id); } public client_authorized_2(id) {        //code }

Xanimos 02-09-2008 01:55

Re: Question about stats and retrieving steamID (edited)
 
That's fine to do, and no, one set_task is not going to affect the speed or stability of your plugin.

oRNY 02-09-2008 08:52

Re: Question about stats and retrieving steamID (edited)
 
What's wrong with client_connect(id) ?

Bugsy 02-09-2008 12:21

Re: Question about stats and retrieving steamID (edited)
 
I don't think the user has yet validated their SteamID at that time, that's why client_authorized is preferable. And for reading stats, I'm not able to successfully read stats at client_connect or client_authorized. Try it you will see.


All times are GMT -4. The time now is 16:59.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.