I have tried making a Garry's Mod lua file to look for messages containing "/discord" at the beginning of them and save that message as a text file in the same directory, I'm not familliar to lua files so I am unsure of syntax but when I look at console, nothing happens, when I look at the server command line, nothing happens and no new file is created, I even serached my entire PC.
I used the following page on the Garry's mod wiki: https://wiki.garrysmod.com/page/GM/PlayerSay and the code given there works but as soon as I added anything, it stopped working completely. Here is my code:
hook.Add( "PlayerSay", "GmodToDiscord", function( player, text, team )
if ( string.sub( string.lower( text ), 0, 7 ) == "/discord" ) then -- Makes message lowercase to be read by the program.
local file = io.open("message.txt", "w") -- Opens a text file in write mode.
file:write(message) -- Pastes in the message.
file:close() -- Closes the text file.
end
end)
Any help would be greatly appreciated.