AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Approved Plugins (https://forums.alliedmods.net/forumdisplay.php?f=8)
-   -   Psychostats/HLStats Rank [1.0f] [UPDATED 05/03/06] (https://forums.alliedmods.net/showthread.php?t=24012)

Fyre 02-08-2006 19:28

Psychostats/HLStats Rank [1.0f] [UPDATED 05/03/06]
 
3 Attachment(s)
If you like both Stats like me and use both you might like to have your rank shown ingame. Simply type "/rank" into the chat and you get your rank shown from HL Stats and Psychostats. This is just a combination and can be set per CVAR HL Stats only, Psychostats only or to let them show you both of them at the same time.
However you have to set up this plugin first because of 2 Databases that have to be queried with different acc|password|dbname.

WORKAROUND 1.75
Use the mysql_amxx.dll/so from Zip file below (its an older version, does not support new SQLX Functions)


Requirements
AMX Mod X 1.70 (1.60 - compatibility mode)
1.75 NOT SUPPORTED YET --- GOT TO REWRITE THE QUERIES
SQL Module

Setup

Put these cvars in your amxx.cfg
Quote:

amx_pshlstats 0 // "-1" for HL Stats only, "1" for Psychostats only, "0" for both rankings
amx_hltime 120 // show every x-seconds the hl announce
amx_hlannounce 1 // "1" ON, "0" OFF
amx_pstime 120 // show every x-seconds the ps announce
amx_psannounce 1 // "1" ON, "0" OFF
This must be added to your sql.cfg in your configs directory
Quote:

amx_sql_pshost "127.0.0.1" // the sqldb ip
amx_sql_psuser "psychostats" // psycho sql user
amx_sql_pspass "hidden" // db password
amx_sql_psdb "psychostats" // Psycho DB name
amx_sql_psprefix "pstats_" // used tableprefix in psychostats db

amx_sql_hlhost "127.0.0.1" // the sqldb ip
amx_sql_hluser "hlstats" // hlstats sql user
amx_sql_hlpass "hidden" // db password
amx_sql_hldb "hlstats" // HL Stats DB name
amx_sql_hlprefix "hlstats_" // used tableprefix in HL stats db
New in 1.0f
Linux case-sensitive in HLStats tables

Report bugs please.

Usage
Quote:

say /rank
If you use statsx plugin then use the patched statsx.sma (recompile) in the attachements
Since AMXX 1.70 you can use the default statsx plugin (both /rank calls will be shown), if you dislike that use the provided patched statsx plugin

Version History
Quote:

0.1
Initial Release
0.2
[ADDED] nonrank check
0.3
[BUGFIX] nonrank check
0.4
Cleaned code
0.5
[ADDED] amx_pshlstats CVAR
[ADDED] 2 DB support (different ip)
[CHANGED] Hardcoding to setup in "sql.cfg"
0.5b
[BUGFIX] Typo in getting Steam ID
0.6
[ADDED] HL Stats announce
0.6b
[ADDED] amx_hltime and amx_hlannounce
0.7
[BUGFIX] "/rank" call made error if only one of the stats are used
[CHANGED] Adjusted Code to AMXX 1.70
1.0
[ADDED] Psychostats announce
[ADDED] amx_pstime + amx_psannounce
[BUGFIX] closing sql links
1.0b
[CHANGED] 2 Connections only now
[BUGFIX] Cleaned Code and removed laggs
1.0c
[BUGFIX] freeing sql result handle
1.0d
[BUGFIX] lag from new ps announce
1.0e
[CHANGED] Code for backward compatibility (1.60)
1.0f
[BUGFIX] SQL Code Linux case sensitive in table [prefix]_Players and [prefix]_PlayersUniqueIds from HLStats
Line 26
Code:
// REMOVE "//" for AMXX 1.60 Support //#define SUPPORT_1_60


Todo:
Requested 1.60 backwards compatibility --- DONE. 04/28/06
Add Kills/Deaths and Ratio on HLStats say announce [Requested]
1.75 compatibility [Crashes on /rank] --- sry guys I have not much time :(
Maybe I can also fix the lag with the new functions for querying the sql server, stay tuned.

PICS
http://62.75.219.238/pshlstats.png

Lord_Destros 02-09-2006 08:47

Re: Psychostats/HLStats Rank
 
Quote:

Originally Posted by Fyre
*gotta go to bed now 01:30 am*

:lol:, gotta wake up 5:30 am

Cryonic 02-09-2006 11:31

Any screen? This sounds great =)

Fyre 02-09-2006 13:55

Updated with error msg :) and screens are available

AllMassive 02-10-2006 19:55

This sounds nice !

Question1:
What if i have both ranks on different mysql-hosts ?

Question2:
Do i have to disable any regular amxx-plugin to use your '/rank'-command ?

Fyre 02-11-2006 07:04

Question1: I thought of that, I could implent it for 2 SQL Server
Question2:
Quote:

Originally Posted by Fyre
Turn statsx.amxx off before running this plugin


The Real DeAtH07 02-11-2006 18:14

Hey, i put this on my ns 3.1.2 server and it lags the crap out of it.

Any ideas?

Fyre 02-11-2006 18:30

no not yet, it does not lag for me :) I'll look into it tomorrow
which version?
try 0.5b now it should be ok :)

