SendChatMessage Function Help

I’m trying to figure out the syntax of the SendChatMessage function. I have it set up in a simple addon I am making but I get the following error in console:

Incorrect Call of SendChatMessage invalid argument [1] invalid ID

This is with the following code:

function onPlayerJoining()
    print("Player Joining")
    SendChatMessage(1, "Test Message")
end

I am confused as to what “ID” it is expecting.

fixed in server version 0.43

2 Likes

That’s the answer was leaning towards also, just wanted a confirmation. Thanks for the help. hopefully, this will be fixed on the upcoming patch :wink:

After some testing I can confirm this is not functional. the SendChatMessage(ID, message) as I understood it does not work, the first slot ID, is actually the message, but it’s required to be a number, so I can only send numbers in chat.

1 Like

@Anonymous275 The wiki is not written yet. Only functions and events are listed with minimal information. I have done my research before making this post. I am new at lua but I am just here for some help…

-1 is broadcast anything above it will search for a player with that ID I would strongly recommend reading the wiki

1 Like

@Preston when using -1 I get no error but also no chat messages

The send chat message on the forums (linked below) is incorrect, the first bit is the ID of the user for it to go to, use negative 1 to send it to all users
https://wiki.beamng-mp.com/en/Scripting/functions

1 Like