Raised This Month: $81 Target: $400
 20% 

MySQL playerlist


Post New Thread Reply   
 
Thread Tools Display Modes
Author
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Plugin ID:
8156
Plugin Version:
1.01
Plugin Category:
Statistical
Plugin Game:
Any
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Update playerlist table, name, steamid, score, time
    Old 08-16-2022 , 23:04   MySQL playerlist
    Reply With Quote #1

    MySQL plugin which keep playerlist table up-to-date. Humans only.
    Table store name, steamid, score and time
    Click image for larger version

Name:	playerlist.jpg
Views:	239
Size:	96.6 KB
ID:	196342
    - Then do what ever you like with that table, for example, make PHP page of current players.

    Rant:
    Read this!
    Before you use this plugin, if you have no clue what is MySQL, sql, PHP.

    Stop.

    Don't use this, this will be too advanced to you.




    Installation MySQL table:
    - You need manually create table with rows in MySQL, plugin won't do that for you. (I'm lazy to code that part)
    - Go phpMyAdmin and select or create database where you want new table.
    - After you selected database, go to sql tab page.
    - Use these 3 steps queries
    Code:
    	(XAMPP) MySQL PHPMyAdmin sql query steps:
    
    1)
    DROP TABLE IF EXISTS `playerlist`;
    
    2)
    CREATE TABLE `playerlist` ( `clientid` INT NOT NULL AUTO_INCREMENT ,
    `name` VARCHAR(128) NULL DEFAULT NULL ,
    `steamid` VARCHAR(128) NULL DEFAULT NULL ,
    `score` INT NOT NULL DEFAULT '0' ,
    `time` VARCHAR(15) NULL DEFAULT NULL , PRIMARY KEY (`clientid`));
    
    
    3)
    DELIMITER $$
    DROP PROCEDURE IF EXISTS test$$
    CREATE PROCEDURE test()
    BEGIN
     DECLARE count INT DEFAULT 1;
     WHILE count <= 65 DO
       INSERT INTO `playerlist` () VALUES ();
       SET count = count + 1;
     END WHILE;
    END$$
    DELIMITER ;
    
    
    CALL test();
    If you have table called playerlist and it have about 65 rows empty data, you are good to go

    Installation plugin configure:
    - Go ...addons\sourcemod\configs\databases.cfg
    - Add playerlist configure with your right database name, example
    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"
    	}
    }
    Install plugin:
    - mysqlplayerlist.smx into ...addons\sourcemod\plugins folder.

    Plugin:
    No commands
    No cvars
    No other settings


    Secrects:
    In plugin source code *.sp, you can include bots, change table name or change update delay from line
    108-110
    ...and compile your edited plugin.


    In-depth how plugin works



    Thanks to:
    AlliedModders devs, users, forum posts, API and wiki
    Other forum users plugin source codes
    Stack Overflow posts
    Google and translation
    YouTube
    Valve
    Gabe
    Microsoft, GitHub
    AMD, Intel, Nvidia
    Free Programs from internet black hole

    No thank you:
    spambots
    ads

    This plugin is just for example to all who are interested, edit and make it to own version.
    That is why it have few information stored into database table, it is not Rank plugin.


    *edit
    Dam, plugin source code not compile in this page.
    Need compile yourself
    Code:
    SourcePawn Compiler 1.11.0.6906
    Copyright (c) 1997-2006 ITB CompuPhase
    Copyright (c) 2004-2021 AlliedModders LLC
    
    Code size:         9112 bytes
    Data size:         21884 bytes
    Stack/heap size:      17520 bytes
    Total requirements:   48516 bytes
    BUG:
    - Plugin failed to get entity player_manager when server start. Fixed (1.01)
    Attached Files
    File Type: smx mysqlplayerlist.smx (6.8 KB, 45 views)
    File Type: sp Get Plugin or Get Source (mysqlplayerlist.sp - 107 views - 7.4 KB)
    __________________
    Do not Private Message @me

    Last edited by Bacardi; 08-16-2022 at 23:41. Reason: update 1.01
    Bacardi 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 07:45.


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