Silver Dragon 03-05-2006 15:55

This is nice. Good work.

diamond-optic 03-05-2006 18:27

i was getting this

Code:

[AMXX] Run time error 10: native error (native "dbi_close")
[AMXX]    [0] psychohlstatsrank0.6b.sma::handle_rank (line 232)

but since im only using psychostats I commented out line 232 (which was like closing the hlstats db or something) and I dont get that error anymore...

Fyre 03-08-2006 14:51

This is hopefully the final version.

If it lags report to me and report me all bugs you notice.

bmann_420 03-08-2006 16:05

Any possible way of using sqlite with this by any chance?

Fyre 03-08-2006 17:56

err ?!? I remember that PS only supports MySQL and HL Stats too.
Gimme a hint what you wanna do :)

bmann_420 03-08-2006 20:53

Yea, I spaced it. Sorry :lol:

Andre86_bn 03-09-2006 19:08

I have a Problem:
Quote:

L 03/10/2006 - 01:05:52: [MYSQL] Invalid database handle 0
L 03/10/2006 - 01:05:52: [AMXX] Run time error 10 (plugin "psychohlstatsrank.amxx") - debug not enabled!
L 03/10/2006 - 01:05:52: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
and I have the new version (1.0b) :!: :!: :!:

theangel 03-10-2006 05:12

Is there a chance to get this run with AMXX1.60?

Fyre 03-10-2006 14:50

do you use both or only one of the stats? if only 1 used set amx_pshlstats correct :) otherwise try debug in plugins.ini and send me the report pls :)

I could provide one for 1.60 but wait lil until I got some time :)

Waylay 03-23-2006 03:26

Crap..You still have to have a normal psychostats first`??

Fyre 03-23-2006 11:07

what do you mean by "normal psychostats"?

Waylay 03-23-2006 12:04

Dont know what psychostats is?

Fyre 03-24-2006 12:31

You actually need one of the stats :)
Psychostats
HL Stats

vazze 03-30-2006 07:54

Fyre:

Great plugin.

Would appreciate if you could make it to work with 1.60 also.

Cant run 1.7 on my server (dont know why) gets segmentation fault all the time.

1.6 works like a charm, so i have to stick with that.

Thanks in advance

Vazze

wuerfelkater 04-01-2006 03:08

I`ve installed the Plugin and the announcemet of my Psychostats works fine.But i cant use /rank. If i use say /rank the Stats of AMXX will be shown.
I used debug and get this:
L 04/01/2006 - 10:02:45: [AMXX] Displaying debug trace (plugin "psychohlstatsrank.amxx")
L 04/01/2006 - 10:02:45: [AMXX] Run time error 10: native error (native "dbi_query")
L 04/01/2006 - 10:02:45: [AMXX] [0] php3S3xkf.sma::surroundingPlayershl (line 308)
L 04/01/2006 - 10:04:05: [MYSQL] Invalid database handle 0


