GCommunicate- Threaded Server to Server talk.


This addon allows threaded cross server chat with any number of servers. It also has a plugin loading system for those that would like to make plugins. This addon uses GDatabase to load, therefore requires it.

[li]A brain
[/li][li]LUA skills
[/li][li]MYSQL server(tested with MySQL version 5.0.41)
[/li][li]GDatabase v1.0 or above


1:Install GDatabase and run install modules.bat that is included with it.
2:Import gcommunicate.sql into the database of your choice with phpmyadmin(I used version 2.10.3)
3:Modify gcommunicate/lua/gcommunicate/config.lua to the settings of your SQL server(it is commented very well.)
4:Start your server. Your server will be auto-added to the Database if it doesn’t exist yet.

Spacetech: Lots Help and Testing.
Aschmack: This addon is based off of gmtalk. While some of the code was left untouched, most of the code was completely rewritten to work with gdatabase and threads. Thank you for your original creation.

gcomm_reload is the console command you can use if the shit hits the fan. This will completely reload GCommunicate

Future Releases
[li]Custom Chat menu with server to server chat colors customizable
[/li][li]Chat Filters
[/li][li]Remote RCON for Server Admins with the right permissions
[/li][li]Userlist, Allowing users to see who is currently online and what server they are on.


**THIS REQUIREs GDATABASE TO RUN! Download it here:**http://forums.facepunchstudios.com/showthread.php?p=9052208

Make sure to put libmySQL.dll(included in GDatabase) in your srcds main directory or Gdatabase WILL NOT load correctly!

[/li] [FEATURE]Added Database truncation to the last 10000 entries if the database gets over 100k.
[FEATURE]Added Database reconnect feature if the database is down when the addon initially loads.

[li]1.0- Initial Release

this… is… epic.


(User was permabanned for this post (Reason: Alt of harro223 ) [event] 48370 [/event])


Cool script. Did this with .txt files and the _file library back in gmod9. The only problem was that if a server went off it would spam the message on the other server.

What is different from Aschmack’s version?

Also, would it be possible to make this entirely clientside? I’m thinking of having a gmod-wide server chat for my guild members :wink:

Well besides from the fact that it is alot less buggy, It is also threaded which means when a query goes to the server, the whole server won’t have to wait for it to finish.

I have to think about it but, I can’t think of anyway to do this off the top of my head. I mean I could have it talk cross client to almost any client I want, but then that would just be like steam friends.

Ta :wink:

I’ll definitely have a look at making this clientside.

Also, does it truncate the table after a certain amount of lines? When I had GTalk running between two spacebuild servers, it came to around 500,000 entries after about two-three months.

No, it currently doesn’t. I’ll look into adding truncation to the script tonight.

The thing I would be concerned about is that the client would have to have access to the database in order for it to be client side. I don’t know about you but from a security standpoint, that seems kinda bad. I know from security you only give access to those who need it and no more.

Another thing I would be concerned about is that each client would make a connection to the database instead of just the server relaying the information like it currently does. To me that seems like unnecessary bandwidth, because usually the server is on the lan with the database and the client is not.


