please help i need to covert this scriptfrom lua4 to lua5
 

please help i need to covert this scriptfrom lua4 to lua5

Started by cablemax, 01 July, 2005, 15:22:55

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

cablemax

-- this script is made by -=La Goa=-
-- In time this script should be able to perform the same commands as the NMDC -=Hippy=-
-- For the moment this script is still very low in possibilties compared to NMDC hippy
------------------------------------

Bot="-=Hippy=-"

MsgRulz= "\r\n\r\n\t text\r\n\r\n"..
  "\t * text1\r\n"..
  "\t * text2\r\n"..
  "\t * text3\r\n"..
  "\t * text3\r\n"..
  "\t * text4\r\n"..
  "\t * text5\r\n"..
  "\t * text6\r\n"..
  "\t * text7\r\n"..
  "\t * text8\r\n"..
  "\t * text9\r\n"..
  "\t * text10\r\n"..
  "\t * text11\r\n"..
  "\t * text12\r\n"..
  "\t * text13\r\n"..
  "\t * text14\r\n"..
  "\t * text15\r\n"..
  "\t * text16\r\n"..
  "\t * text17\r\n\r\n"..
  "\t * text18\r\n"..
  "\t * text19\r\n\r\n"..
  "\t * text20\r\n"..
  "\t * text21\r\n"..
  "\t * text22\r\n"..
  "\t * text23\r\n"..
  "\t * text24\r\n"..      
  "\t **** FOR ALL THE COMMANDS TYPE !userhelp IN MAIN TO SEE THEM **** \r\n\r\n"..
  "If there are any problems, or someone is stealing from u by breaking the rulz \r\n"..
  "Go to the OPERATORSs, and ask for assistance they will be happy to help you. \r\n"

MsgConfirm= "your wish is my command"

MsgWelcome= "These are the operator commands ver1.1  \r\n"..
 "!info (main) \t\t -information of given user \r\n"..
 "banip \t\t -permbans ip of given user \r\n"..
 "banName \t\t -permban Name \r\n"..
 "unban \t\t -unbans the given item \r\n"..
 "cleartemp \t\t -clears the tempbanlist \r\n"..
 "massmsg \t\t -sends a message to all users \r\n"..
 "opsmsg \t\t -sends a message to all Ops \r\n"..
 "reg \t -regs the user with given pass \r\n"..
 "dereg \t\t -removes registration from given user \r\n"..
 "hippy \t\t -Hippy in main \r\n"..
 "rude \t\t -Mrs Rude in main \r\n"..
 "rulz+ \t\t\t -shows the rulz in main \r\n"..
 "help \t\t\t -shows the commands again \r\n"
 


function Main()
   --frmHub:EnableFullData(1)
   frmHub:RegBot(Bot)
end


function DataArrival (curUser, curData)
   -- SendToAll(Bot, "data")
   if curUser.bOperator then
       local data=strsub(curData,1,strlen(curData)-1)  -- remove last char
      -- curUser:SendPM(Bot, "data has arrived")
      if strsub(data, 1, 5+strlen(Bot)) == "$To:".." "..Bot then
         s,e,sCmd = strfind( data, "%b<>%s+(%S+)" )
         s,e,cmd,txt = strfind( data, "%b<>%s+(%S+)%s+(.+)" )
         -- curUser:SendPM(Bot, cmd)
         -- curUser:SendPM(Bot, strlen(cmd))
         if (sCmd=="pol") then
            curUser:SendPM(Bot, "pol found")
         elseif (cmd=="hippy") then
            SendToAll(Bot, txt)
            curUser:SendPM(Bot, MsgConfirm)
         elseif (cmd=="rude") then
            SendToAll("-=Mrs Rude=-", txt)
            curUser:SendPM(Bot, MsgConfirm)
         elseif (cmd=="massmsg") then
            SendPmToAll("HubMassMessage", "From "..curUser.sName.." : "..txt.."\r\n\r\n")
            curUser:SendPM(Bot, MsgConfirm)
         elseif (cmd=="opsmsg") then
            SendPmToOps("OpsMessage", "From "..curUser.sName.." : "..txt.."\r\n\r\n")
            curUser:SendPM(Bot, MsgConfirm)
         elseif (sCmd=="help") then
            curUser:SendPM(Bot, MsgWelcome)
         elseif (sCmd=="rulz+") then
            SendToAll(Bot, MsgRulz)
            curUser:SendPM(Bot, MsgConfirm)
         elseif (sCmd=="cleartemp") then
            ClearTempBan()
            curUser:SendPM(Bot, MsgConfirm)
         elseif (cmd=="unban") then
            Unban(txt)
         elseif (cmd=="dereg") then
            --curUser:SendPM(Bot, "command started")
            if(DelRegUser(txt)==1) then
               curUser:SendPM(Bot, MsgConfirm)
            else curUser:SendPM(Bot, "<"..txt.."> is not a registrated user")   
            end
         elseif (cmd=="reg") then
            s,e,cmd,user, pass = strfind( data, "%b<>%s+(%S+)%s+(%S+)%s+(%S+)" )
            AddRegUser(user,pass,3)
            curUser:SendPM(Bot, "<"..user..">".."is been registrated with pass ".."<"..pass..">\r\n"..MsgConfirm)
            if(GetItemByName(user)~=nil) then
               GetItemByName(user):SendPM(Bot, "U have been turned into a registrated member thx to Op "..curUser.sName..
                           "\r\n Your password is <"..pass..">")
            end
         elseif (cmd=="banip") then
            if(GetItemByName(txt)==nil) then
                curUser:SendPM(Bot, "Sorry that user is not online")
            else
               GetItemByName(txt):Ban()
               curUser:SendPM(Bot, MsgConfirm)
            end
         elseif (cmd=="banName") then
            if(GetItemByName(txt)==nil) then
                curUser:SendPM(Bot, "Sorry that user is not online")
            else
               GetItemByName(txt):NickBan()
               curUser:SendPM(Bot, MsgConfirm)
            end            
         end
      end
   else
      local data=strsub(curData,1,strlen(curData)-1)  -- remove last char
      if strsub(data, 1, 1) == "<" then
         s = strfind( data, ">" )
         data = strsub(data,2,s-1)
         if not(curUser.sName ==data) then
            SendToAll(Bot,"User <"..data.."> is using a fake nick, his real name is <"..curUser.sName.."> IP:"..curUser.sIP)
            curUser:Ban()
            curUser.Disconnect()
            SendToAll(Bot,"I kicked him out and banned him  ;)")
         end
      end
   end
end


function NewUserConnected(curUser)
   curUser:SendData("", MsgRulz)
end


function OpConnected(curUser)
   curUser:SendData("", MsgRulz)   
   curUser:SendPM(Bot, MsgWelcome)
end

SMF spam blocked by CleanTalk