PtokaX forum

Archive => Archived 4.0 boards => Help with Lua 4 scripts => Topic started by: VERMiN on 21 October, 2003, 18:46:57

Title: Obtain slots - I just can't..
Post by: VERMiN on 21 October, 2003, 18:46:57
Hi!

I'm trying to write a script that check if an CABLE/DSL user has more than 2 slots. But I just can't get it to work.

Here it is, I hope that someone can assist me.

-----------------------------------------------------------------------
Bot = "Slot-Check"
Connection = {"CABLE","DSL"}
maxslots = 2

function Main()
   frmHub:RegBot(Bot)
                end

function NewUserConnected(curUser)

   for key, value in Connection do

      if (strfind(strlower(curUser.sMyInfoString), strlower(value),1,1)) then

         _,b, slots = strfind(curUser.sMyInfoString,"S:(%d+)",b)

   if(tonumber(slots) > 2) then
        SendToNick(curUser.sName,"You have too many slots!")
        curUser:Disconnect()
        end
         end
                end

end
-----------------------------------------------------------------------

I get this error:

Syntax Error: bad argument #3 to `strfind' (number expected, got nil)
Syntax Error: bad argument #3 to `strfind' (number expected, got nil)
Title:
Post by: OpiumVolage on 22 October, 2003, 09:47:05
_,b, slots = strfind(curUser.sMyInfoString,"S:(%d+)",b )