Raised This Month: $ Target: $400
 0% 

get_user_stats problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 12-06-2007 , 14:06   get_user_stats problem
Reply With Quote #1

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
__________________
Bugsy is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-06-2007 , 14:22   Re: get_user_stats problem
Reply With Quote #2

Try to retrieve the rank at client_putinserver, or at the second that happen (authorized vs putinserver)
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 12-06-2007 , 17:36   Re: get_user_stats problem
Reply With Quote #3

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.
__________________

Last edited by Bugsy; 12-06-2007 at 18:26.
Bugsy is offline
travo
Senior Member
Join Date: Aug 2006
Old 12-07-2007 , 17:37   Re: get_user_stats problem
Reply With Quote #4

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]);

travo is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 12-07-2007 , 20:17   Re: get_user_stats problem
Reply With Quote #5

Quote:
Originally Posted by travo View Post
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.
__________________
Bugsy is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 12-07-2007 , 21:32   Re: get_user_stats problem
Reply With Quote #6

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.
__________________
Arkshine is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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