AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   get_user_stats problem (https://forums.alliedmods.net/showthread.php?t=64035)

Bugsy 12-06-2007 14:06

get_user_stats problem
 
I am writing a plugin in which I have to retrieve the users kills & deaths upon connecting. As of now I am using the get_user_stats call in client_authorized.

Everything is coming up as 0; pos, szStats[0] and szStats[1]

I also tried using get_stats() but that looks up stats based on stats index.

Does anyone have any ideas?

PHP Code:

new szStats[8]
new 
szBHits[8]

new 
pos get_user_stats(idszStatsszBHits


ConnorMcLeod 12-06-2007 14:22

Re: get_user_stats problem
 
Try to retrieve the rank at client_putinserver, or at the second that happen (authorized vs putinserver)

Bugsy 12-06-2007 17:36

Re: get_user_stats problem
 
Tried client_putinserver and it still gives the same result.

Any other ideas?

Edit: I got it working by checking stats when the player gets spawned.

travo 12-07-2007 17:37

Re: get_user_stats problem
 
try playing around with this
PHP Code:

#include <amxmodx>
#include <csx>

public client_connect(id)
{
    new 
szStats[8],szBHits[8];
    
get_user_stats(id,szStats,szBHits);
    
client_print(id,print_chat,"[AMXX] Your kills %d, deaths %d.",szStats[0],szStats[1]);



Bugsy 12-07-2007 20:17

Re: get_user_stats problem
 
Quote:

Originally Posted by travo (Post 560944)
try playing around with this
PHP Code:

#include <amxmodx>
#include <csx>

public client_connect(id)
{
    new 
szStats[8],szBHits[8];
    
get_user_stats(id,szStats,szBHits);
    
client_print(id,print_chat,"[AMXX] Your kills %d, deaths %d.",szStats[0],szStats[1]);



client_authorized and client_putinserver both occur after client_connect so I don't see how that would work over the two I've already tried. If you try that you will see 0 kills and 0 deaths.

Arkshine 12-07-2007 21:32

Re: get_user_stats problem
 
It seems that you have to be fully connected for that.

It works fine for me using in client_putinserver() + a delay about 1 second ( or a bit more ).

By the way I don't understand why. Since we have player's id we should able to retrieve player's stats from csstats.dat even if player is not fully connected yet.


All times are GMT -4. The time now is 11:12.

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