ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Server events
  3. onPlayerPrivateMessage

Event

onPlayerPrivateMessage

A player sent a private message to another player.

Handler

addEventHandler("onPlayerPrivateMessage", root, function(message, recipient) ... end)

Parameters

messagestring
The message.
recipientplayer
The recipient.

Differences from MTA:SA

  • These MTA:SA parameters are not here: string content

In MTA:SA

function(string fullMessage, player recipient, string content)

Source

source is the sender.

cancelEvent() blocks the message.

Example

addEventHandler("onPlayerPrivateMessage", root, function(message, recipient)
    outputServerLog(getPlayerName(source) .. " -> " .. getPlayerName(recipient) .. ": " .. message)
end)

See also