Index: /scripts/usr/local/lib/7dtd/VERSION
===================================================================
--- /scripts/usr/local/lib/7dtd/VERSION	(revision 86)
+++ /scripts/usr/local/lib/7dtd/VERSION	(revision 87)
@@ -1,2 +1,4 @@
-Version: 31
-Release: 2014-07-17
+Version: 32
+Release: 2014-07-19
+DediBuild: 320404
+
Index: /scripts/usr/local/lib/7dtd/commands/updateengine.sh
===================================================================
--- /scripts/usr/local/lib/7dtd/commands/updateengine.sh	(revision 86)
+++ /scripts/usr/local/lib/7dtd/commands/updateengine.sh	(revision 87)
@@ -42,4 +42,5 @@
 	local LOCAL=$(getLocalEngineVersion)
 	local REMOTE=$(getRemoteEngineVersion)
+	local LOCAL_SUPPORTED_BUILD=$(cat /usr/local/lib/7dtd/VERSION | grep "DediBuild" | cut -d\  -f2)
 
 	if [ "$FORCED" = "yes" -o $REMOTE -gt $LOCAL ]; then
@@ -48,5 +49,12 @@
 		echo "Available buildid: $REMOTE"
 		echo
-		
+
+		if [ "$LOCAL_SUPPORTED_BUILD" != "$REMOTE" ]; then
+			echo "WARNING!!! The currently installed version of the scripts do not support the newer dedicated server build!"
+			echo "If you continue you might not be able to start the server."
+			echo "Please wait for an updated release of the scripts or continue at your own risk."
+			echo
+		fi
+	
 		while : ; do
 			local CONTINUE
