PtokaX forum

Archive => Archived 4.0 boards => Help with Lua 4 scripts => Topic started by: LiqUiD~TrolL on 09 November, 2004, 15:47:14

Title: help me i want to add a command in a script i m useing_!!
Post by: LiqUiD~TrolL on 09 November, 2004, 15:47:14
WELL GOOD EVENING PEOPLE,

i have a releases script in my hub that a friend of mine fix it and i have few problems  with it.
to start with my problems :

1) i want to add the command

+delrls
   
because i want to erase sometimes releases and i can t do it,only in releases.txt
but someone else is running the hub so i don t have access to the releases.txt  
 X(

2) i want to put something in the script that it reads the releases txt and it doesn t allow anyone add a release 2 times_(i mean double release addings)


3) now in the hub only operators can add releases,i would like register users can add releases if that is possible.


well here is the script   :



-- Make a file called releases.txt in \Scripts Folder
-- Made By Psycho-Canibal

BotName = "-AdmiN~BoT-"
timedate = date("%d/%m/%y")
file = "releases.txt"

SendOnConnect = nil  ----send new releases on connect(1=on , nil=off)
MaxNew = 25    ----max releases on the newrleases command
Count = 0
Count2 = 0
AllStuff = {}
NewestStuff = {}


display1 = "Release"
display2 = "Style"
display3 = "Date"



function NewUserConnected(curUser)
if SendOnConnect then
   local release = ""
   readfrom(file)
        for i=1, Count2 do
        release = release.."   "..NewestStuff.."\r\n"
        end
   curUser:SendData(BotName,"(private)>\t\t\tNEWS !!!\r\n\r\n\t\t\t\tNewest  "..MaxNew.."  "..display1.."s posted by users: ".."\r\n\r\n\t   "..display3.."\t\t    UserName\t           "..display2.."\t       "..display1.."\r\n\t   \t\t    \t\t           \t\t       \r\n"..release)
   readfrom()
end
end


OpConnected = NewUserConnected


function Main()
   OpenStuff()
file = "releases.txt"

end


function DataArrival(user, data)
   if (strsub(data, 1, 1) == "<" ) then
      data=strsub(data,1,strlen(data)-1)
         _,_,cmd=strfind(data, "%b<>%s+(%S+)")

      if (cmd=="+rls") then
         ReadRelease(user, data, cmd)
      end
      if (cmd=="+rlsall") then
         ReadReleaseAll(user, data, cmd)
      end
      if (cmd=="+addrls") then
         WriteRelease(user, data, cmd)

      end

   end


end

function WriteRelease(user, data, cmd)
   s,e,cmd,desc,release = strfind( data, "%b<>%s+(%S+)%s+(%S+)%s+(.+)" )
   if desc == nil then
   desc = "Psychedelic"
   s,e,release = strfind( data, "%b<>%s+%S+%s+(.+)" )
   end
   if desc == "P"
      then desc = "Psychedelic"
      elseif desc == "p"
         then desc = "Psychedelic"
         elseif desc == "C"
            then desc = "Chill"
            elseif desc == "c"
               then desc = "Chill"
               elseif desc == "A"
                  then desc = "Ambient"
                  elseif desc == "a"
                     then desc = "Ambient"
      
   end
   
   if release == nil then
      user:SendData(BotName,"(private)  ________<>________")
      user:SendData(BotName,"(private)> NO "..display1.." Was Write !!!!!!")
      user:SendData(BotName,"(private)> Write Like This :\t +addrls "..display2.." "..display1)
   else
      if (user.bOperator) then
      News("  "..timedate.."\t   "..desc.."\t          "..release)
      SendToAll(BotName, "A New "..display1.."  Is Added By  <"..user.sName..">. Type +rls/+rlsall to see the "..display1.."s.")
   
      else
      user:SendData("-----------------------------------------------------------------------------------")
      user:SendData(BotName,"(private))  ________<>________")
      user:SendData(BotName,"(private)> You Not Operator You Can't Write "..display1.."'s")
      user:SendData("-----------------------------------------------------------------------------------")
      end
   end
end
function ReadRelease(user, data, cmd)
   local release = ""
   readfrom(file)
        for i=1, Count2 do
        release = release.."   "..NewestStuff.."\r\n"
        end
   user:SendData(BotName,"(private)  ________<>________")
   user:SendData(BotName,"(private)>\r\n\r\n\t\t\t\tNewest  "..MaxNew.."  "..display1.."s posted by users: ".."\r\n\r\n\t   "..display3.."\t\t    UserName\t           "..display2.."\t      "..display1.."\r\n\t   \t\t    \t\t           \t\t       \r\n"..release)



   readfrom()
end

