ok, i got that part working now, but new problem is this:
whois works when query, but when query is on and im in channel, i what the whois to come to the channel, not in query. this is my code atm

; Full address, real name
raw 311:*: {
echo $color(whois) $iif($query($2) != $null,$2,-a) $chr(160) $+ _____________________________________________
echo $color(whois text) $iif($query($2) != $null,$2,-a) $chr(124) $2 $+ $chr(160) $+ $chr(160) $+ $+ ( $+ $3 $+ @ $+ $4)
echo $color(whois text) $iif($query($2) != $null,$2,-a) $chr(124) name: $6-
halt
}

raw 319:*: { echo $color(whois text) $iif($query($2) != $null,$2,$iif($query($2) != $null,$2,-a)) $chr(124) chan: $sorttok($3-,32,c) | halt }

; Server and server description
raw 312:*: { haltdef }

; DALnet nick registration information (maybe other networks too?)
raw 307:*: { echo $color(whois text) $iif($query($2) != $null,$2,-a) $2 $3- | halt }

; Away message, sent only when user is away
raw 301:*: { echo $color(whois text) $iif($query($2) != $null,$2,-a) $chr(124) $2 is away: $3- | halt }

; IRC operator status, the script is using $5- because some networks have different
; messages to indicate operator status. The string always begins like "is a/an", so
; cut out the first two words ($3-4)
raw 313:*: { echo $color(whois text) $iif($query($2) != $null,$2,-a) $chr(124) Status: $5- | halt }

; DALnet help operator reply
raw 310:*: { echo $color(whois text) $iif($query($2) != $null,$2,-a) $chr(124) $2 $3- | halt }

; Idle time, some servers also give signon time (login time) which has to be converted with $asctime
raw 317:*: {
echo $color(whois text) $iif($query($2) != $null,$2,-a) $chr(124) idle: $duration($3)
halt
}

; End of whois
raw 318:*: { echo $color(whois text) $iif($query($2) != $null,$2,-a) $chr(160) $+ ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ | halt }