How to make chat commands not print out for people to see?
3 replies, posted
[CODE]
function PlayerSayFunc(pl, text, public)
if text == "/mycommand" then
--My code is here
end
end
hook.Add("PlayerSay", "PlayerSayHook", PlayerSayFunc);[/CODE]
So when this command is triggered, it prints the /mycommand to the chat, how can I make it so the command still runs and does everything, but it doesn't print out for people to see? Can this be done with the PlayerSay hook? Do I need a different hook? If so, what is it?
Thanks!
It's obviously not going to print anything if your only code in the if statement is "--my code is here"
Show the rest of your code.
return ""
(Or false/true, haven't really tried it, I usually just use "" seeing how that's the first example I saw on how to hide the message.)
[QUOTE=.\\Shadow};35789115]return ""
(Or false/true, haven't really tried it, I usually just use "" seeing how that's the first example I saw on how to hide the message.)[/QUOTE]
Thanks, I'll give that a shot.
[QUOTE=Hyper Iguana;35789083]It's obviously not going to print anything if your only code in the if statement is "--my code is here"
Show the rest of your code.[/QUOTE]
It is going to print /mycommand because that was typed into chat. The player said /mycommand and it is printed into chat, it also triggers the function. Do you know how the playersay hook works? You don't need to see the rest of my code because if I included it, it would have nothing to do with this.
If you insist, here it is. WardenAssigner is a seperate function that takes the player and assigns it to warden FYI.
[CODE]
function WardenSay(pl, text, public)
if text == "/warden" then
return WardenAssigner (pl);
end
end
hook.Add("PlayerSay", "wardenassign", WardenSay);
[/CODE]
[editline]1st May 2012[/editline]
Great, it worked, thanks shadow! I appreciate it.
Sorry, you need to Log In to post a reply to this thread.