PtokaX forum

Archive => Archived 4.0 boards => Help with Lua 4 scripts => Topic started by: BrokenBrick on 22 December, 2003, 23:51:00

Title: Hub password
Post by: BrokenBrick on 22 December, 2003, 23:51:00
OpiumVolage posted this script, but I can't seem to get it to work with TD4.  I get an error because of the Clock function, but I can't seem to remove it
-------------------------------------------------------------

tabValidate = {}

function Main()
   frmHub:EnableFullData(1)
   SetTimer(1000)
   StartTimer()
end

function DataArrival(user, data)
   if not user.bOperator then
      if strfind(data, "^%$ValidateNick") then
         user:SendData("$GetPass|")
         tabValidate[user.sName] = Clock()
         return
      end
      if tabValidate[user.sName] then
         if strfind(data, "^$MyPass") then
            local _, _, Pass = strfind(data, "%s+(%S+)%s*|")
            if Pass == "PassWord" then
               user:SendData("$LogedIn|")
               return
            end
            user:SendData("$BadPass|")
            user:Disconnect()
         end
      end
   end
end

function OnTimer()
   for id, value in tabValidate do
      if (tabValidate[id] + 3) > Clock() then tabValidate[id] = nil end
   end
end