Usage: gms_chat_get_sendername ( n )


Returns the name o the n'th chat message. This script will return the right name even if the player that sent the message isn't online anymore.

Replies (2)

Last message on 26 Jun 2021

jose_creative on 11 Jun 2021, 15:33:21
what variable is N?
Size43 (Administrator) on 26 Jun 2021, 16:44:53
N is the index of the chat message for which you want to get the sender name. It will be a number between 0 and gms_chat_num(). The newest chat messages have the highest numbers.

If you want to draw your own chat, you'll likely want to draw, say, the 10 last messages received. You can do this with a for loop, like this:

for (var n = gms_chat_num() - 1; n >= max(gms_chat_num() - 10, 0); n -= 1) {
    var name = gms_chat_get_sendername(n), 
        message = gms_chat_get_text(n);
    // ...