can u change dis around
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

can u change dis around

Started by raz, 20 October, 2003, 21:26:23

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

raz

could you plz change +addalbums so only ops can do i have added   "if curUser.bOperator then"  and changed afew thingz around but it comes out to be dat +deletealbum doesn't work. this is the original script, plz can u change it so ops can do +addalbums. can u check it b4 u give it back to see if it wokrs.  i know that there are updated scripts but all i need is dis.     thanks.

--FreshStuff v.2.3
--You need a folder called "txt" in your Ptokax scripts folder, like this  /scripts/txt/

--Name this bot to anything you like
bot = "-= Albums =-"

--Name the commands to what U like
--This command adds stuff, syntax : +adds THESTUFF
cmd1 = "+addalbum"

--This command shows the stuff, syntax : +shows THESTUFF
cmd2 = "+albums"

--This command deletes an entry, syntax : +dels THESTUFFNUMBER
cmd3 = "+deletealbum"

--This command shows the Top Poster, syntax : +topp
cmd4 = "+topalbumposter"

--Set This to anything else than nil and the 5 newest items will be shown at userconnect
SendOnConnect = nil

--Set this number to the Maximum of shown items
Max1 = 100

--Set this number to the Maximum of shown items on connect
Max2 = 5

--Set this number to the Maximum of stored table entries
MaxT = 100

--Set this number to the Maximum of shown Posters
Max3 = 10
----------------------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------------------

File1 = "albums.txt"
File2 = "albumPosters.txt"

newstuff={}
posters={}

curtime = date("[%d-%m-%Y]")

function Main()
   ReadStuff1(File1, newstuff)
   topItems1 = ReadTable(newstuff, Max1)
   topItems2 = ReadTable(newstuff, Max2)
   ReadPosters()
   topposters = ShowPosters(posters, Max3)
end

function NewUserConnected(curUser)
   if SendOnConnect then
      OpenFile(curUser, File1)
   end
end

function OpConnected(curUser)
   if  SendOnConnect then
      OpenFile(curUser, File1)
   end
end

function DataArrival(curUser,data)

   if (strsub(data, 1, 1) == "<") then
   data = strsub(data,1,strlen(data)-1)

      if (strfind(strlower(data), strlower(cmd1))) then
         s,e,cmd,item = strfind( data, "%b<>%s+(%S+)%s+(.*)" )
         if ( item == nil or item == "" ) then
            curUser:SendData(bot, " If you want to add an item type    "..cmd1.." YOURITEM     in main chat :)")
            return 1      
         elseif ( strlen(item) < 100 and strlen(item) > 5) then
            item = gsub(item, "(%w+)", "%1 ");
            for i,v in newstuff do
               s,e,name,curitem = strfind( v, "-%s+%b[]%s+(%S+)%s+added%s+<::%s+(.*)" )
               if curitem == nil then
               else
                  curitem = strsub(curitem,1,strlen(curitem)-4)
                  if strlower(curitem) == strlower(item) then
                     curUser:SendData(bot, " Sorry your item  <:: "..curitem.." ::>  has already been added.\r\n"..
                     "   "..v)
                     return 1
                  end
               end
            end
            ReadPosters()
            if posters[curUser.sName]==nil then
               posters[curUser.sName]=1
               WritePosters()
               topposters = ShowPosters(posters, Max3)
            else
               posters[curUser.sName]=posters[curUser.sName]+1
               WritePosters()
               topposters = ShowPosters(posters, Max3)
            end
            curstuff = "- "..curtime.." "..curUser.sName.." added <:: "..item.." ::>"
            tinsert ( newstuff, 1, curstuff)
            WriteStuff1(File1, newstuff)
            newstuff = {}
            ReadStuff1(File1, newstuff)
            topItems1 = ReadTable(newstuff, Max1)
            topItems2 = ReadTable(newstuff, Max2)
            SendToAll(newstuff[1])
            return 1
            
         else
            curUser:SendData(bot, " If you want to add an item type    "..cmd1.." YOURITEM   (at least 5 characters) in main chat :)")
            return 1
         end
      end

      if (strfind(strlower(data), strlower(cmd2))) then
         curUser:SendData(bot, "\r\n"..
         "   ??*?'?*????*?'?*??  The "..Max1.." Newest Items  ??*?'?*????*?'?*??    \r\n"..
         topItems1.."\r\n"..
         "   ??*?'?*????*?'?*??  The "..Max1.." Newest Items  ??*?'?*????*?'?*?? ")
         return 1
      end

   if (strfind(strlower(data), strlower(cmd3))) then
         if curUser.bOperator then
            s,e,cmd,num = strfind( data, "%b<>%s+(%S+)%s+(.*)" )
            num2=tonumber (num)
            if ( num2 == nil ) then
               curUser:SendData(bot, " To delete an item type    "..cmd3.." ITEMNUMBER    in main chat :)")
               return 1
            else
               if newstuff[num2]~=nil then
                  tremove (newstuff, num2)
                  WriteStuff1(File1, newstuff)
                  newstuff = {}
                  ReadStuff1(File1, newstuff)
                  topItems1 = ReadTable(newstuff, Max1)
                  topItems2 = ReadTable(newstuff, Max2)
                  curUser:SendData(bot, " Item Nr. "..num2.." was deleted.")
                  return 1
               else
                  curUser:SendData(bot, " Item Nr. "..num2.." is not in list.")
                  return 1
               end
            end
         end
      end

      if (strfind(strlower(data), strlower(cmd4))) then
         curUser:SendData(bot, "\r\n"..
         "   -= Top "..Max3.." Releasers =-\r\n"..
         topposters)
         return 1
      end
   end