My Logs are full of this error messages!

Fyre 04-01-2006 08:37

Pls look into your amx log files I think its cause of wrong prefix, if not report back pls.
Code:

amx_sql_hldb "hlstats" // HL Stats DB name
amx_sql_hlprefix "hlstats_" // used tableprefix in HL stats db

I'll do this weekend 1.60 version :)

wuerfelkater 04-01-2006 14:36

I dont use Hlstats, only Psychostats.The announce of PStats are there but if i use /rank the PStats ranking is not shown, only the normal AMXX Stats are shown!
This is what i put in autoexec.cfg :
amx_pshlstats 1 // "-1" for HL Stats only, "1" for Psychostats only, "0" for both rankings
amx_hltime 120 // show every x-seconds the hl announce
amx_hlannounce 0 // "1" ON, "0" OFF
amx_pstime 120 // show every x-seconds the ps announce
amx_psannounce 1 // "1" ON, "0" OFF


Since i don`t use Hlstats i didn`t put something for it in my sql.cfg:
amx_sql_pshost "127.0.0.1" // the sqldb ip
amx_sql_psuser "myuser" // psycho sql user
amx_sql_pspass "mypass" // db password
amx_sql_psdb "ps_stats" // Psycho DB name
amx_sql_psprefix "pstats_" // used tableprefix in psychostats db


Fyre 04-01-2006 15:15

1 Attachment(s)
"exec autoexec.cfg" put that to your amxx.cfg somehow the autoexec.cfg is not exec automatically.
I cannot reproduce your problem.
Neither do I get your error msgs.

wuerfelkater 04-01-2006 16:57

The command "exec autoexec.cfg" already exists in my amxx.cfg.
Do i have to turn the Stats.amxx off?
Update 02.04.06:
Now i dont get any error logs, but /rank is not working for me!
Announce works !!

Fyre 04-02-2006 11:09

try turning stats.amxx off
or use edited statsx.amxx

Lektor 04-02-2006 12:42

Quote:

Originally Posted by wuerfelkater
The command "exec autoexec.cfg" already exists in my amxx.cfg.
Do i have to turn the Stats.amxx off?
Update 02.04.06:
Now i dont get any error logs, but /rank is not working for me!
Announce works !!

Culd you give me stats.amxx .. Cuz I have only StatsX.amxx .. and I cant make the plugin work..

wuerfelkater 04-02-2006 16:29

O.K. i turned stats.amxx off and everything is fine now!!I don`t know if i can use statsx.amxx for my DoD Server....

@Lektor : The easiest way getting stats.amxx is downloading AmxModX v.1.70 for DoD ! ( http://www.amxmodx.org/downloads.php )

Lektor 04-02-2006 19:24

It seems to me it works ) I dont know for certain, cuz when I write /rank it says me You`are not ranked,.. what does it mean?
... there is my nickname in the psyhostats, and I have some skill ..
Why is it so?
[img]http://img315.**************/img315/6162/rank7fw.jpg[/img]

Any ideas..?

Fyre 04-03-2006 11:40

How do you log your psychostats?
by steamid?
by name?
or by IP?

CL-kraven 04-20-2006 09:33

some in-game screenshots would be really nice too ?

Fyre 04-28-2006 11:17

UPDATED Supporting now 1.60 and above, read sma for details or follow instructions from first post :) Have fun.
Screen reupped.

Bidybag 05-06-2006 05:33

Does this work for svencoop?

Fyre 05-07-2006 01:53

