PDA

View Full Version : AMXX Psychostats


Dr.G
04-29-2009, 01:33 PM
/* 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



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 (:


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...
*/
////////////////////////////////////////////////////////////////////////////////////////////////////

The zip file attached is screenshots, they are not up-to-date tho, the topX motd looks better now.

Bugs etc goes in this thread...

- Cheers


Public Stats (http://www.game-monitor.com/search.php?search=amx_psychostats_stats&type=variable)

Gudi01
06-13-2009, 08:51 AM
My server was running amxx-stats before i installed psycho stats and amxx psychostats. Now everything works fine, but i like to turn off the amx stats, because if i enter /rank or /topx i only see the old amxx stats.
Only /me works.

What can i do to see the psychostats ranking with /rank?

diamond-optic
06-13-2009, 01:01 PM
i think you can just use amx_statscfgmenu to turn off the amxx versions of those commands

Gudi01
06-13-2009, 02:51 PM
If i turn it off and enter /rank it says that this option is disabled on the server.

meathead
06-13-2009, 10:45 PM
I have the same problem, but it's because I turned all that stuff off in my amx stats menu, and been too lazy to turn it back on!

Dr.G
06-14-2009, 06:10 AM
try and place it before the default stats plugins in plugins.ini and pause the /rank etc ind amx_statscfgmenu

Gudi01
06-14-2009, 08:54 PM
Yes, now it works.
Thank you!

KORD_12.7
06-17-2009, 04:59 AM
If Psychostats track players by IP Address, plugin not display rank :(
And I did so, and rank began to work:

switch(unique_id_type)
{
case 1: get_user_authid(id, uniqueid, sizeof uniqueid - 1)

case 2: get_user_name(id, uniqueid, sizeof uniqueid - 1)

case 3: get_user_ip(id, uniqueid, sizeof uniqueid - 1, 1)

}

new Handle:query

if (unique_id_type == 3)
query = SQL_PrepareQuery(sqlconnect, "SELECT plr.rank, (SELECT COUNT( * ) FROM %splr AS plr WHERE plr.allowrank=1) AS ranked, d.kills, d.deaths, d.hits, plr.skill, d.accuracy FROM %sc_plr_data as d, %splr as plr, %splr_profile as pp WHERE plr.plrid=d.plrid AND plr.uniqueid=pp.uniqueid AND pp.uniqueid LIKE INET_ATON('%s') AND plr.rank>0 AND plr.allowrank=1 ORDER BY plr.rank ASC LIMIT 1", prefix, prefix, prefix, prefix, uniqueid)

else
query = SQL_PrepareQuery(sqlconnect, "SELECT plr.rank, (SELECT COUNT( * ) FROM %splr AS plr WHERE plr.allowrank=1) AS ranked, d.kills, d.deaths, d.hits, plr.skill, d.accuracy FROM %sc_plr_data as d, %splr as plr, %splr_profile as pp WHERE plr.plrid=d.plrid AND plr.uniqueid=pp.uniqueid AND pp.uniqueid='%s' AND plr.rank>0 AND plr.allowrank=1 ORDER BY plr.rank ASC LIMIT 1", prefix, prefix, prefix, prefix, uniqueid)
Please, fix source file, this plugin is amazing! Thank you.

PS
Sorry for my english :)

Dr.G
06-17-2009, 10:44 AM
Oh i forgot a '1' there. Updated, thanks! See changelog.

- Cheers

KORD_12.7
06-17-2009, 09:30 PM
Integer value of an IP address kept in Psychostats database. If (unique_id_type==3) you must slightly change your querry:

AND pp.uniqueid='%s' change to AND pp.uniqueid LIKE INET_ATON('%s')

KORD_12.7
06-20-2009, 01:15 AM
Dr.G
Can you add support of HLstats to your plugin?

Dr.G
06-20-2009, 02:29 PM
shouldnt it just be replacing the queries? Since it looks like you know something about this, fell free to fit the code to HLstats and release it or what ever. I dont use HLstats so i wont do it.