RSSy MYGO.pl Opublikowano Sierpień 17, 2022 o 02:04 RSSy Udostępnij Opublikowano Sierpień 17, 2022 o 02:04 MySQL plugin which keep playerlist table up-to-date. Humans only. Table store name, steamid, score and time Attachment 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 :up: 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 - This plugin automatically connect and disconnect to database, depends is there players in server. Plugin load and player_connect event start database connection. Disconnect when no players in server or unload plugin. - Plugin update table every 10 seconds, when there are players in server. Plugin keep track and update only necessary player slots, sending less queries to database. - Plugin only updates playerlist table clientid rows. Not remove or insert values. When player slot is empty in server, plugin set DEFAULT values to that clientid row in table. - If you get later trouble with playerlist table, repeat those 3 steps (query codes at top of post) - Player score is taken from entity *player_manager "m_iScore". Most games have this entity, but I don't know is it supported in all games. 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 Thumbnails Attached Files mysqlplayerlist.smx (6.8 KB) Get Plugin or Get Source (mysqlplayerlist.sp - 7.4 KB) Wyświetl pełny artykuł Odnośnik do komentarza Udostępnij na innych stronach Więcej opcji udostępniania...
Rekomendowane odpowiedzi