No I dont think so, neither hlstats nor psychostats support svencoop :(

thuNder 05-25-2006 00:11

Would it be possible to have this plugin give more details? (For HLStats)

A bit like StatsMe or StatsX:
You are ranked X out of Y, with Z kills and A deaths.

Instead of just:
You are ranked: 200

And you don't even know out of how many. =/

Thanks

[Update]
I've done it myself finally.

Code:

// Handle the say and query db(s)
public handle_rank(id)
{
        new authid[32]
        get_user_authid(id, authid, 31)
       
        if (dbquery <= 0) // HL Stats query
        {
                new tableplayers[32] = "Players"
                new tableplrids[32] = "PlayerUniqueIds"
                new hlrank, hlskill, hltotal, hlkills, hldeaths
       
                format(tableplayers, 31, "%s%s", hlstatsprefix, tableplayers)
                format(tableplrids, 31, "%s%s", hlstatsprefix, tableplrids)
       
                resulthl = dbi_query(dbconhl,"SELECT * FROM %s players, %s plruniqueid WHERE plruniqueid.uniqueId='%s' AND plruniqueid.playerId=players.playerId", tableplayers, tableplrids, authid)
       
                if (resulthl < RESULT_NONE)
                        {
                                new sqlerror[256]
                                dbi_error(dbconhl, sqlerror, 255)
                                log_amx("SELECT query error regarding table ^"%s^" and table ^"%s^" check your ^"amx_sql_hlprefix^" settings", tableplayers, tableplrids)
                                log_amx("%s", sqlerror)
                               
                                dbi_free_result(resulthl)
                        }
                else
                {
       
                        new resultcheckhl = dbi_nextrow(resulthl)
       
                        switch (resultcheckhl)
                        {
                                case 0:
                                {
                                        client_print(id, print_chat, "[HL Stats] You're not ranked yet")
                                }
               
                                default:
                                {
                                        dbi_nextrow(resulthl)
                                        hlskill = dbi_result(resulthl, "skill")
                                        hlkills = dbi_result(resulthl, "kills")
                                        hldeaths= dbi_result(resulthl, "deaths")
                               
                                        resulthl = dbi_query(dbconhl,"SELECT count(playerid) AS hlrank FROM %s WHERE skill>=%d AND hideranking=0",tableplayers, hlskill)
                                       
                                        dbi_nextrow(resulthl)
                                        hlrank = dbi_result(resulthl, "hlrank")

                                        resulthl = dbi_query(dbconhl,"SELECT count(playerid) AS hltotal FROM %s",tableplayers)
                                       
                                        dbi_nextrow(resulthl)
                                        hltotal = dbi_result(resulthl, "hltotal")


                                               
                                        client_print(id, print_chat, "* You are ranked %d of %d with %d skillpoints, %d kills and %d deaths.", hlrank, hltotal, hlskill, hlkills, hldeaths)
                                }
                        }
                        dbi_free_result(resulthl)
                }
        }

It now shows:
* You are ranked X of Y with Z skillspoints, A kills and B deaths.

deniro 05-27-2006 12:21

not work correctly on LAN server when all players have same id
"STEAM_ID_LAN"

:(

all players see their names in (periodical) HUD message ON FIRST PLACE with skill from #1 player on psyhostats.
rank #2 in HUD, name and skill are correct.
When type "/rank" stats report from psyhostats iz wrong and dont see hud message (like on attached pic at main post), i dont know why :(
(im using pached statsx.amxx)

can u add id by IP address?

im using latest AMXX on Redhat 9 Linux.

Psyfire 06-01-2006 18:27

Hello,

I followed the instructions, but i dont get anything. I type /rank but nothing will be shown. I added all into amxx.cfg and sql.cfg

amx_plugins into console shows that the plugin is running, all modules activated. I'm running Amxmodx 1.71

samalex 06-29-2006 18:04

Re: Psychostats/HLStats Rank [1.0f] [UPDATED 05/03/06]
 
dosen't work.


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

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