- Timestamp:
- Jul 5, 2014, 7:06:58 PM (10 years ago)
- Location:
- scripts/usr/local/lib/7dtd
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
scripts/usr/local/lib/7dtd/VERSION
r61 r62 1 Version: 2 02 Release: 2014-0 6-201 Version: 21 2 Release: 2014-07-05 -
scripts/usr/local/lib/7dtd/monitor-log.sh
r57 r62 11 11 INSTANCE=$1 12 12 LOG=$(getInstancePath $INSTANCE)/output.log 13 CHATLOG=$(getInstancePath $INSTANCE)/chat.log 13 14 14 15 timestamp() { … … 19 20 tel=$(telnetCommand $INSTANCE lp) 20 21 playerline=$(echo "$tel" | tr -d '\r' | grep "id=$2,") 21 nickname=$(echo "$playerline" | sed -r 's/^.* id=[0-9]*, ([^,]*), pos=.*$/\1/')22 #nickname=$(echo "$playerline" | sed -r 's/^.* id=[0-9]*, ([^,]*), pos=.*$/\1/') 22 23 steamid=$(echo "$playerline" | sed -r 's/^.*, health=[0-9]*, ([0-9]*)$/\1/') 23 24 … … 26 27 fi 27 28 28 logPlayerConnect $INSTANCE $2 $steamid $ nickname29 logPlayerConnect $INSTANCE $2 $steamid $3 29 30 30 31 for H in $(getHooksFor playerConnect); do 31 $H $INSTANCE $1 $2 $ nickname$steamid32 $H $INSTANCE $1 $2 $3 $steamid 32 33 done 33 34 } … … 38 39 for H in $(getHooksFor playerDisconnect); do 39 40 $H $INSTANCE $1 $2 $NICKNAME $STEAMID 41 done 42 } 43 44 handleChat() { 45 echo "$(timestamp): $1" >> $CHATLOG 46 47 for H in $(getHooksFor chat); do 48 $H $INSTANCE $1 40 49 done 41 50 } … … 65 74 handleConnect "$playerId" "$entityId" "$playerName" 66 75 unset entityId playerId playerName unknown 67 fi76 else 68 77 if [ -n "$(echo "$line" | grep '^Removing player with id ')" ]; then 69 78 playerId=$(expr "$line" : 'Removing player with id clientId=\([0-9]*\), entityId=[0-9]*$') … … 71 80 handleDisconnect "$playerId" "$entityId" 72 81 unset playerId entityId 82 else 83 if [ -n "$(echo "$line" | grep -E '^GMSG: .+')" ]; then 84 msg=$(expr "$line" : 'GMSG: \(.*\)$') 85 handleChat "$msg" 86 unset msg 87 fi 88 fi 73 89 fi 74 90 fi
Note:
See TracChangeset
for help on using the changeset viewer.