Jump to content

Messages not sending in chat


bituu_

Recommended Posts

4 hours ago, Ted1 said:

I have the same problem, for me is not working  even if i have setup the playerChat in server-side. Can someon help me? Thanks!

mp.events.add("playerChat", (player, message) => {
    if (message.length > 0 && message != "" && message != " " && message != "  "
        && message != "   " && message.length <= 60 && message != "    ") {
        mp.players.broadcast(`${player.name} [${player.id}]: ${message}`)
    }
});

I use this in packages not in client_packages

Daca mai ai vreo problema da-mi mesaj pe discord bituu_#4205; Am vazut ca esti roman.

Edited by bituu_
Link to comment
Share on other sites

I am literally having the SAME exact issue right now. I have a custom chat setup and it still won't work. If I kept everything default I run into the same issue. No user chat or commands work. Can't even get my error messages to appear for any unfinished command I try to execute.

 

Help!! I can't continue without this and pulling my hair out lol

 

UPDATE: I had an issue with a server event which once rectified, fixed the chat issue.

Edited by SGH
Link to comment
Share on other sites

13 hours ago, SGH said:

I am literally having the SAME exact issue right now. I have a custom chat setup and it still won't work. If I kept everything default I run into the same issue. No user chat or commands work. Can't even get my error messages to appear for any unfinished command I try to execute.

 

Help!! I can't continue without this and pulling my hair out lol

 

UPDATE: I had an issue with a server event which once rectified, fixed the chat issue.

Are you using this?

 

Link to comment
Share on other sites

Quote

let api = {"chat:push": chatAPI.push, "chat:clear": chatAPI.clear, "chat:activate": chatAPI.activate, "chat:show": chatAPI.show};

for(let fn in api)

{

      mp.events.add(fn, api[fn]);

}

Just use this code, if you have a custom chat!

Link to comment
Share on other sites

  • 2 years later...
Quote
$(document).ready(function()
{
    chat.container = $("#chat ul#chat_messages");
    hide();
    $(".ui_element").show();
    $("body").keydown(function(event)
    {
        if (event.which == 84 && chat.input == null
            && chat.active == true) {
            enableChatInput(true);
            event.preventDefault();
            show();
        }
        else if (event.which == 13 && chat.input != null) {
            var value = chat.input.children("input").val();
 
            if (value.length > 0) {
                chat.previous = value;
                if (value[0] == "/") {
                    value = value.substr(1);
 
                    if (value.length > 0 && value.length <= 100)
                        mp.invoke("command", value);
                }
                else {
                    if (value.length <= 100)
                        mp.invoke("chatMessage", value);
                }
            }
            enableChatInput(false);
            hide();
        }
        else if (event.which == 27 && chat.input != null) {
            enableChatInput(false);
            hide();
        }
        else if (event.which == 38 && chat.input != null) {
            chat.input.children("input").val(chat.previous);
        }
    });
      // Event handler for receiving chat messages
    mp.events.add("chat:push", (message) => {
        // Call the addChatMessage function to inject the message into the chat
        chatAPI.push(message);
    });
});
Edited by Andzhu
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...