PtokaX forum

Archive => Archived 4.0 boards => Help with Lua 4 scripts => Topic started by: lynyrd on 15 January, 2004, 00:37:54

Title: sleeping policeman
Post by: lynyrd on 15 January, 2004, 00:37:54
hi! im a bit confused about this script..
is it for stoping search bots? i found it on dc
code:
-------------------------------------------------------------------------------------------------------
                              Script = "The Sleeping Policeman"
                                        Written by the Doctor.

-------------------------------------------------------------------------------------------------------
-- Enforcing the Stop and Search -- This section makes sure that only a human who stops to search will
----------------------------------- remain free to enter. Search bots will aquire a criminal record. :)
---- Details: It will not matter what they are called, nor where they come from, but if they come to cop
-- a quick feel of the inventory they will make themselves known by their deeds and get a fair cop.


function Main(##)                          -- Set NAME to something no-one can have; make it Officious.
  NAME="Hub-Security"
  MONOSTABLE=0
end

function NewUserConnected(curUser)       -- A policeman can only feel one collar properly at a time. :)
  if (MONOSTABLE==0) then
    NAME=curUser.sName
    SEARCH=0
    MONOSTABLE=1
    SetTimer(5000)
    StartTimer()
  end
end

function DataArrival(PISSING, RAZORS)    -- A cunning copper disables the razor by extracting the urine.
  if (NAME==PISSING.sName) then
    if (strsub(RAZORS, 1, 7) == "$Search") then
    SEARCH=1
    end
  end
end

function OnTimer()                       -- A resident policeman also has to be as discreet as a butler.
  SendToNick(NAME, "     "..NAME.."...  Welcome To "..frmHub:GetHubName()..".")
  NAME="Hub-Security"
  MONOSTABLE=0
  StopTimer()
end

function UserDisconnected(curUser)       -- Intruders may leave freely, but the door is barred with iron.
  if (NAME==curUser.sName) then
    if (SEARCH==1) then
      frmHub:AddRegUser(NAME, "SB - "..(random()+mod(clock()/1E3,1))*1E15, 0)
    end
    StopTimer()
  end
end
-----------------------------------------------------------------------------------------------