Re: [server regulator]CloudyServ 0.982-X3 Public Release [message #484732 is a reply to message #340914] |
Sat, 30 November 2013 18:13   |
 |
Gen_Blacky
Messages: 3250 Registered: September 2006
Karma:
|
General (3 Stars) |
|
|
I tried this without any noticeable problems. Probably should do it another way with the binvar and endline 0x0
Toggle Spoiler
alias TCPLogConnect {
sockopen TCPLog 127.0.0.1 7025
echo -s Status $Sock(TCPLog).status
}
alias TCPLogDisconnect {
sockclose TCPLog
}
on *:sockopen:TCPLog*:{
echo -s Connection
if ($sockerr) {
echo -s Unable to connect $Sock(TCPLOG).wsmsg
}
}
on *:sockread:TCPLog*:{
if ($sockerr) {
return
}
sockread -n &TCPLogRead
if ($sockbr == 0) {
return
}
var %Offset = 0
var %Len = $bvar(&TCPLogRead,0)
if (%Len < 8) {
return
}
if ($bvar(&TCPLogRead,1) == 0) {
%Offset = 1
}
var %ID = $bvar(&TCPLogRead,$calc(%Offset + 1),3).text
var %Message = $bvar(&TCPLogRead,$calc(%Offset + 15),%Len).text
if ( %Message ) {
if (%ID == 000) {
echo -s %ID %Message
}
else if (%ID == 001) {
echo -s %ID %Message
}
else if (%ID == 002) {
echo -s %ID %Message
}
}
}

[Updated on: Sat, 30 November 2013 18:19] Report message to a moderator
|
|
|