# Scripting

### Structure

> > #### _canJoin(player)_
> >
> > **Parameters**:
> >
> > * player: Player attempting to join the channel.
> >
> > **Return Value**:
> >
> > * **true**: Player will be allowed to join the channel.
> > * **false**: Player will not be allowed to join the channel.
>
> > #### _onSpeak(player, type, message)_
> >
> > **Parameters**:
> >
> > * **player**: Player who is speaking.
> > * **type**: Talk type (SpeakClasses enum in const.h).
> > * **message**: Message being sent to the channel.
> >
> > **Return Value**:
> >
> > * Talk type (SpeakClasses enum in const.h)
> > * > TALKTYPE\_SAY
> >   >
> >   > TALKTYPE\_WHISPER
> >   >
> >   > TALKTYPE\_YELL
> >   >
> >   > TALKTYPE\_PRIVATE\_FROM
> >   >
> >   > TALKTYPE\_PRIVATE\_TO
> >   >
> >   > TALKTYPE\_CHANNEL\_Y
> >   >
> >   > TALKTYPE\_CHANNEL\_O
> >   >
> >   > TALKTYPE\_PRIVATE\_NP
> >   >
> >   > TALKTYPE\_PRIVATE\_PN
> >   >
> >   > TALKTYPE\_BROADCAST
> >   >
> >   > TALKTYPE\_CHANNEL\_R1
> >   >
> >   > TALKTYPE\_PRIVATE\_RED\_FROM
> >   >
> >   > TALKTYPE\_PRIVATE\_RED\_TO
> >   >
> >   > TALKTYPE\_MONSTER\_SAY
> >   >
> >   > TALKTYPE\_MONSTER\_YELL
> >   >
> >   > TALKTYPE\_CHANNEL\_R2

### Example

```lua
function canJoin(player)
	return player:getName() == "Delusion"
end

function onSpeak(player, type, message)
	-- Force orange messages no matter what in the channel
	return TALKTYPE_CHANNEL_O
end
```
