Raised This Month: $51 Target: $400
 12% 

AMXX Psychostats


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   ALL        Category:   Statistical       
Dr.G
Senior Member
Join Date: Nov 2008
Old 04-29-2009 , 13:34   AMXX Psychostats
Reply With Quote #1

Quote:
/* Plugin generated by AMXX-Studio */
////////////////////////////////////////////////////////////////////////////////////////////////////
/*
INFO:

If you dont have psychostats, or your webhost doesnt allow incoming traffic to your mysql server
this plugin will NOT work for you! This is graping the stats directly from the psychostats database.

Else this will make people able to:
- See there rank ingame while playing
- See the top X players on the server (X can be set by cvar, topX will show in a motd)
- See how many players that have visitet your server, how many is ranked, and how many kills there
were done in total over time...(this will also show in a motd). Note that if you are admin with
IMMUNITY flag this motd will show you the current plugin settings. Not any database info tho.
This will make its own log file where errors will be writtin. The log is found in:
$mod_dir/addons/amxmodx/logs/amx_psychostats/

There will only be one log file at any time, date and time will be listet in it. If you want a clean
log file fire "amx_psychostats_wipe_log" in your console or in the server console. If you want to
refresh the connection to the database say "amx_psychostats_refresh" in your console or in the
server console.


CVARS / ADMIN COMMAND(S):

- Plugin on / off | 1 is ON
amx_psychostats 1
- Sets how many people /topx will show -> MAX IS AROUND 15
amx_psychostats_topx 10
- Show people available commands when they join the server? | on / off | 1 is ON
amx_psychostats_join_msg 0
- Hide chat messages? | on / off | 1 is ON
amx_psychostats_hide_chat 0

- Database host name
amx_psychostats_host ""
- Database user name
amx_psychostats_user ""
- Database user password
amx_psychostats_pass ""
- Database name
amx_psychostats_name ""
- Database prefix
amx_psychostats_prefix "ps_"

- Force AMXX Psychostats to refresh db connection (console command)
amx_psychostats_refresh
- Will clean up AMXX Psychostats log file (console command)
amx_psychostats_wipe_log


SAY COMMANDS:

/me
/rank
/statsme
/topX
/serverstats


INSTALL NOTE:

Place this plugin in plugins.ini BEFORE the default stats plugins!


THANKS TO:

nepopus - > http://forums.alliedmods.net/showthread.php?t=74581
Hawk552 - > http://forums.alliedmods.net/showthread.php?t=46779
StormTropper @ www.psychostats.com for the queries
Nextra for fixing my n00b loop (:
www.dodplugins.net


CHANGELOG:

28-04-09
BETA release
29-04-09
Public release
Rewrote alot of stuff...
17-06-09
Fixed ranking by ip - thanks KORD 12.7
TopX layout changed to tables, looks way better. But serverstats still looks a bit gay. Will
be changed later...i think...
*/
////////////////////////////////////////////////////////////////////////////////////////////////////
Public stats..


- cheers
__________________

Last edited by Dr.G; 03-09-2010 at 03:32.
Dr.G is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 04-29-2009 , 13:36   Re: AMXX Psychostats
Reply With Quote #2

GJ, i cant use "no db" but sounds good
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
Nextra
Veteran Member
Join Date: Apr 2008
Location: Germany
Old 04-29-2009 , 15:39   Re: AMXX Psychostats
Reply With Quote #3

Nice. Had not enough time to look at the code indepth but instead of

PHP Code:
new const PERCENT[] = "%"