end
----------------------------------------------------------------------
function ReadStuff1(File, table)
   local handle = openfile("txt/"..File1, "r")
   if (handle) then
      local line = read(handle)
      while line do
         s,e,ind,val = strfind( line, "(%S+)%s+(.*)")
         ind = tonumber (ind)
         table[ind]=val
         line = read(handle)
      end
        closefile(handle)
   end
end
----------------------------------------------------------------------
function WriteStuff1(File, table)
   local handle = openfile("txt/"..File1, "w")
   for i = 1, MaxT do
      if table then
      write(handle,i.." "..table.."\r\n")
      end
     end
     closefile(handle)
end      
----------------------------------------------------------------------
function ReadTable(table, Max)
   var1 = 0
   local msgfromtxt ="\r\n"
   for index, value in table do
      var1 = var1 + 1
      msgfromtxt = msgfromtxt.."   "..index.." "..value.."\r\n"
      if var1 == Max then
         break
      end
   end
   return msgfromtxt
end      
----------------------------------------------------------------------
function ShowPosters(table, Max)
   var2 = 0
   var3 = 0
   local msgfromtxt ="\r\n"
   while var2 < Max do
      var2 = var2 +1
      var4 = 0
      for index, value in table do
         value = tonumber (value)
         if value >= var4 then
            var4 = value
            userm = index
         end
      end
      table[userm]=0
      var3 = var3 +1
      msgfromtxt = msgfromtxt.."          "..var3.." - "..userm.." posted "..var4.." Items.\r\n"
   end
   return msgfromtxt
end
----------------------------------------------------------------------
function ReadPosters()
   local handle = openfile("txt/"..File2, "r")
   if (handle) then
          local line = read(handle)
          while line do
         s,e,ind,val = strfind( line, "(%S+)%s+(.*)")
         posters[ind]=val
         line = read(handle)
          end
        closefile(handle)
   end
end
----------------------------------------------------------------------
function WritePosters()
   local handle = openfile("txt/"..File2, "w")
   for index, value in posters do
      write(handle,index.." "..value.."\r\n")
     end
     closefile(handle)
end

SMF spam blocked by CleanTalk