I'm currently having an issue in my gamemode. It's really strange because I have been coding for over 4 years in Lua and never had this issue. Currently I have noticed that GM13 sometimes has issues that GM12 did not, obviously.
But for some reason if I do a hook or even override the function PlayerSay I cannot get it to work.
Anyone have any ideas as to why this function isn't being called?
I have tried MsgN("test") at the top of the function to see if it was even getting called and no output was displayed in the console.
This is in my init.lua file of my gamemode. There are no errors.
Any help will be greatly appreciated. Thank you Facepunch users.
[IMG]http://i.imgur.com/CqxsuEV.png[/IMG]
Where do you have this code? Are there any errors?
[QUOTE=ShadowRanger;41003143]Where do you have this code? Are there any errors?[/QUOTE]
Already answered.
[QUOTE=noaheroufus;41003105]This is in my init.lua file of my gamemode. There are no errors.[/QUOTE]
try running ServerLog without self:
Not sure if that will fix it, but worth a shot.
[QUOTE=PaellaPablo;41003201]try running ServerLog without self:
Not sure if that will fix it, but worth a shot.[/QUOTE]
ServerLog is overwritten in my gamemode. I've tried commenting it out.
I quickly made up something like yours and it worked fine to me so I'm guessing its something to do with your overwriting part?
[CODE]function GM:PlayerSay(ply, text, tOnly)
if tOnly then
ServerLog(ply:Nick() .. " says (TEAM) " .. text)
else
ServerLog(ply:Nick() .. " says " .. text)
end
return text
end[/CODE]
Did you check if the function was overwritten.
I wrote a function GM:ServerLog(txt). That's why I'm using it. It logs to a file and prints to console. It runs fine throughout the rest of my gamemode.
No matter what I do to the PlayerSay hook(override or hook.Add), I cannot get it to run. There are absolutely no errors/warnings.
[QUOTE=zzaacckk;41003571]Did you check if the file was overwritten.[/QUOTE]
What do you mean?
[QUOTE=noaheroufus;41003581]What do you mean?[/QUOTE]
I meant to say function sorry.
[QUOTE=zzaacckk;41003587]I meant to say function sorry.[/QUOTE]
You were absolutely right. It happened to be an addon that was overwriting it. Removed and fixed. Thanks!
Sorry, you need to Log In to post a reply to this thread.