• Custom Chat Notifications
    13 replies, posted
Sooo, only 1 question, how do I make chat notifications like in ULX? For example, I want to send message like [Notification] We hope you like this server! How do I make it text by the time like every 5 mins or something like that?
Thanks.
Assuming you want to make a chat notification.. Then chat.AddText would be a better choice than PrintMessage if you want it completely clientsided. It also allows you to add colors to your chat notifications.
So, I made a config file and notification file, but messages won't come. Do I need to use a hook or something? Main code https://files.facepunch.com/forum/upload/253850/40279ea3-3421-4cc1-87e9-99467e8e519c/Screenshot_490.png Config file https://files.facepunch.com/forum/upload/253850/f0964552-9ed1-4ab1-a73a-5fb7fb93b5eb/Screenshot_489.png
So, it worked, I made a complete addon and uploaded it to workshop, thanks to all who helped me. But at the start of game I get lua error every time message is being printed, this happens only once, after it works without errors. How do I fix it? Error: [ERROR] addons/erlux_notifications/lua/autorun/cl_notifications.lua:17: attempt to index global 'chat' (a nil value)   1. unknown - addons/erlux_notifications/lua/autorun/cl_notifications.lua:17 Timer Failed! [Message3][@addons/erlux_notifications/lua/autorun/cl_notifications.lua (line 16)]
Chat library doesn't exist on server-side
So I just need to put code inside if SERVER then end Right?
No, because chat does not exist on the server.
How then?
Why would you upload something full of errors to the workshop? Also, how do you expect people to edit the config file if they'd have to decompress the file to do that? Make a timer and place the "chat.AddText" method inside, then put it in the following lua/autorun/client/custom_chat_notification_cl_init.lua Don't use a hook to create it constantly, I mean it's like you can't even be bothered to think logically mate, why would it make sense to use a think hook which constantly runs to create a timer? All you're doing is overriding the same timer.
Hook was edited to Intialize and it works great, I'll try to edit code after.
Great contribution, thanks!
Thanks, putting file in client folder worked, no errors appear.
Sorry, you need to Log In to post a reply to this thread.