format(_,_,"%s"PERCENT
you can do

PHP Code:
format(_,_,"%%"
__________________
In Flames we trust!
Nextra is offline
Dr.G
Senior Member
Join Date: Nov 2008
Old 04-29-2009 , 16:15   Re: AMXX Psychostats
Reply With Quote #4

Thanks! yea i knew i would get some comments about that percent lol... but wtf, i took the easy way..
__________________
Dr.G is offline
stylerro
Senior Member
Join Date: Mar 2007
Old 04-29-2009 , 16:36   Re: AMXX Psychostats
Reply With Quote #5

Quote:
- Force AMXX Psychostats to refresh db connection (console command)
amx_psychostats_refresh
can u make autoupdate with cvar?
like amx_psychostats_refresh 800 (seconds)

+k
stylerro is offline
Dr.G
Senior Member
Join Date: Nov 2008
Old 04-29-2009 , 16:53   Re: AMXX Psychostats
Reply With Quote #6

Quote:
Originally Posted by stylerro View Post
can u make autoupdate with cvar?
like amx_psychostats_refresh 800 (seconds)

+k

that refresh command i kinda only made so ppl wouldnt need to restart there server more then once after installing this. It will every time someone calls one of the commands, make connection(query) to the database and after that, free it again. The connection isnt needed other then the 0.0030 seconds it takes to run the query(s). So.... no need for that ;)


Btw for those who might think "Hey it would be cool to view a Top 100!" then the answer is: Yes, but not possible. The HL engine cannot handle that big amount of text.

- cheers
__________________
Dr.G is offline
Havoc
Member
Join Date: Jul 2004
Old 05-20-2009 , 15:10   Re: AMXX Psychostats
Reply With Quote #7

Awsome plugin, will try it right away!
__________________
Havoc is offline
Send a message via ICQ to Havoc Send a message via MSN to Havoc
Dr.G
Senior Member
Join Date: Nov 2008
Old 05-20-2009 , 22:13   Re: AMXX Psychostats
Reply With Quote #8

Quote:
Originally Posted by Havoc View Post
Awsome plugin, will try it right away!

Thank you, i hope it works for ya!
__________________
Dr.G is offline
Gizmo
Senior Member
Join Date: May 2006
Location: Sweden
Old 05-21-2009 , 02:01   Re: AMXX Psychostats
Reply With Quote #9

This
PHP Code:
        if(SQL_MoreResults(query)) 
        {
            
rank SQL_ReadResult(query0)
            
ranked SQL_ReadResult(query1)
            
kills SQL_ReadResult(query2)
            
deaths SQL_ReadResult(query3)
            
hits SQL_ReadResult(query4)
            
skill SQL_ReadResult(query5)
            
accuracy SQL_ReadResult(query6)
            
            
client_print(idprint_chat"*** Your rank is %d of %d with %d kills, %d deaths, %d hits, %d skill and have %d %s accuracy"rankrankedkillsdeathshitsskillaccuracyPERCENT)
            
client_print(idprint_console"*** Your rank is %d of %d with %d kills, %d deaths, %d hits, %d skill and have %d %s accuracy"rankrankedkillsdeathshitsskillaccuracyPERCENT)
        } 
should be like this since there is only 1 result you retrive.
PHP Code:
        if(SQL_NumResults(query)) 
        {
            
rank SQL_ReadResult(query0)
            
ranked SQL_ReadResult(query1)
            
kills SQL_ReadResult(query2)
            
deaths SQL_ReadResult(query3)
            
hits SQL_ReadResult(query4)
            
skill SQL_ReadResult(query5)
            
accuracy SQL_ReadResult(query6)
            
            
client_print(idprint_chat"*** Your rank is %d of %d with %d kills, %d deaths, %d hits, %d skill and have %d %s accuracy"rankrankedkillsdeathshitsskillaccuracyPERCENT)
            
client_print(idprint_console"*** Your rank is %d of %d with %d kills, %d deaths, %d hits, %d skill and have %d %s accuracy"rankrankedkillsdeathshitsskillaccuracyPERCENT)
        } 
And this
PHP Code:
        for(new itopXi++)  
        {
            
rank SQL_ReadResult(query0)
            
SQL_ReadResult(query1namesizeof name -1)
            
kills SQL_ReadResult(query2)
            
deaths SQL_ReadResult(query3)
            
hits SQL_ReadResult(query4)
            
shots SQL_ReadResult(query5)
            
headshotkills SQL_ReadResult(query6)
            
skill SQL_ReadResult(query7)
            
accuracy SQL_ReadResult(query8)
            
onlinetime SQL_ReadResult(query9)
            
            
len += formatex(motd[len], sizeof motd -len"^n%2d %-22.22s %6d %6d %7d %8d %4d %3.0d% %3.0d%% %4.0dh"ranknamekillsdeathshitsshotsheadshotkillsskillaccuracyonlinetime)
            
            
SQL_NextRow(query)
        } 
you can change to this

PHP Code:
        while(SQL_MoreResults(query))  
        {
            
rank SQL_ReadResult(query0)
            
SQL_ReadResult(query1namesizeof name -1)
            
kills SQL_ReadResult(query2)
            
deaths SQL_ReadResult(query3)
            
hits SQL_ReadResult(query4)
            
shots SQL_ReadResult(query5)
            
headshotkills SQL_ReadResult(query6)
            
skill SQL_ReadResult(query7)
            
accuracy SQL_ReadResult(query8)
            
onlinetime SQL_ReadResult(query9)
            
            
len += formatex(motd[len], sizeof motd -len"^n%2d %-22.22s %6d %6d %7d %8d %4d %3.0d% %3.0d%% %4.0dh"ranknamekillsdeathshitsshotsheadshotkillsskillaccuracyonlinetime)
            
            
SQL_NextRow(query)
        } 
I have done alot of stuff with sqlx and i have found out that regular querys will lag the server everytime they get executed if you have more than a few players on the servers, i always use threded querys in functions that is used during gameplay, even if the mysql server is on the same computer as the gameserver you will get lag from regular querys during gameplay.

And the way to show a longer top list is to use a php webpage to show the top list in motd, then you get rid of the querys from the gameserver also since you run them in the php file, not everyone has a webserver but for those who have that is a much better solution.
__________________

Last edited by Gizmo; 05-21-2009 at 02:06.
Gizmo is offline
Dr.G
Senior Member
Join Date: Nov 2008
Old 05-24-2009 , 18:49   Re: AMXX Psychostats
Reply With Quote #10

Gizmo. I started out with something like your are posting, i changed it tho. I cant remember why, but i guess it wasnt working as it should for me.

This havent made any lag on my servers at anytime. And well since no one have posted any problems i guess there arent any. So it stays as it is now.

- Cheers
__________________
Dr.G 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 10:29.


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