1. Post #1
    suicide_bomb's Avatar
    April 2007
    24 Posts
    As seen in key G-mod communities, you can now chat across multiple servers using this MySQL based script

    [release]
    Information:
    This is a customizable addon using andyvincent's MySQL module to transmit chat messages over multiple servers.

    Features:
    [list][*] Customizable refresh rate (how often to recieve new messages from the MySQL)[*] Customizable table deletion time (How often to purge the MySQL table of all messages, to reduce lag and large queries)[*] Anti-Flood (Or anti-spam) with a time setting[*] Countless other script traits and variables I could define as a *feature* ?[/list][/release]
    [release]
    This requires your own MySQL Database to use.
    This will not work without the gm_mysql module (http://forums.facepunchstudios.com/s...d.php?t=241247)


    :siren: This does NOT create a huge chat room with every server running it, nor does it replace normal chat. This is an optional global chat (Used by typing /g <message> by default) used between either multiple servers you own, or between you and other G-mod servers of your choice :siren:
    [/release]
    [release]
    Installation:
    Extract the globalchat folder to garrysmod \ addons

    Navigate to and open the globalchat \ lua \ autorun \ server \ chat.lua file. You need to edit the MySQL data to your database, and other variables as shown below:

    -- Variables --
    local serverName = "Server X"   --Name of the server to be displayed in the chat
    local trigger    = "/g"         --Trigger to send the global chat
    local antiflood  = 30           --How often a client can send a global chat (0 to disable, NOT reccomended)
    
    -- MySQL  Variables --
    local host        = "localhost" --Host address
    local user        = "username"  --MySQL Username
    local pass        = "password"  --MySQL  Password
    local database    = "chat"      --Database used to store the chat table
    local port        = 3306        --Port to connect to
    local persistent  = true        --Use a persistant MySQL  connection?
    local updatetime  = 30          --In Seconds, how often to get messages from the MySQL  
    local cleantime   = 10          --In MINUTES, how often to delete all records from MySQL table (To prevent the table from growing too large)
    The table structure is found in the chat.lua file or here:

    Table structure
    CREATE TABLE `chat` (
    `message` text NOT NULL,
    `location` text NOT NULL,
    `id` int(11) NOT NULL auto_increment,
    PRIMARY KEY (`id`)
    )
    [/release]
    [release]
    Screenshots
    Not too much to take a screenshot of..

    contrasting local to global chat


    Anti-flood

    [/release]
    [release]
    Download:


    Current version: 1.0.1
    [/release]
    [release]
    Changelog
    Code:
    [list][*] Version 1.0.1 Fixed messages not outputting when another server clears the table[*] Version 1.0 Fixed small problem with the substring not calculating for a longer trigger (More characters that is) [*] Version 1.0 first release[/list]
    [/release]

    I use MySQL as opposed to sockets to do the communication between servers for ease and expandability. Instead of having to edit the file in every server when adding another, the new server simply has to connect to the existing MySQL database. (And well, to be honest, I don't know where to start with sockets)


    :siren: Please report any bugs here :siren:

  2. Post #2
    sgt moody's Avatar
    February 2007
    10 Posts
    yay its finally here! it reminds me of war of the servers
    Reply With Quote Edit / Delete Reply United Kingdom Show Events Agree Agree x 4 (list)

  3. Post #3
    suicide_bomb's Avatar
    April 2007
    24 Posts
    1.0.1 Released (That was quick eh)
    Code:
    [list][*]Version 1.0.1 Fixed messages not outputting when another server clears the chat[/list]
    See OP for download

  4. Post #4
    Gold Member
    Looter's Avatar
    July 2005
    550 Posts
    Seems like it'd lag insanely.

    Try making one with sockets, seems like it'd be more efficient.
    Reply With Quote Edit / Delete Reply United States Show Events Dumb Dumb x 1 (list)

  5. Post #5
    Ketchupy's Avatar
    June 2007
    32 Posts
    Cool idea, although i wish it would work with css or even all Source games :P Could you do it with microphones aswell?
    Good job so far!

  6. Post #6
    suicide_bomb's Avatar
    April 2007
    24 Posts
    Looter posted:
    Seems like it'd lag insanely.

    Try making one with sockets, seems like it'd be more efficient.
    It only updates every x seconds (30 default), so it wouldn't lag as if it was a constant query


    I was actually thinking about making a socket version. I went with MySQL just to make it easier for the average person to use (If they can get MySQL working correctly that is)

    I'll work on making a socket version of this script.

    Ketchupy posted:
    Cool idea, although i wish it would work with css or even all Source games :P Could you do it with microphones aswell?
    Good job so far!
    Microphones would be a whole new ballgame.

    And compatibility with all Source games might not be out of the question (TF2 and CS:S if nothing else, as these are the most popular)

  7. Post #7
    Gold Member
    Looter's Avatar
    July 2005
    550 Posts
    Thanks, a socket version would be great.

  8. Post #8
    Internet Detective (HBIED certified)
    leach139's Avatar
    August 2007
    7,215 Posts
    I <3 you

  9. Post #9
    suicide_bomb's Avatar
    April 2007
    24 Posts
    Some screenshots (As if they were needed?)




    Not really much else to take a screenshot of.

  10. Post #10
    Gold Member
    Ixius's Avatar
    October 2005
    240 Posts
    Awesome work.

  11. Post #11
    Dennab
    January 2008
    355 Posts
    Cool.

  12. Post #12
    suicide_bomb's Avatar
    April 2007
    24 Posts
    Update: Still pretty much stuck at the gate for a socket version, Haven't had much experience with sockets so don't really know where to start. Anyone who could help with sockets, or how to use them, security factors that should be considered, etc, please feel free (And please do) contact me. My steam profile page is: https://steamcommunity.com/id/suicidebomber , you should be able to add me through there.

    Any other hints, suggestions or comments would be highly appreciated

  13. Post #13
    Gold Member
    ZpankR's Avatar
    September 2006
    588 Posts
    It would be rather awesome if someone could explain how to set up a MySQL Database without having too much work.

  14. Post #14
    SaucyWiggles's Avatar
    July 2008
    65 Posts
    Awesome idea!
    :D

  15. Post #15
    Hates php
    high's Avatar
    May 2006
    2,415 Posts
    you should instead have global chat hooked through an irc channel. So it can be more instant :D.

  16. Post #16
    Facepunch iSeries!
    rieda1589's Avatar
    November 2007
    4,363 Posts
    I use this on my 2 servers :)

    Works great!

  17. Post #17
    bph192's Avatar
    February 2008
    1 Posts
    I think i have see this addon on another server its ace.
    I have been searching for ways to get garrysmod chat on to my website and then i found "Web Interface for GlobalChat" so i downloaded it and setup a database (i don't know mysql lol) but i got the web interface working. I edited the lua files so the server knows the IP,user,pass and database.

    I can't get your addon to work :S

    I don't know if it is my bad luck the addon or gm_mysql.

    please help

  18. Post #18
    Gold Member
    HubmaN V2's Avatar
    November 2007
    885 Posts
    Hmm, sounds nice. I think there's a plugin by FLOOR_MASTER that implements it via SourceMod - I'll have to see which one is more efficient.

  19. Post #19
    Baaleos's Avatar
    July 2008
    261 Posts
    @suicide_bomb - I have done this server -> server chat with my Modified Fairy Addon, and found that if you do the sql connection per player, will cause mixed results lag wise.


    If you think of it logically, the laggiest part of mysql is the initial connection.

    Send Username
    Send Password
    Send Databasename
    Send Table
    Send query
    Get Result

    and if you are doing this per a player, even if on a timer, you can end up with 3 or 4 queries going off in a row, or even at same time... (And if this is using gdatabase, you need to make sure that the Database connection variable is unique, otherwise another players connection to db will fail if that variable name exists already.)

    The way I got around this was to open 1 connection for the server, and just keep it open, and every 6 or 7 seconds, for each player, query to see if there are any messages for that specific player, if not, do nothing, if there is, send them the message.

    Means that no matter how many players join, the queries are all going off at a fixed time, and there will never be more than one connection per server.

    (My fairy network is slightly different, in that I have provided a MYSQL database as a central repository, for all users to use, accross all servers that the addon gets installed on.)

  20. Post #20
    bob builder's Avatar
    September 2008
    53 Posts
    This would be great if it wasn't deleted...can you post a mirror?

  21. Post #21
    Gold Member
    imadaman's Avatar
    August 2008
    10,925 Posts
    Oh ancients somewhere, ze bump! ZE BUMP!
    You just had to do it eh? :smug:

  22. Post #22
    insert long title here
    SEKCobra's Avatar
    January 2009
    15,143 Posts
    I want it too D:

  23. Post #23

    July 2009
    350 Posts
    I will try and contact him as i think i have him on steam

  24. Post #24
    infinitywrai's Avatar
    December 2007
    539 Posts
    Although I know very well how to do this myself I'd like to see your work, but it appears not to be online.

  25. Post #25
    Kempers's Avatar
    September 2009
    59 Posts
    Constantly polling a mysql db for the latest messages is terrible, this should be rewritten utilizing the sockets module and shit.
    Reply With Quote Edit / Delete Reply United States Show Events Agree Agree x 2 (list)

  26. Post #26
    Infinity1995's Avatar
    August 2009
    959 Posts
    This great.

    LINK IS BROKEN WE NEED A NEW ONE NAOW
    Reply With Quote Edit / Delete Reply United Kingdom Show Events Agree Agree x 1Dumb Dumb x 1 (list)

  27. Post #27
    lilezek's Avatar
    February 2009
    209 Posts
    Anyone have this script? Or anyone knows if there is any script of sockets global chat? Thanks.

  28. Post #28
    Gold Member
    LuaStoned's Avatar
    September 2007
    1,356 Posts
    I'm currently recoding this without mysql. Release date should be tomorrow.

  29. Post #29
    bob builder's Avatar
    September 2008
    53 Posts
    Neat, how do you do that without mysql? (if it is super complicated don't tell me ;)

  30. Post #30
    yahan's Avatar
    January 2008
    445 Posts
    I'm currently recoding this without mysql. Release date should be tomorrow.
    That sounds crazy. Insane

  31. Post #31
    Salads's Avatar
    November 2008
    176 Posts
    Neat, how do you do that without mysql? (if it is super complicated don't tell me ;)
    Packets.

  32. Post #32
    Gold Member
    LuaStoned's Avatar
    September 2007
    1,356 Posts
    Well, I working on it today and finished the serverside part, but I will release it together with a clientside only one (All clients that are currently using it will be able to chat with each other.)

  33. Post #33
    Infinity1995's Avatar
    August 2009
    959 Posts
    Don't make it complicated for us, we want a simple chat between 2 servers

    please release that first

    then release the clientside stuff

  34. Post #34
    bob builder's Avatar
    September 2008
    53 Posts
    I have a global chat module, but it copies EVERYTHING in chat to all servers, and that is a bit spammy, so I wanted a chat module where you could type /g or /global or use "u" for global instead of team

  35. Post #35
    Gold Member
    Saint Devil's Avatar
    January 2009
    227 Posts
    Can we have that module :3

  36. Post #36

  37. Post #37
    Gold Member
    Saint Devil's Avatar
    January 2009
    227 Posts
    Oh boy. Thanks :D

  38. Post #38
    Gold Member
    slayer3032's Avatar
    November 2007
    3,466 Posts
    I'm currently recoding this without mysql. Release date should be tomorrow.
    Thank you, using MySQL for Global Chat is retarded.

    It will work with more than two servers correct?
    Reply With Quote Edit / Delete Reply United States Show Events Dumb Dumb x 2 (list)

  39. Post #39
    bob builder's Avatar
    September 2008
    53 Posts
    I hope it will, I have many servers I want to implement this one ;) One advantage of using MySQL is for logs...I love logs :)

  40. Post #40
    Gold Member
    LuaStoned's Avatar
    September 2007
    1,356 Posts
    Thank you, using MySQL for Global Chat is retarded.

    It will work with more than two servers correct?
    It works with how much you want it to work :V