Raised This Month: $32 Target: $400
 8% 

Reset rank plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DoPe^
Veteran Member
Join Date: Jul 2008
Location: Denmark / Copenhagen
Old 09-20-2013 , 08:42   Reset rank plugin
Reply With Quote #1

Heya! i'm working on a Hlstatsx Reset Rank plugin at the moment.

I can get it to reset the rank, but it's like some playerstats are still saved, so it just brings back the stats again :S really weird.

These are some of the queries I have tried to run


This one resets the rank, and it works, but it's like the session is still saved, so the stuff it resets here gets restored.
PHP Code:
FormatEx(Querysizeof(Query), "UPDATE hlstats_players SET kills ='0', deaths ='0', suicides ='0', skill ='%d', headshots ='0', last_skill_change ='0', kill_streak ='0', death_streak ='0' WHERE playerid = ( SELECT playerid FROM hlstats_playeruniqueids WHERE uniqueid = '%s' AND game = '%s' ) AND game = '%s'",cfg_s_Points,authid,game,game); 
I then also ran this one to see if that would fix it, but no luck.
PHP Code:
FormatEx(Querysizeof(Query), "UPDATE hlstats_players_history SET connection_time ='0', kills ='0', deaths ='0', suicides ='0', skill ='%d', headshots ='0', kill_streak ='0', death_streak='0', skill_change ='0' WHERE playerid = ( SELECT playerid FROM hlstats_playeruniqueids WHERE uniqueid = '%s' AND game = '%s' ) AND game = '%s'",cfg_s_Points,authid,game,game); 
I then found livestats, which I think is the one making the issue, the info in this table is the stuff that is getting restored again I believe.
But running this Query dosnt help at all.
PHP Code:
FormatEx(Querysizeof(Query), "UPDATE hlstats_livestats SET kills ='0', deaths ='0', suicides ='0', headshots ='0', connected ='0', skill_change ='0', skill ='%d' WHERE player_id = ( SELECT playerid FROM hlstats_playeruniqueids WHERE uniqueid = '%s' AND game = '%s' )",cfg_s_Points,authid,game); 
Am I missing something?
Any help would be really appreciated
__________________
DoPe^ is offline
Rytis
Veteran Member
Join Date: Feb 2012
Location: Germany
Old 09-20-2013 , 09:17   Re: Reset rank plugin
Reply With Quote #2

The first one should work, because that's the same query that hlstats uses to change playerdetails.
Rytis is offline
DoPe^
Veteran Member
Join Date: Jul 2008
Location: Denmark / Copenhagen
Old 09-20-2013 , 10:46   Re: Reset rank plugin
Reply With Quote #3

Quote:
Originally Posted by Rytis View Post
The first one should work, because that's the same query that hlstats uses to change playerdetails.
Yeah exactly, it does also work.
But the issue is that somehow some of the stats get restored, and i think it's either the session stats or the livestats that does it.

I Can post a screenshot later, so you can see what I mean.
__________________
DoPe^ is offline
Root_
Veteran Member
Join Date: Jan 2012
Location: ryssland
Old 09-20-2013 , 13:07   Re: Reset rank plugin
Reply With Quote #4

Code:
FormatEx(Query, sizeof(Query), "DELETE FROM hlstats_players WHERE playerid = ( SELECT playerid FROM hlstats_playeruniqueids WHERE uniqueid = '%s' AND game = '%s' ) AND game = '%s'",authid,game,game);  FormatEx(Query, sizeof(Query), "DELETE FROM hlstats_players_history WHERE playerid = ( SELECT playerid FROM hlstats_playeruniqueids WHERE uniqueid = '%s' AND game = '%s' ) AND game = '%s'",authid,game,game);  FormatEx(Query, sizeof(Query), "DELETE FROM hlstats_livestats WHERE playerid = ( SELECT playerid FROM hlstats_playeruniqueids WHERE uniqueid = '%s' AND game = '%s' ) AND game = '%s'",authid,game,game);
__________________


dodsplugins.com - Plugins and Resources for Day of Defeat
http://twitch.tv/zadroot
Root_ is offline
DoPe^
Veteran Member
Join Date: Jul 2008
Location: Denmark / Copenhagen
Old 09-20-2013 , 14:17   Re: Reset rank plugin
Reply With Quote #5

Quote:
Originally Posted by Root_ View Post
Code:
FormatEx(Query, sizeof(Query), "DELETE FROM hlstats_players WHERE playerid = ( SELECT playerid FROM hlstats_playeruniqueids WHERE uniqueid = '%s' AND game = '%s' ) AND game = '%s'",authid,game,game);  FormatEx(Query, sizeof(Query), "DELETE FROM hlstats_players_history WHERE playerid = ( SELECT playerid FROM hlstats_playeruniqueids WHERE uniqueid = '%s' AND game = '%s' ) AND game = '%s'",authid,game,game);  FormatEx(Query, sizeof(Query), "DELETE FROM hlstats_livestats WHERE playerid = ( SELECT playerid FROM hlstats_playeruniqueids WHERE uniqueid = '%s' AND game = '%s' ) AND game = '%s'",authid,game,game);
I think I tried that.
The player will have to rejoin the server for the stats to count again.
If I remember correctly.
__________________
DoPe^ is offline
Killer0561
Member
Join Date: Apr 2011
Location: Germany, Hessen, Kassel
Old 10-12-2013 , 04:29   Re: Reset rank plugin
Reply With Quote #6

This code works?
I wanted to compile and install this plugin on my server.
Killer0561 is offline
DoPe^
Veteran Member
Join Date: Jul 2008
Location: Denmark / Copenhagen
Old 10-14-2013 , 05:22   Re: Reset rank plugin
Reply With Quote #7

Quote:
Originally Posted by Killer0561 View Post
This code works?
I wanted to compile and install this plugin on my server.
Nope, and it's not even the full code.
I did get it to reset the rank, but after a few seconds, the player would have his rank back again somehow.
__________________
DoPe^ is offline
micazoid
Veteran Member
Join Date: Oct 2010
Location: Munich - Germany
Old 10-14-2013 , 07:12   Re: Reset rank plugin
Reply With Quote #8

That is a very cool Idea Dope^

We also reset our stats once a month, so this would be very handy =)

Good Luck in tracking this Bug!
__________________
micazoid is offline
DezzY
SourceMod Donor
Join Date: Apr 2012
Location: Portugal
Old 11-07-2014 , 11:35   Re: Reset rank plugin
Reply With Quote #9

i think you have to stop hlstatsx by putty, then execute the plugin (comand) and then start again the hlstatsx

Thats how i change the point in my hlstatsx
__________________

Last edited by DezzY; 11-07-2014 at 11:35. Reason: error
DezzY is offline
Mavrick4283
Veteran Member
Join Date: Apr 2010
Location: 127.0.0.1@root
Old 11-07-2014 , 15:06   Re: Reset rank plugin
Reply With Quote #10

Quote:
Originally Posted by DoPe^ View Post
Nope, and it's not even the full code.
I did get it to reset the rank, but after a few seconds, the player would have his rank back again somehow.
That is because the Daemon stores some of the data in memory (for performance reasons),

So this plugin is not as simple as you think, as you would also have to rewrite or bolt on to the daemon some code the would force the clearing of that score.
__________________
Mavrick4283 is offline
Reply


Thread Tools
Display Modes

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 03:24.


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