Fantastic work! I wish I could use it though :(. I have the gm_mySQL addin istalled and other addon’s requre that and I think the gmod_mySQL and GDatabase addon’s conflict.

Bit of a bummer, I’ld liked to have used this.

King’d all the same though.

GDatabase acts all weird if you have an older version of the gm_mysql installed. It needs 1.6 which is included with GDatabase. Make sure there are no other modules from 1.5 installed any where or you’ll get query errors from GDatabase but no error message.

Anything that works with 1.5 “should” work with 1.6.


GDatabase shouldn’t conflict directly with anything as I am storing all the functions in tables and I don’t touch any of the base code.

Ok yeah I was using an old version of gmod_mySQL updated to 1.6 and bingo it worked!. This is very very usfull for me and my server’s.

Really looking forward to future release’s of this! Good job man!.

Updated to v1.1. See changelog in 1st post.

Also please keep a lookout for an update to GDatabase in the near future.

Is it possible to create a .sql file for MySQL 4.0.25 ?

Because my server runs on it and the MySql 5.0.41 syntax doesn’t work on 4.0.25 :frowning:


I ran this and it worked. All I am hoping now that it’s working with GCommunicate.

-- phpMyAdmin SQL Dump
-- version 2.10.3
-- http://www.phpmyadmin.net
-- Host:
-- Generation Time: Sep 09, 2007 at 02:39 AM
-- Server version: 5.0.41
-- PHP Version: 5.2.3
-- Database: `gcommunicate`

-- --------------------------------------------------------

-- Table structure for table `chat`

  `id` int(11) NOT NULL default '0',
  `serverid` int(11) NOT NULL default '0',
  `playerid` int(11) NOT NULL default '0',
  `pname` text NOT NULL,
  `time` int(11) NOT NULL default '0',
  `chat` text NOT NULL,
  PRIMARY KEY  (`id`)
-- Dumping data for table `chat`

-- --------------------------------------------------------

-- Table structure for table `clients`

CREATE TABLE `clients` (
  `id` int(11) NOT NULL default '0',
  `name` text NOT NULL,
  `steamid` text NOT NULL,
  `ip` text NOT NULL,
  `isonline` tinyint(1) NOT NULL default '1',
  `lastseen` int(11) NOT NULL,
  `serverid` tinyint(4) NOT NULL,
  PRIMARY KEY  (`id`)

-- Dumping data for table `clients`

-- --------------------------------------------------------

-- Table structure for table `servers`

CREATE TABLE `servers` (
  `id` int(11) NOT NULL default '0',
  `ip` text NOT NULL,
  `port` text NOT NULL,
  `name` text NOT NULL,
  `isonline` tinyint(1) NOT NULL default '0',
  `lastchecked` int(11) NOT NULL,
  PRIMARY KEY  (`id`)

-- Dumping data for table `servers`

So. I’m just starting to get into MySQL and such so I may have missed something. Bear that in mind.

I’m trying to set this up between mine and another server. I have mySQL installed on the same server as the gmod one, and use a different port than 80 for my web server stuff. So, I typed in my IP plus that port in the config, where I noticed you commented saying it doesn’t work very well. Do I need to be specifying the port like this? And can I be running both servers on the same box like this?

If that all seems okay then I’m not sure whats causing it to not work. Everything on the console looks good and the server seems to be loading it okay.

Ok first I want to clarify something so I know were on the same page. A mysql server isn’t part of your web server. On my LAN I have a mysql server but no web server. The standard port for mysql servers is 3306.

That said lets move on to the config.lua settings.
[lua]gcommunicate.config.databasehost = “” – The IP address of the MySQL database goes here. I haven’t had good luck using ports.
gcommunicate.config.databaseun = “" – The username for MySQL. Needs INSERT, UPDATE, and SELECT rights on the database.
gcommunicate.config.databasepw = "
” – The password
gcommunicate.config.databasename = “gcommunicate” – The database that you just created![/lua]

These settings are used for connecting to the database. When I said I didn’t have good luck with ports. I mean’t changing the mysql servers default port, NOT the gmod server itself.

[lua]gcommunicate.config.servername = “Star System Voyage” – The name of the server. Make user this is the same as in the database!
gcommunicate.config.serverip = “” --GAME server ip
gcommunicate.config.serverport = “27017” – GAME server port[/lua]

These settings are what relate to the gmod server itself. The server port to the gmod server is put here. In this case I am posting my local server config(one of 2 on my lan on a server I built).

If your looking to use a non-standard port for sql databases then you’re going to have to wait till the next version of the gdatabase lib that this uses which will support this.

If you have any questions and want a quick response my steamid is tomato3017 as well.

Thanks for the quick reply. I actually did misunderstand a bit, I installed mysql for the purpose of a wiki. Things ended up working fine after removing the port specification, but I now realize that was because I misunderstood the seperate nature of the mysql server, thanks for that.

Anyway, its working great, I did have a question about the delay though. How can we make this faster? We both have pretty good bandwidth, if that’s an issue. We tried changing the update time in the config file to 1, that ended up spamming us both though.

Thanks for the great addon too, this has added a whole new dynamic to our servers.

The reason your getting spammed is because of the threaded nature of the update timer. I slow down the thread checker in GDatabase with.[lua]gcommunicate.config.gdatabasesettings.threadqueuetime[/lua]

I do this because for some reason with threads, if you send them too quickly then the server loses its connection to the database(and then GDatabase detects this and calls a reconnect function).

Why it is spamming you is that once you make a thread and then you make another before the old thread has been processed by gcommunicate it sends the messages to each function therefore “spamming” you. What I need to do is make a way for it to check to see if another thread is already in progress or not.(Kinda busy with other things so it might be a bit)

If you think your server can handle it set the config above to .5. Then set the messages timer to 2. That should work, in my stress testing that was too much for the dll to handle so I toned it down.

Awesome, good job, I’m looking forward to when more servers start using it.

Any server with “Tomatonet” at the beginning uses it. Right now its 3 servers but soon to be 4.

I’m going to stick this on my servers :wink:

By threaded, does it mean AndyVincent’s latest threaded MySQL module? If so, can I just rename that module so I can keep the old one and NOT re-write 30-odd scripts?