PtokaX forum

Archive => Archived 5.0 boards => Request for scripts => Topic started by: Marco52 on 04 July, 2005, 16:09:00

Title: --Pinger 1.01 - need help
Post by: Marco52 on 04 July, 2005, 16:09:00
I want use --Pinger 1.01 script.

But this script is in LUA4.
I convert the script with  convertor into LUA5.
But I don't know, how can I convert file handlings (readfrom)  
skript write file: pinger.lst , but not read this file.
Can somebody help me with this, please?
Here is the script in Lua4:

--Pinger 1.01
--by Mutor The Ugly
--
--
--Check users ping time to hub with Windoze 'ping.exe'
--Note: Some users may block ping from WAN side
--
--Usage = !ping
--

PingComm = "!ping" -- Command name
--
rightclick = 1 -- if anything else than 1 rightclick menu won't appear

function DataArrival(curUser, sData)
      sData=strsub(sData,1,-2)
      s,e,cmd,who = strfind( sData, "%b<>%s+(%S+)%s*(%S*)" )
if (cmd==PingComm) and curUser.bOperator then
  local nick = GetItemByName(who)
if nick == nil then
SendToNick(curUser.sName,"**** User ->> "..who.." is not online. Try again.") return 1 end
local addy = nick.sIP


SendToNick(curUser.sName,"\r\n\t---<>-----------------------------------------------------------------------------<>---\r\n\t

\tPinging ->> [ "..who.." ]   Please

wait...\r\n\t---<>-----------------------------------------------------------------------------<>---")
execute("ping "..addy.." > pinger.lst")
local pingtime = ""
if readfrom("pinger.lst") then
readfrom("pinger.lst")
pingtime = read("*a")
pingtime = gsub(pingtime,"|",strchar(166))
pingtime = gsub(pingtime,"\n","\r\n\t")
writeto()
remove("pinger.lst")
end
SendToNick(curUser.sName,"\t\t\t.:: Results

::.\r\n\t---<>-----------------------------------------------------------------------------<>---\r\n\t"..pingtime.."\r\n\t---

<>-----------------------------------------------------------------------------<>---")
return 1
end
end

function OpConnected(curUser)
if rightclick == 1 then
curUser:SendData("$UserCommand 255 7")
curUser:SendData("$UserCommand 0 3")
curUser:SendData("$UserCommand 1 2 +ping$<%[mynick]> !ping %[nick]||")  
end
end
Title:
Post by: Dessamator on 04 July, 2005, 16:35:23
u have to convert the filehandling!, search the lua5 section for info on how to do this !
Title:
Post by: Markitos on 04 July, 2005, 16:36:52
Have a close look here (http://board.univ-angers.fr/thread.php?threadid=3800&boardid=30&styleid=1&sid=e16cbf8a43c4598f95e3e28b44f904ce)


Cheers...
Title:
Post by: Marco52 on 04 July, 2005, 17:20:04
I reading manual to convert the filehandling many time.
I making change in script but no efect.
Myself can not make conwerting this script.
Please help me with this.
sorry for my bad language/
========================================
That's wonderfull, extraordinary! - i'm writing this ^^^ txt
and YOU in same time finish convert script !
Mutor - Thank You for your help, very, very much.
Script now work very well !!!
Sincere thanks.
Title:
Post by: Dessamator on 04 July, 2005, 18:57:19
i made a pinger?, hmm i just dont remember what bug it had :)