Ignore:
Timestamp:
Jun 9, 2014, 3:11:45 PM (10 years ago)
Author:
alloc
Message:

Version 16: Fixes #17

File:
1 edited

Legend:

Unmodified
Added
Removed
  • scripts/usr/local/lib/7dtd/monitor-log.sh

    r35 r57  
    5858                echo "$(timestamp): $line" >> $LOG
    5959                if [ -n "$(echo "$line" | grep '^RequestToSpawnPlayer:')" ]; then
    60                         read entityId playerId playerName unknown <<< "$(echo $line | sed -r 's/^RequestToSpawnPlayer: (.*), (.*), (.*), (.*)$/\1 \2 \3 \4/')"
     60                        entityId=$(expr "$line" : 'RequestToSpawnPlayer: \([0-9]*\), [0-9]*, .*, [0-9]*$')
     61                        playerId=$(expr "$line" : 'RequestToSpawnPlayer: [0-9]*, \([0-9]*\), .*, [0-9]*$')
     62                        playerName=$(expr "$line" : 'RequestToSpawnPlayer: [0-9]*, [0-9]*, \(.*\), [0-9]*$')
     63                        unknown=$(expr "$line" : 'RequestToSpawnPlayer: [0-9]*, [0-9]*, .*, \([0-9]*\)$')
    6164                        sleep 1
    62                         handleConnect $playerId $entityId $playerName
     65                        handleConnect "$playerId" "$entityId" "$playerName"
    6366                        unset entityId playerId playerName unknown
    6467                fi
    6568                if [ -n "$(echo "$line" | grep '^Removing player with id ')" ]; then
    66                         read playerId entityId <<< "$(echo $line | sed -r 's/^Removing player with id clientId=(.*), entityId=(.*)$/\1 \2/')"
    67                         handleDisconnect $playerId $entityId
     69                        playerId=$(expr "$line" : 'Removing player with id clientId=\([0-9]*\), entityId=[0-9]*$')
     70                        entityId=$(expr "$line" : 'Removing player with id clientId=[0-9]*, entityId=\([0-9]*\)$')
     71                        handleDisconnect "$playerId" "$entityId"
    6872                        unset playerId entityId
    6973                fi
Note: See TracChangeset for help on using the changeset viewer.