Index: scripts/usr/local/lib/7dtd/VERSION
===================================================================
--- scripts/usr/local/lib/7dtd/VERSION	(revision 61)
+++ scripts/usr/local/lib/7dtd/VERSION	(revision 62)
@@ -1,2 +1,2 @@
-Version: 20
-Release: 2014-06-20
+Version: 21
+Release: 2014-07-05
Index: scripts/usr/local/lib/7dtd/monitor-log.sh
===================================================================
--- scripts/usr/local/lib/7dtd/monitor-log.sh	(revision 61)
+++ scripts/usr/local/lib/7dtd/monitor-log.sh	(revision 62)
@@ -11,4 +11,5 @@
 INSTANCE=$1
 LOG=$(getInstancePath $INSTANCE)/output.log
+CHATLOG=$(getInstancePath $INSTANCE)/chat.log
 
 timestamp() {
@@ -19,5 +20,5 @@
 	tel=$(telnetCommand $INSTANCE lp)
 	playerline=$(echo "$tel" | tr -d '\r' | grep "id=$2,")
-	nickname=$(echo "$playerline" | sed -r 's/^.* id=[0-9]*, ([^,]*), pos=.*$/\1/')
+	#nickname=$(echo "$playerline" | sed -r 's/^.* id=[0-9]*, ([^,]*), pos=.*$/\1/')
 	steamid=$(echo "$playerline" | sed -r 's/^.*, health=[0-9]*, ([0-9]*)$/\1/')
 	
@@ -26,8 +27,8 @@
 	fi
 
-	logPlayerConnect $INSTANCE $2 $steamid $nickname
+	logPlayerConnect $INSTANCE $2 $steamid $3
 
 	for H in $(getHooksFor playerConnect); do
-		$H $INSTANCE $1 $2 $nickname $steamid
+		$H $INSTANCE $1 $2 $3 $steamid
 	done
 }
@@ -38,4 +39,12 @@
 	for H in $(getHooksFor playerDisconnect); do
 		$H $INSTANCE $1 $2 $NICKNAME $STEAMID
+	done
+}
+
+handleChat() {
+	echo "$(timestamp): $1" >> $CHATLOG
+	
+	for H in $(getHooksFor chat); do
+		$H $INSTANCE $1
 	done
 }
@@ -65,5 +74,5 @@
 			handleConnect "$playerId" "$entityId" "$playerName"
 			unset entityId playerId playerName unknown
-		fi
+		else
 		if [ -n "$(echo "$line" | grep '^Removing player with id ')" ]; then
 			playerId=$(expr "$line" : 'Removing player with id clientId=\([0-9]*\), entityId=[0-9]*$')
@@ -71,4 +80,11 @@
 			handleDisconnect "$playerId" "$entityId"
 			unset playerId entityId
+		else
+		if [ -n "$(echo "$line" | grep -E '^GMSG: .+')" ]; then
+			msg=$(expr "$line" : 'GMSG: \(.*\)$')
+			handleChat "$msg"
+			unset msg
+		fi
+		fi
 		fi
 	fi
