message

From GTA Connected
Revision as of 19:10, 15 June 2026 by Mex (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Function Server and Client GTAIII Logo.png icon-vc.png icon-sa.png icon-iv.png Online and Offline

Available since Server 1.0.0, Client 1.0.0
void message(string message, [ int colour = COLOUR_LIME ])

The message function is used to add a message to the chat box.

When used server-side, the message is shown for all players.

When used client-side, the message is only shown for the local player.

Parameters

1) string message The message to display in the chat box.
2) int colour Optional, defaults to COLOUR_LIME. The text colour for the message.

Return

void This function doesn't return a value.

Notes

Examples

Example 1 - Lua:

message("This text is shown in the chat box.", COLOUR_GREEN)


Example 2 - JavaScript - Server-Side:

addCommandHandler("message1", (command, text, client) =>
{
    if (client.player)
    {
        message(client.name + ' is spawned!');
    }
    else
    {
        message(client.name + ' is not spawned!');
    }
});


Example 3 - JavaScript - Client-Side:

addCommandHandler("message1", (command, text) =>
{
    if (localClient.player)
    {
        message('You are spawned!');
    }
    else
    {
        message('You are not spawned!');
    }
});

Compatibility

There isn't any compatibility information for this function.

Related

Server Related

GTAIII Logo.png icon-vc.png icon-sa.png icon-iv.png message
GTAIII Logo.png icon-vc.png icon-sa.png icon-iv.png messageAllExcept
GTAIII Logo.png icon-vc.png icon-sa.png icon-iv.png messageClient


Client Related

GTAIII Logo.png icon-vc.png icon-sa.png icon-iv.png message
GTAIII Logo.png icon-vc.png icon-sa.png icon-iv.png setChatWindowEnabled