This is the code.
Function UpdateConsole()
Local key%
Local chatMsg$
'Local extension$ = "_"
key = GetChar()
If key >= 32 And key <= 126
chat = chat + Chr(key)
EndIf
If key = 8 Then If chat <> "" Then chat = Left(chat, Len(chat) - 1)
If key = 13 Then
'Info("<green>" + localPlayer\Name + " : " + chat)
'BP_Message (0,localPlayer\id,msgChat,chat,True)
If chat <> ""
AddTxt playername + " : " + chat
chatMsg = Chr(ID_CHAT) + playername + " : " + chat
If Online = True Then RN_Send(peer, chatMsg$, Len(chatMsg$) + 1, HIGH_PRIORITY, RELIABLE_ORDERED, 0, RN_GetSystemAddressFromIndex(peer, 0), False)
EndIf
chat = ""
Chatting = False
End If
If MilliSecs() > chattimer
If extension = "_"
extension = ""
'chattimer = MilliSecs() + 1000
ElseIf extension = ""
extension = "_"
'chattimer = MilliSecs() + 1000
EndIf
chattimer = MilliSecs() + 500
EndIf
DrawText chat + extension ,20,GraphicsHeight() - 20
End Function