function ReadReleaseAll(user, data, cmd)
   local release = ""
   readfrom(file)
   while 1 do
   local line = read()
   if (line == nil) then
   break
   else
   release = release.."   "..line.."\r\n"
   end
   end
   user:SendData(BotName,"(private))  ________<>________")
   user:SendData(BotName,"(private)>\r\n\r\n\t\t\t\tAll "..display1.."s posted by users: ".."\r\n\r\n\t   "..display3.."\t\t    UserName\t           "..display2.."\t       "..display1.."\r\n\t   \t\t    \t\t           \t\t       \r\n"..release)
   user:SendData(BotName,"(private)>  This Is All The Releases  :  [ "..Count.." ]  Total ")
   readfrom()
end

function News(what)
   appendto(file)
      write(what.."\n")
   writeto()
OpenStuff()

end

function OpenStuff()
   AllStuff = nil
   NewestStuff = nil
   AllStuff = {}
   NewestStuff = {}
   Count = 0
   Count2 = 0
   readfrom(file)
   while 1 do
      local line = read()
      if ( line == nil ) then
         break
      else
         Count = Count +1
         AllStuff[Count]=line
      end
   end
   readfrom()
   if Count > MaxNew then
      local temp = Count - MaxNew + 1
      for i=temp, Count do
         Count2 = Count2 + 1
         NewestStuff[Count2]=AllStuff
      end
   else
      for i=1, Count do
         Count2 = Count2 + 1
         NewestStuff[Count2]=AllStuff
      end
   end
end
Title:
Post by: nErBoS on 10 November, 2004, 01:11:25
Hi,

Search in the "Finished Scripts" section for Release Bots you will find some good ones with that option and more.

Best regards, nErBoS
Title: hello nerbos
Post by: LiqUiD~TrolL on 12 November, 2004, 19:56:44
well my firend i like very much the script that psycho canibal gave me,i think it s better to moderate this one that try other one from the start. =/


i tried many times to contact you in israel but you are alwaysaway =]

can you help me with this script i send ????
and does this script you have in the finhsed scripts
have everything i m asking???


(     1) i want to add the command   +delrls

2) i want to put something in the script that it reads the releases txt and it doesn t allow anyone add a release 2 times_(i mean double release addings)


3) now in the hub only operators can add releases,i would like register users can add releases if that is possible.)))


does the script you are talking about have all these???
Title:
Post by: Herodes on 12 November, 2004, 20:15:08
QuoteOriginally posted by LiqUiD~TrolL
does the script you are talking about have all these???
go and try the script yourself .. its free, and it is completely right to change it as long as you keep the credits there ..
Title:
Post by: LiqUiD~TrolL on 14 November, 2004, 17:24:54
hi herodes well
i think i prefer keep my own script and fix it a little
=)


do you think there is a chance to add sometihng in the script that it reads the txt file with the releases
and it doesn t allow double addings???
i think it s hard to do this ahh
or maybe not possible
Title:
Post by: nErBoS on 15 November, 2004, 01:04:26
Hi,

Take a look at Fresh Stuff by plop or my Release-Bot (i am making a update for it, but it will take a while for a new version).

Best regards, nErBoS
Title:
Post by: LiqUiD~TrolL on 17 November, 2004, 16:04:03
hello nerbos  


my firned i was chacking your script,it s really good
but with some mistakes  

i found that the !delrls isn t working i don t know why and i think i m not doing something wrong!!
cause it s so simple to check a command


well i wanna tell you some things to improve your script if you are intrested in this

1st) you shoud add a count in the !rdall command so the users will know how many releases are added in the list

like this -->>  user:SendData(BotName,"(private)> This Is All The Releases : [ "..Count.." ] Total ")
readfrom()

2nd) i asked for something that can read the releases txt and it doesnt allow to add 1 release 2times _(double release addings)and that not 9n the script you recommended


3rd)when you press !rd30/!rdall  there is a mistake on the top of the screen  the "word" description it s not on the description of the release it s up form the rlease name


anyway i found your scrit very good but i would be greatfull if you try to fix it a little ,i really like it very much and i wanna use it ,but plz do something n fix some thnigs in it


AWSOME WORK MY FRIEND =o)
Title:
Post by: LiqUiD~TrolL on 21 November, 2004, 17:57:42
nerbbboooosss please reply my firend


i need a release bot or at least someone fix mine
Title:
Post by: nErBoS on 21 November, 2004, 18:02:43
Hi,

Like i said i am updating the Release BOT, i will take your advises as noted.

Best regards, nErBoS
Title:
Post by: LiqUiD~TrolL on 23 November, 2004, 18:12:28
=) hi my friend

well i can t wait untill you update the release bot

i need a release bot at once
cause my release bot SUXXXXXX