Ignore:
Timestamp:
Jan 5, 2019, 1:12:17 PM (6 years ago)
Author:
alloc
Message:

Linux scripts 111

File:
1 edited

Legend:

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

    r308 r344  
    7373
    7474handleChat() {
    75         echo "$(timestamp): $1: $2" >> $CHATLOG
     75        echo "$(timestamp): $1: $2 (SteamID $3, EntityID $4, Target $5)" >> $CHATLOG
    7676       
    7777        for H in $(getHooksFor chat $INSTANCE); do
    78                 $H $INSTANCE "$1" "$2"
     78                $H $INSTANCE "$1" "$2" "$3" "$4" "$5"
    7979        done
    8080}
     
    167167                        handleGmsg "$msg"
    168168                        unset msg
    169                 #Chat: 'name': .*$
    170                 elif [ -n "$(echo "$line" | grep -E '^Chat: .+')" ]; then
    171                         name=$(expr "$line" : "Chat: '\(.*\)': .*$")
    172                         msg=$(expr "$line" : "Chat: '.*': \(.*\)$")
    173                         handleChat "$name" "$msg"
    174                         unset name msg
     169                #Chat (from '<steamid>', entity id '<entityid>', to '<targettype>'): '<senderchatname>': <msg>
     170                elif [ -n "$(echo "$line" | grep -E '^Chat .+')" ]; then
     171                        steamId=$(expr "$line" : "Chat (from '\(.+\)', entity id '[0-9]+', to '[a-fA-F:0-9.]+'): '.*': .*$")
     172                        entityId=$(expr "$line" : "Chat (from '.+', entity id '\([0-9]+\)', to '[a-fA-F:0-9.]+'): '.*': .*$")
     173                        targetType=$(expr "$line" : "Chat (from '.+', entity id '[0-9]+', to '\([a-fA-F:0-9.]+\)'): '.*': .*$")
     174                        name=$(expr "$line" : "Chat (from '.+', entity id '[0-9]+', to '[a-fA-F:0-9.]+'): '\(.*\)': .*$")
     175                        msg=$(expr "$line" : "Chat (from '.+', entity id '[0-9]+', to '[a-fA-F:0-9.]+'): '.*': \(.*\)$")
     176                        handleChat "$name" "$msg" "$steamId" "$entityId" "$targetType"
     177                        unset name msg steamId entityId targetType
    175178                #Executing command ".*" from client ".*"$
    176179                elif [ -n "$(echo "$line" | grep '^Executing command '.*' from client')" ]; then
Note: See TracChangeset for help on using the changeset viewer.