OnPlayerChat

From Multi Theft Auto: Wiki
Jump to navigation Jump to search

This event is triggered when a player chats inside the chat box.

Supplied Variables

player: The player who typed the text.
message: The text that was typed.

Example

function onPlayerChat ( player, chat )
  if ( strtok ( chat, 1, 32 ) == "!createhydra" ) then
    x, y, z = getPlayerPosition ( player )
    createVehicle ( 520, x + 5, y, z )
    playerPM ( player, "You got a hydra" )
  end
end