PtokaX forum

Archive => Archived 5.0 boards => Request for scripts => Topic started by: Ubikk on 19 June, 2005, 17:46:37

Title: !ping bot
Post by: Ubikk on 19 June, 2005, 17:46:37
hey guys...
Is it possible to make a script that enables a command wich allows registered users to ping the hub? :)
Example:

!ping
Ping reply: 2 seconds


Btw.. it will be a nice thing to also have a trigger wich enables/disables the command to work only for registered users

Thank you in advance

P.S: and a trigger that allows the bot to send the ping reply message to all users in mainchat or only to the user that used the command :)
Title:
Post by: Ubikk on 19 June, 2005, 18:48:42
Isn't it possible to ping the hub's server using the windows utility ,gather the necessary information from it and then displaying it on the hub?
Title:
Post by: Dessamator on 19 June, 2005, 19:28:26
Well, if the server pings itself, the result will always be irrelevant, so in other words impossible,  what could be done is the inverse, the user uses the ping cmd, and the server pings him,then u can gather the info and send to the user .
Title:
Post by: Ubikk on 19 June, 2005, 21:09:26
Sure.. that would do just fine... so, who can help me with the necessary script?  :D
Title:
Post by: Star on 19 June, 2005, 21:22:50
This soundes great. Maybe a request to implant in PtocaX?
Title:
Post by: Dessamator on 19 June, 2005, 21:27:12
-- By Dessamator
-- "Hub Pinger"

function ChatArrival(user, data)
data = string.sub(data,1,-2)
s,e,cmd = string.find(data, "%b<>%s+(%S+)")
if cmd=="!ping" then
local temp,n="\r\n\t\Ping Results :\r\n"..string.rep("??",12).."\r\n",0
os.execute("ping "..user.sIP.." >pingresults.txt")
for line in io.lines("pingresults.txt") do
n=n+1
if n>10 then
temp=temp..line.."\r\n"
end
end
os.remove("pingresults.txt")
user:SendData(frmHub:GetHubBotName(),temp)
return 1
end
end


Done !

P.S :
QuoteLastly the one being pinged must allow ping from WAN side in their firewall or router.
Title:
Post by: Dessamator on 19 June, 2005, 21:29:37
QuoteOriginally posted by Star
This soundes great. Maybe a request to implant in PtocaX?

well this is the wrong thread to ask for it, but anyways, maybe if ur lucky PPK, will grant ur request .
Title:
Post by: Dessamator on 19 June, 2005, 22:13:37
If it has no arguments, its hard to find what it does, either way, the result of that "$Ping" seems to be invisible to us .

im sure ptokax uses some way of finding how fast a client is, otherwise we wouldnt have the option "keep slow clients online", unless it serves a different purpose, which is unknown to me !