@@ -70,7 +78,14 @@
 
 		cp $SDTD_BASE/linux_files/engine/* $SDTD_BASE/engine/ -R
+		cp /usr/local/lib/7dtd/server-fixes/* $SDTD_BASE/engine/7DaysToDie_Data/Managed/
 		cp $SDTD_BASE/engine/Install/32bit/SteamworksManaged.dll $SDTD_BASE/engine/7DaysToDie_Data/Managed/
 
 		chown $SDTD_USER.$SDTD_GROUP -R $SDTD_BASE/engine
+
+		if [ "$LOCAL_SUPPORTED_BUILD" != "$REMOTE" ]; then
+			echo
+			echo "Also update the scripts as soon as there is a new release for this dedicated server build."
+			echo
+		fi
 	else
 		echo "Engine is already at the newest build (local: $LOCAL, remote: $REMOTE)."
Index: /scripts/usr/local/lib/7dtd/commands/updatescripts.sh
===================================================================
--- /scripts/usr/local/lib/7dtd/commands/updatescripts.sh	(revision 86)
+++ /scripts/usr/local/lib/7dtd/commands/updatescripts.sh	(revision 87)
@@ -6,4 +6,8 @@
 	local LOCAL=$(cat /usr/local/lib/7dtd/VERSION | grep "Version" | cut -d\  -f2)
 	local REMOTE=$(wget -qO- http://illy.bz/fi/7dtd/VERSION | grep "Version" | cut -d\  -f2)
+	
+	local LOCAL_BUILD=$(getLocalEngineVersion)
+	local LOCAL_SUPPORTED_BUILD=$(cat /usr/local/lib/7dtd/VERSION | grep "DediBuild" | cut -d\  -f2)
+	local REMOTE_SUPPORTED_BUILD=$(wget -qO- http://illy.bz/fi/7dtd/VERSION | grep "DediBuild" | cut -d\  -f2)
 	
 	local FORCED
@@ -15,10 +19,16 @@
 	if [ "$FORCED" = "yes" -o $REMOTE -gt $LOCAL ]; then
 		echo "A newer version of the scripts is available."
-		echo "Local:     v.$LOCAL"
-		echo "Available: v.$REMOTE"
+		echo "Local:     v.$LOCAL (supported dedi build: $LOCAL_SUPPORTED_BUILD)"
+		echo "Available: v.$REMOTE (supported dedi build: $REMOTE_SUPPORTED_BUILD)"
 		echo
 		echo "Please check the release notes before continuing:"
 		echo "  https://7dtd.illy.bz/wiki/Release%20Notes"
 		echo
+		
+		if [ "$LOCAL_BUILD" != "$REMOTE_SUPPORTED_BUILD" ]; then
+			echo "NOTE: The newer scripts are made for a more recent build ($REMOTE_SUPPORTED_BUILD) of the dedicated server than you are running ($LOCAL_BUILD)!"
+			echo "You will have to update the engine after updating to those new scripts!"
+			echo
+		fi
 		
 		while : ; do
@@ -52,4 +62,9 @@
 		chmod 0755 /usr/local/lib/7dtd -R
 		
+		if [ -e $SDTD_BASE/engine/7DaysToDie_Data/Managed ]; then
+			cp /usr/local/lib/7dtd/server-fixes/* $SDTD_BASE/engine/7DaysToDie_Data/Managed/
+			chown $SDTD_USER.$SDTD_GROUP -R $SDTD_BASE/engine/7DaysToDie_Data/Managed/
+		fi
+
 		echo "Update done."
 		echo
@@ -58,4 +73,9 @@
 		echo "were new files added to the user folder /home/sdtd those changes"
 		echo "have not been applied!"
+
+		if [ "$LOCAL_BUILD" != "$REMOTE_SUPPORTED_BUILD" ]; then
+			echo
+			echo "Please do now update the engine by running '7dtd.sh updateengine'"
+		fi
 	else
 		echo "Scripts are already at the newest version (v.$LOCAL)."
Index: /scripts/usr/local/lib/7dtd/monitor-log.sh
===================================================================
--- /scripts/usr/local/lib/7dtd/monitor-log.sh	(revision 86)
+++ /scripts/usr/local/lib/7dtd/monitor-log.sh	(revision 87)
@@ -12,4 +12,5 @@
 LOG=$(getInstancePath $INSTANCE)/logs/$(date '+%Y-%m-%d_%H-%M-%S')_output.log
 CHATLOG=$(getInstancePath $INSTANCE)/logs/$(date '+%Y-%m-%d_%H-%M-%S')_chat.log
+COMMANDLOG=$(getInstancePath $INSTANCE)/logs/$(date '+%Y-%m-%d_%H-%M-%S')_commandExecution.log
 
 timestamp() {
@@ -18,25 +19,25 @@
 
 handleConnect() {
-	tel=$(telnetCommand $INSTANCE lp)
-	playerline=$(echo "$tel" | tr -d '\r' | grep "id=$2,")
-	#nickname=$(echo "$playerline" | sed -r 's/^.* id=[0-9]*, ([^,]*), pos=.*$/\1/')
-	steamid=$(echo "$playerline" | sed -r 's/^.*, health=[0-9]*, ([0-9]*)$/\1/')
+	local clientId="$1"
+	local entityId="$2"
+	local name="$3"
+	local steamId="$4"
+	local ip="$5"
 	
-	if [ -z "$steamid" ]; then
-		return
-	fi
-
-	logPlayerConnect $INSTANCE "$2" "$steamid" "$3"
+	logPlayerConnect $INSTANCE "$entityId" "$name" "$steamId" "$ip"
 
 	for H in $(getHooksFor playerConnect); do
-		$H $INSTANCE "$1" "$2" "$3" "$steamid"
+		$H $INSTANCE "$clientId" "$entityId" "$name" "$steamId" "$ip"
 	done
 }
 
 handleDisconnect() {
-	logPlayerDisconnect $INSTANCE "$2"
+	local clientId="$1"
+	local entityId="$2"
+
+	logPlayerDisconnect $INSTANCE "$entityId"
 
 	for H in $(getHooksFor playerDisconnect); do
-		$H $INSTANCE "$1" "$2" "$NICKNAME" "$STEAMID"
+		$H $INSTANCE "$clientId" "$entityId" "$NICKNAME" "$STEAMID"
 	done
 }
@@ -50,4 +51,27 @@
 }
 
+handleRemoteCommand() {
+	local cmd="$1"
+	local name="$2"
+	
+	echo "$(timestamp): Player \"$name\" executed \"$cmd\"" >> $COMMANDLOG
+
+	for H in $(getHooksFor remoteCommand); do
+		$H $INSTANCE "$cmd" "$name"
+	done
+}
+
+handleTelnetCommand() {
+	local cmd="$1"
+	local ip="$2"
+
+	echo "$(timestamp): Telnet from \"$ip\" executed \"$cmd\"" >> $COMMANDLOG
+
+	for H in $(getHooksFor telnetCommand); do
+		$H $INSTANCE "$cmd" "$ip"
+	done
+}
+
+
 if [ ! -d "$(getInstancePath $INSTANCE)/logs" ]; then
 	mkdir "$(getInstancePath $INSTANCE)/logs"
@@ -60,4 +84,11 @@
 echo "Starting instance $INSTANCE at $(timestamp)" >> $LOG
 echo >> $LOG
+
+rm $(getInstancePath $INSTANCE)/logs/current_output.log
+rm $(getInstancePath $INSTANCE)/logs/current_chat.log
+rm $(getInstancePath $INSTANCE)/logs/current_commandExecution.log
+ln -s $LOG $(getInstancePath $INSTANCE)/logs/current_output.log
+ln -s $CHATLOG $(getInstancePath $INSTANCE)/logs/current_chat.log
+ln -s $COMMANDLOG $(getInstancePath $INSTANCE)/logs/current_commandExecution.log
 
 sleep 5
@@ -73,13 +104,16 @@
 	if [ -n "$line" ]; then
 		echo "$(timestamp): $line" >> $LOG
-		if [ -n "$(echo "$line" | grep '^RequestToSpawnPlayer:')" ]; then
-			entityId=$(expr "$line" : 'RequestToSpawnPlayer: \([0-9]*\), [0-9]*, .*, [0-9]*$')
-			playerId=$(expr "$line" : 'RequestToSpawnPlayer: [0-9]*, \([0-9]*\), .*, [0-9]*$')
-			playerName=$(expr "$line" : 'RequestToSpawnPlayer: [0-9]*, [0-9]*, \(.*\), [0-9]*$')
-			unknown=$(expr "$line" : 'RequestToSpawnPlayer: [0-9]*, [0-9]*, .*, \([0-9]*\)$')
+		#Player connected, clientid=[0-9]*, entityid=[0-9]*, name=.*, steamid=[0-9]*, ip=[0-9.]*$
+		if [ -n "$(echo "$line" | grep '^Player connected,')" ]; then
+			clientId=$(expr "$line" : 'Player connected, clientid=\([0-9]*\), entityid=[0-9]*, name=.*, steamid=[0-9]*, ip=[0-9.]*$')
+			entityId=$(expr "$line" : 'Player connected, clientid=[0-9]*, entityid=\([0-9]*\), name=.*, steamid=[0-9]*, ip=[0-9.]*$')
+			playerName=$(expr "$line" : 'Player connected, clientid=[0-9]*, entityid=[0-9]*, name=\(.*\), steamid=[0-9]*, ip=[0-9.]*$')
+			steamId=$(expr "$line" : 'Player connected, clientid=[0-9]*, entityid=[0-9]*, name=.*, steamid=\([0-9]*\), ip=[0-9.]*$')
+			ip=$(expr "$line" : 'Player connected, clientid=[0-9]*, entityid=[0-9]*, name=.*, steamid=[0-9]*, ip=\([0-9.]*\)$')
 			sleep 1
-			handleConnect "$playerId" "$entityId" "$playerName"
-			unset entityId playerId playerName unknown
+			handleConnect "$clientId" "$entityId" "$playerName" "$steamId" "$ip"
+			unset clientId entityId playerName steamId ip
 		else
+		#Removing player with id clientId=[0-9]*, entityId=[0-9]*$
 		if [ -n "$(echo "$line" | grep '^Removing player with id ')" ]; then
 			playerId=$(expr "$line" : 'Removing player with id clientId=\([0-9]*\), entityId=[0-9]*$')
@@ -88,8 +122,25 @@
 			unset playerId entityId
 		else
+		#GMSG: .*$
 		if [ -n "$(echo "$line" | grep -E '^GMSG: .+')" ]; then
 			msg=$(expr "$line" : 'GMSG: \(.*\)$')
 			handleChat "$msg"
 			unset msg
+		else
+		#Executed command ".*" from player ".*"$
+		if [ -n "$(echo "$line" | grep '^Executed command ')" ]; then
+			cmd=$(expr "$line" : 'Executed command "\(.*\)" from player ".*"$')
+			nick=$(expr "$line" : 'Executed command ".*" from player "\(.*\)"$')
+			handleRemoteCommand "$cmd" "$nick"
+			unset cmd nick
+		else
+		#Telnet executed ".*" from: .*$
+		if [ -n "$(echo "$line" | grep '^Telnet executed ')" ]; then
+			cmd=$(expr "$line" : 'Telnet executed "\(.*\)" from: .*$')
+			ip=$(expr "$line" : 'Telnet executed ".*" from: \(.*\)$')
+			handleTelnetCommand "$cmd" "$ip"
+			unset cmd ip
+		fi
+		fi
 		fi
 		fi
Index: /scripts/usr/local/lib/7dtd/playerlog.sh
===================================================================
--- /scripts/usr/local/lib/7dtd/playerlog.sh	(revision 86)
+++ /scripts/usr/local/lib/7dtd/playerlog.sh	(revision 87)
@@ -24,4 +24,6 @@
 		-u "/Players/Player/@online" -v "false" \
 		"$PLAYERSXML"
+	rm $(getInstancePath $INSTANCE)/logs/current_players.log
+	ln -s $PLAYERSLOG $(getInstancePath $INSTANCE)/logs/current_players.log
 }
 
@@ -33,9 +35,10 @@
 #   4: Nick name
 logPlayerConnect() {
-	ENTITYID="$2"
-	STEAMID="$3"
-	NICKNAME="$4"
+	local ENTITYID="$2"
+	local NICKNAME="$3"
+	local STEAMID="$4"
+	local IP="$5"
 
-	echo "$(timestamp) +++ $ENTITYID $NICKNAME $STEAMID" >> "$PLAYERSLOG"
+	echo "$(timestamp) +++ $ENTITYID $NICKNAME $STEAMID $IP" >> "$PLAYERSLOG"
 
 	createPlayerList
@@ -53,4 +56,5 @@
 			-i "$XPATHBASE" -t attr -n "online" -v "true" \
 			-i "$XPATHBASE" -t attr -n "entityid" -v "$ENTITYID" \
+			-i "$XPATHBASE" -t attr -n "lastIp" -v "$IP" \
 			"$PLAYERSXML"
 	else
@@ -62,4 +66,5 @@
 			-u "$XPATHBASE/@entityid" -v "$ENTITYID" \
 			-u "$XPATHBASE/@logins" -v "$LOGINS" \
+			-u "$XPATHBASE/@lastIp" -v "$IP" \
 			"$PLAYERSXML"
 	fi
