View Single Post
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 08-15-2022 , 22:05   Re: [REQ] [CSGO] Player List
Reply With Quote #2

*edit 17.8.2022 Plugin topic MySQL playerlist

There maybe is plugin what do that task.
But I did not search it.


I made example/test plugin. I have not test it with lot of players.


First, in MySQL, need create table with rows manually. Plugin will not do those.

- Select or create database where you want new table
- After you selected database, go to SQL query tab page (I use PHPMyAdmin). We execute SQL queries.
- You see 3 steps of query codes in plugin source code, at top in /* comment */ section. Try use those in PHPMyAdmin sql tab page

-- 1) drop table if it exist
-- 2) create table with default values
-- 3) use for loop to add 65 rows with default values


Now you should have table called "playerlist" with 65 rows empty data (expect increment clientid value)


Add plugin configure ("playerlist") in SM database.cfg
Code:
"Databases"
{
    "driver_default"        "mysql"
    
    // When specifying "host", you may use an IP address, a hostname, or a socket file path
    
    "default"
    {
        "driver"            "default"
        "host"                "localhost"
        "database"            "sourcemod"
        "user"                "root"
        "pass"                ""
        //"timeout"            "0"
        //"port"            "0"
    }
    
    "playerlist"
    {
        "driver"            "default"
        "host"                "localhost"
        "database"            "database_test"
        "user"                "root"
        "pass"                ""
        //"timeout"            "0"
        //"port"            "0"
    }
    
    "storage-local"
    {
        "driver"            "sqlite"
        "database"            "sourcemod-local"
    }

    "clientprefs"
    {
        "driver"            "sqlite"
        "host"                "localhost"
        "database"            "clientprefs-sqlite"
        "user"                "root"
        "pass"                ""
        //"timeout"            "0"
        //"port"            "0"
    }
}
plugin new version

- NEW! This version send less amount of queries. It update necessary slots only.


plugin old version



Click image for larger version

Name:	playerlist.png
Views:	30
Size:	95.5 KB
ID:	196324


- Plugin list only human players. It updates data of each 65 rows.
- Plugin update table every 10 seconds, and stop updating when there is no human players in server.

- You can query active players, example using NULL value:
Code:
SELECT * FROM `playerlist` WHERE steamid IS NOT NULL;
- name, steamid, time are strings
clientid, score is int

- If table is some reason over 65 rows, you can do those 3 steps again to fix it.
__________________
Do not Private Message @me

Last edited by Bacardi; 08-17-2022 at 13:25. Reason: plugin link
Bacardi is offline