Ch3ck3r Posted January 2, 2010 Share Posted January 2, 2010 Hi guys, I've scripted a resource that controls my chat. It offers normal chat that reaches just the people nearby, shout chat (reaches people a bit more far away) and out-of-character chat to chat to everybody. I want the players only to be able to chat when they are logged in. I used an event handler on the event "onPlayerChat" and cancelEvent(true) to stop them from chatting when they are not logged in. The problem is, if you press f8 and type in say Hell everybody you can chat even you are not logged in. A simple way is to set "command.say" and "command.teamsay" to false in the acl.xml. But I want these commands to work, when the players are logged in (it is the only way keybinds work properly). Is there a way to achieve this? Link to comment
50p Posted January 2, 2010 Share Posted January 2, 2010 https://wiki.multitheftauto.com/wiki/OnConsole Or add new groups to your acl.xml and add players to it... Same way admin panel works. Link to comment
CallumD Posted January 4, 2010 Share Posted January 4, 2010 I disabled non-logged in players from chatting using onPlayerChat and cancelEvent(), it also prevents them using console. The only thing it dosn't prevent is PM'ing. Although I might have a conflicting script or something. Link to comment
Ch3ck3r Posted January 4, 2010 Author Share Posted January 4, 2010 No, that's the problem, it does not disable them from chatting using console and command "say" or "teamsay". I have tested it. The simplest way i found out now is to "overwrite" the command with commandHandlers function chatFromConsole(player, command, ...) local message = table.concat({...}, " ") cancelEvent(true, "Event handled by other functions") if (command == "teamsay") then triggerEvent("onPlayerChat", player, message, 2) else triggerEvent("onPlayerChat", player, message, 1) end end addCommandHandler("say", chatFromConsole) addCommandHandler("teamsay", chatFromConsole) This cancel's the console command and triggers the normal chat handler which handles my chat output Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now