• IRC script, Hooks are not working?
    5 replies, posted
Hi guys, I'm making an irc script to relay chat messages to my irc server. I use the bromsock module to open a socket and use most of the example code already given. For some reason the hook I created is not called. I tried this from the wiki: [code] function GM:OnPlayerChat( player, strText, bTeamOnly, bPlayerIsDead ) writeline("PRIVMSG #gta.chat :NNYEEEEEESSS") print("test123") end [/code] That did not work, so I tried the normal hook way: [code] hook.Add( "PlayerSay", "PlayerSayExample", function( ply, text, team ) <function> end) [/code] I tried multiple hooks, like on spawn but it won't work :/ Then I got another problem maby they are linked. When a player connects the bot connects to the server(for some reason..) But then I get this error in my console: [code] Couldn't include file 'includes\modules\bromsock.lua' (File not found) (@addons/irc/lua/autorun/irc.lua (line 1)) [hipy|2|STEAM_0:1:44479407] Lua Error: [ERROR] addons/irc/lua/autorun/irc.lua:1: Module not found! 1. require - [C]:-1 2. unknown - addons/irc/lua/autorun/irc.lua:1 [/code] I added the bromsock dll module to garrysmod/lua/bin and that works like a charm, but I don't really get what it wants to do with this file. If I create it in the location above it won't remove the error :/ The chat commands I made also stop working after this error occurs code can be found at [url]http://pastebin.com/0pRc8VQA[/url]
Anyone?
The error is probably because the module is serverside yet the script runs also clientside because it's in the base autorun folder. [editline]22nd December 2014[/editline] To fix, put [code]if CLIENT then return end[/code] at the top, or put irc.lua in the following folder lua/autorun/server/, I prefer the latter.
I tried both but it did not work sadly. It still does not activate the hook for some reason.
I was not talking about the hook
[QUOTE=EvacX;46777928]I was not talking about the hook[/QUOTE] Ah lel, well that fixed the module error. Any toughts about the hook? I want to trigger a function when someone chats. What am I missing?
Sorry, you need to Log In to post a reply to this thread.