This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

!ping only replys for me

Old posts that have not been replied to for several years.
Locked
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

!ping only replys for me

Post by Sir_Fz »

Code: Select all

proc validnum {num} {
 return [expr [scan $num "%f%s" a b] == 1]
}

proc pub_ping {nick uhost hand chan arg} {
global channel
  if {![isbotnick $nick]} { puthelp "PRIVMSG $nick :[list \001PING CHECK [clock clicks] $chan \001]" }
  set channel $chan
}

proc ctcr_ping {nick uhost hand dest keyword arg} {
global channel
 if {([lindex $arg 0] == "CHECK") && ([validnum [set time [lindex $arg 1]]])} {
 puthelp "PRIVMSG $channel :\[\002$nick\002 PING reply\]: [expr abs([clock clicks] - $time) / 1000000.0] seconds" }
 unset channel
}

bind pub -|- !ping pub_ping
bind pub -|- !pingme pub_ping
bind ctcr - PING ctcr_ping
it looks fine to me, but why doesn't it reply the ping on channel unless its me who's requesting !ping.
I noticed that it doesn't get a ping reply from anyone except me.
User avatar
strikelight
Owner
Posts: 708
Joined: Mon Oct 07, 2002 10:39 am
Contact:

Re: !ping only replys for me

Post by strikelight »

Sir_Fz wrote:

Code: Select all

proc validnum {num} {
 return [expr [scan $num "%f%s" a b] == 1]
}

proc pub_ping {nick uhost hand chan arg} {
global channel
  if {![isbotnick $nick]} { puthelp "PRIVMSG $nick :[list \001PING CHECK [clock clicks] $chan \001]" }
  set channel $chan
}

proc ctcr_ping {nick uhost hand dest keyword arg} {
global channel
 if {([lindex $arg 0] == "CHECK") && ([validnum [set time [lindex $arg 1]]])} {
 puthelp "PRIVMSG $channel :\[\002$nick\002 PING reply\]: [expr abs([clock clicks] - $time) / 1000000.0] seconds" }
 unset channel
}

bind pub -|- !ping pub_ping
bind pub -|- !pingme pub_ping
bind ctcr - PING ctcr_ping
it looks fine to me, but why doesn't it reply the ping on channel unless its me who's requesting !ping.
I noticed that it doesn't get a ping reply from anyone except me.
I don't know where you pulled "CHECK" from, but most clients respond to
"PING" alone (and/or followed by a unix time).
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

yes, I compared it to another script, I noticed that the CHECK thing is extra.. so I changed it to \001ping [clock clicks]\001

now it works :) thanx
Locked