i have error and i need same help
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

i have error and i need same help

Started by (-=TrIp-iN-SuN=-), 09 October, 2005, 21:40:53

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

(-=TrIp-iN-SuN=-)

same one can to help me with that script
and i have pxwsa.dll this file

-- Ptokax LuaScript - written by bluebear.
-- This script is a part of the pxwsa.dll packages documentation.
-- Please read the license.txt before any usage, thx.
-- ==========================================================
-- File: AsyncWhois.lua
-- Usage: +whois
-- Arg: IP/DOMAIN/HOSTNAME
-- Desc:   Provides a +whois trigger to all users.
--      It only allows one user to use it at the time
--      Please note that this is a sample script.
--      I'm not a luascripter in any way.
--      You should finish this script, if you use it for
--      other things than testing.
--      You should add code for checking if the args
--      are valid so you wont crash ptokax.

-- options
rHost = "whois.ripe.net"
rPort = 43

-- Globals
running = nil
incomBuffer = ""
--Used for keeping track of user/socket/request (you should do this in tables to allow multiply users)
domain = nil
curUser = nil
curSocket = nil

-- Init lib
libinit = loadlib("../lib/pxwsa.dll", "_libinit")
libinit()

-- Init sockets
error_ = WSA.Init()

-- Resets the whois so a new users can use the trigger
function CloseSck()
   errorCode, errorStr = WSA.Close(curSocket)
   incomBuffer = ""
   domain = nil
   curUser = nil
   curSocket = nil
   running = nil
end

-- The next 3 functions is fired by the wsa lib when your useing async calls.

-- This function fires when a connection is established.
OnWsaConnected = function ( errorCode, errorStr, socket )
   if errorCode == nil then
      -- We're connected :)
      SendToNick(curUser, " SocketID: "..socket.." is now connected to: "..rHost..":"..rPort)
      -- Starte async receive
      WSA.BeginReceive(socket)
      -- Send request to whois server
      WSA.BeginSend(socket, domain)
   else
         -- Could not connect
      SendToNick(curUser, " Could not connect to: "..rHost..":"..rPort..". Error: "..errorCode.." "..errorStr)
      CloseSck()
   end   
   return 0
end

-- This function fires when a send is done. In this case it's when the whois request is sent.
OnWsaSendComplete = function ( errorCode, errorStr, socket, bytesSent )
   if errorCode == nil then
      SendToNick(curUser, " Sent on socket "..socket..": "..bytesSent.." bytes.")
   else
      -- Error dueing send
      SendToNick(curUser, " Could not send request to: "..rHost..":"..rPort..". Error: "..errorCode.." "..errorStr)
      CloseSck()   
   end
   return 0
end

-- This function fires when there is data available
OnWsaDataArrival = function ( errorCode, errorStr, socket, sdata, length )
   local retVal = 0 -- Return value
   if errorCode == nil then
             -- Receive done - but there can still be data on the socket you need to read.
      -- SendToNick(curUser, "Received "..length.." bytes from socket: "..socket.." Data: "..sdata)
      incomBuffer = incomBuffer..sdata
      -- return > zero to tell the lib that we still wants to receive data
      retVal = 1
   else
             -- Receive was an failure
             if errorCode == 0 then
                -- the connection has been gracefully closed by remotehost.
         SendToNick(curUser, " n"..incomBuffer)
         SendToNick(curUser, " "..errorStr)
         CloseSck()
      else
         -- error
         SendToNick(curUser, " Error: "..errorCode.." "..errorStr)
         CloseSck()
             end
   end
   return retVal
end

-- Starts the lookup
function WhoisMain( curentUser, args)
   errorCode, errorStr, curSocket = WSA.NewSocket()
   -- Do error handles here
   curUser = curentUser
   domain = args.."n"
   WSA.BeginConnect(curSocket, rHost, rPort)
end

-- parse
function Get1Arg(data)
   -- Written by plop
   local s,e,sArg = string.find(data, "%b<>%s+%!whois%s+(%S+)")
   if sArg then
      return sArg
   end
end

-- Ptokax chat arrival
function ChatArrival(user, data)
   -- written by plop
   local data = string.sub(data, 1, (string.len(data) - 1))
   local sArg = Get1Arg(data)
   if sArg then
      if running == nil then
         -- arg found
         running = 1
         user:SendData(" looking "..sArg.." up at "..rHost)
         WhoisMain(user.sName, sArg)
      else
         user:SendData(" Sorry, I can only serve one user at the time. Please try agian in a few seconds..")
      end
      return 1
   else
      -- no arg found
   end
end

-- When ptokax stops
OnExit = function()
   -- clean up.
   local errorCode, errorStr = WSA.Dispose()
end

-- errortracker by uv
ErrorsTo = {           -- table with nicks to get ErrorMsg
   "]['rIp?iN??uN",
   "YoursecondNIcknamehere",
   "Etc.Etc.",
   }
errBotName = "-=Sript-Error=-"      -- duh..
---------------------------------- end of settings
function OnError(ErrorMsg)
   for i, v in ErrorsTo do
   SendPmToNick(v, errBotName, ErrorMsg)
  end
end
--------------------------------------------------------------


my error [21:37] Syntax masterchat.lua:31: attempt to call global `libinit' (a nil value)

(-=TrIp-iN-SuN=-)

[21:42] Syntax [string "-- Ptokax LuaScript - written by bluebear.
..."]:31: attempt to call global `libinit' (a nil value)
it's my error

(-=TrIp-iN-SuN=-)

i thing all that script it's one big error

bastya_elvtars

QuoteOriginally posted by (-=TrIp-iN-SuN=-)
i thing all that script it's one big error

Quote-- Please note that this is a sample script.
-- I'm not a luascripter in any way.
Everything could have been anything else and it would have just as much meaning.


SMF spam blocked by CleanTalk