using $gettok and $left, and re-check if it's a number:
on *:text:*Has Joined Cops & Robbers*:#CnR|LV:{
if ($left($gettok($1,-1,40),-1) isnum) { msg #admin !getip $v1 }
}
$gettok(text,-1,X) is getting the "rightmost token" of a text that is separated by $chr(X). X is an ascii value.
In the code here, $1 is used for text ($1 is the first word in the processed message). "40" is the ascii value for "(", and therefore the "rightmost token of Bill(3) separated by opening bracket" is: Bill(
3) .
$left(text,-1) is "text" without the rightmost character - to get rid of the closing bracket: "3)" becomes "3".
Finally, a "if (something isnum)" comparison, to play safe.
$v1 used in the message command refers to "something" in the previous check "if (something isnum)".
using regex: (grabbing the digit in brackets directly)
on $*:text:/^\S+\((\d+)\) Has Joined Cops & Robbers/:#CnR|LV: { msg #admin !getip $regml(1) }
This one is looking for one or more non-space characters (the nick) at the beginning of the line, followed directly by an opening bracket, followed directly by one or more digits (the ID), followed directly by a closing bracket, and then followed the text "Has Joined Cops & Robbers".
There are brackets arround the digit part:
(\d+
) who are "capturing" the enclosed part of the match, thus it can be used (refered to) in the "msg #admin" part: it's the first (and only) capture to refer to: $regml(1)