Jump to navigation Jump to search
Revision as of 17:11, 4 December 2006 by DracoBlue (→Added description and all necessary stuff, fixed the example. Will check if the Event-Canceling works as it is supposed to, and will remove the InComplete-Tag then)
This event is triggered when a player chats inside the chat box.
void onPlayerChat( player tmpplayer, string message )
- player: A player element refering to the player who used the pickup
- message: A string representing the message typed into the chat
This example adds the /me command into the script. For example, if a player called Bob types "me likes pie" in console, it will display "* Bob likes pie" in the chatbox.
addEventHandler ( "onPlayerChat ", getRootElement(), "onPlayerChat" ) -- add an event handler for onPlayerChat function onPlayerChat ( player, message ) if ( strtok ( message , 1, 32 ) == "!createhydra" ) then x, y, z = getElementPosition ( player ) createVehicle ( 520, x + 5, y, z ) outputChatBox("You got a hydra",player) end end