hello ppl i need a hand here , well i finaly deside to use this release of freshstuff --> 3.7.5 for my hub
but i have a small problem,with this script VIPs ca t add new releases
can anyone locate the problem???
-- FreshStuff 3 - 3.7beta ----------------------------------------------------------------------------------------- -- original idea/script by chilla -- completely rewriten by plop -- taken over by bastya_elvtars (the rock n' roll doctor) -- if you were running 3.0 then you gotta delete the old file -- it's incompatible with this version -- deleting now goes by id number -- anounces the new releas in mainchat ----------------------------------------------------------------------------------------- --------------------------- 3.7 ----------------------------- -- converted to lua5 and added search function by bastya_elvtars -- also taken over with permission by plop. :P -- rewrote the metadata routine: pattern matching is applied upon opening, using nested arrays ---> faster. -- added ability to delete multiple releases with a single line. --------------------------- 3.7.5 ----------------------------- -- added choice between showing in main or PM on entry -- new stuff is shown by real ID (idea by LiqUiD~TrolL) -- security fixes have been made, corrupt entries are ignored ----------------------------------------------------------------------------------------- senddebugto={"[TGA-OP]bastya_elvtars"} -- Name the commands to what U like -- This command adds stuff, syntax : +addalbum TYPE/CATAGORY THESTUFF2ADD cmd1 = "+addrls" -- This command shows the stuff, syntax : +albums with options new/game/warez/music/movie cmd2 = "+rlsall" -- This command deletes an entry, syntax : +delalbum THESTUFF2DELETE cmd3 = "+delrls" -- This command shows the latest stuff, syntax : +newalbums cmd4 = "+rls" -- This command reloads the txt file. syntax : +reloadalbums -- (this command is needed if you manualy edit the text file) cmd5 = "+reloadalbums" -- This is for searching inside releases. cmd6="+rlsfind" -- Show latest stuff on entry 1=PM, 2=mainchat, 0=no ShowOnEntry = 0 -- Max stuff shown on newalbums/entry MaxNew = 40 -- The file storing the stuff file = "releases.dat" -- Name of the bot Bot = "•NemO•" -- you can add catagory's yourself ["trigger_name"]="catagory_name" Types = {["psychedelic"] = "Psychedelic", ["ambient"]="Ambient", ["electronic"]="Electronic", ["psytrance"]="Psytrance", ["goa"]="Goa", ["chill"]="Chill", ["psytrance"]="Psytrance", ["house"]="House", ["proggresive"]="Proggresive", ["trance"]="Trance", ["psymovie"]="Psymovie"} --------------------- don't change anything below here AllStuff = {} NewestStuff = {} function Main() frmHub:RegBot(Bot) ReloadRel() end function Show(user) if ShowOnEntry ~=0 then if ShowOnEntry==1 then user:SendPM(Bot, MsgNew.."|") end end end function NewUserConnected(user) Show(user) end function ChatArrival(user,data) data = string.sub(data,1,string.len(data)-1) local _,_,cmd,type,tune = string.find(data, "%b<>%s+(%S+)%s*(%S*)%s*(.*)") if cmd == cmd2 then if type == "" then user:SendPM(Bot, MsgAll.."|") elseif type == "new" then user:SendPM(Bot, MsgNew.."|") elseif Types[type] then ShowRelType(type) user:SendPM(Bot, MsgType.."|") end return 1 elseif cmd == cmd4 then user:SendPM(Bot, MsgNew.."|") return 1 elseif user.bOperator then if cmd == cmd3 then if type ~= "" then DelRel(user, type) else user:SendData(Bot, "yea right, like i know what i got 2 delete when you don't tell me!|") end return 1 elseif cmd == cmd1 then if tune ~= "" and Types[type] then AddRel(user, tune, type) elseif Types[type] == nil then user:SendData(Bot, "I need to know the catagory to add it to!|") else user:SendData(Bot, "yea right, like i know what you got 2 add when you don't tell me!|") end return 1 elseif cmd == cmd5 then ReloadRel() user:SendData(Bot, "Albums reloaded!|") elseif cmd==cmd6 then if type~="" and tune=="" then SearchRel(user,type) else user:SendData(Bot, "yea right, like i know what you got 2 search when you don't tell me!|") end return 1 end end end function OpenRel() AllStuff = nil NewestStuff = nil AllStuff = {} NewestStuff = {} Count = 0 Count2 = 0 local f=io.open(file,"r") if f then for line in f:lines() do Count = Count +1 local _,_,type,who,when,title=string.find(line, "(.+)$(.+)$(.+)$(.+)") if type and who and when and title then AllStuff[Count]={type,who,when,title} else SendToOps(Bot, "Releases file is corrupt, failed to load all items.") end end f:close() end if Count > MaxNew then local tmp = Count - MaxNew + 1 Count2=Count - MaxNew + 1 for i = tmp, Count do Count2=Count2 + 1 if AllStuff[Count2] then NewestStuff[Count2]=AllStuff[Count2] end end else for i=1, Count do Count2 = Count2 + 1 if AllStuff[i] then NewestStuff[Count2]=AllStuff[i] end end end end function ShowRel(table) Msg = "\r\n" local type,who,when,title if table == NewestStuff then if Count2 == 0 then MsgNew = "\r\n\r\n".." --------- The Latest Releases -------- \r\n\r\n No releases on the list yet\r\n\r\n --------- The Latest Releases -------- \r\n\r\n" else for i=1, Count2 do if NewestStuff[i] then type,who,when,title=NewestStuff[i][1],NewestStuff[i][2],NewestStuff[i][3],NewestStuff[i][4] if title then Msg = Msg.." ID: "..i.." -- "..when.." -- "..who.." -- "..type.." -- "..title.."\r\n" else Msg = Msg..(table.concat(NewestStuff[i])).."\r\n" end end end end MsgNew = "\r\n\r\n".." --------- The Latest "..MaxNew.." Releases -------- "..Msg.."\r\n --------- The Latest "..MaxNew.." Releases -------- \r\n\r\n" else if Count == 0 then MsgAll = "\r\n\r\r\n".." --------- All The Releases -------- \r\n\r\n No releases on the list yet\r\n\r\n --------- All The Releases -------- \r\n\r\n" else MsgHelp = " use "..cmd2.." to see only the selected types" for i=1, Count do if AllStuff[i] then type,who,when,title=AllStuff[i][1],AllStuff[i][2],AllStuff[i][3],AllStuff[i][4] if title then Msg = Msg.." ID: "..i.." -- "..when.." -- "..who.." -- "..type.." -- "..title.."\r\n" else Msg = Msg..(table.concat(AllStuff[i])).."\r\n" end end end end MsgAll = "\r\n\r\r\n".." --------- All The Releases -------- "..Msg.."\r\n --------- All The Releases -------- \r\n"..MsgHelp.."\r\n" end end function ShowRelType(what) local type,who,when,title Msg = "\r\n" tmp = 0 if Count == 0 then MsgType = "\r\n\r\n".." --------- All The "..Types[what].." -------- \r\n\r\n No "..string.lower(Types[what]).." yet\r\n\r\n --------- All The "..Types[what].." -------- \r\n\r\n" else for i=1, Count do type,who,when,title=AllStuff[i][1],AllStuff[i][2],AllStuff[i][3],AllStuff[i][4] if type == what then tmp = tmp + 1 Msg = Msg.." "..when.." -- "..who.." -- "..title.."\r\n" end end if tmp == 0 then MsgType = "\r\n\r\n".." --------- All The "..Types[what].." -------- \r\n\r\n No "..string.lower(Types[what]).." yet\r\n\r\n --------- All The "..Types[what].." -------- \r\n\r\n" else MsgType= "\r\n\r\n".." --------- All The "..Types[what].." -------- \r\n"..Msg.."\r\n --------- All The "..Types[what].." -------- \r\n\r\n" end end end function AddRel(user, what, type) Count = Count + 1 AllStuff[Count]={type,user.sName,os.date("%x"),what} user:SendData(Bot, what.." is added to the releases as "..type.."|") SendToAll(Bot, user.sName.." added to the "..type.." releases: "..what.."|") SaveRel() ReloadRel() end function DelRel(user, what) string.gsub(what,"(%d+)",function(what) what = tonumber(what) if what then if AllStuff[what] then local which=(AllStuff[what][4]) user:SendData(Bot, which.." is deleted from the releases|") AllStuff[what]=nil else user:SendData(Bot, "release numbered "..what.." wasn't found in the releases|") end else user:SendData(parseenv(user,env,Bot).. "I need the ID number to delete an entry.|") end end) SaveRel() ReloadRel() end function SaveRel() local f= io.open(file,"w+") for i=1,Count do if AllStuff[i] then f:write(AllStuff[i][1].."$"..AllStuff[i][2].."$"..AllStuff[i][3].."$"..AllStuff[i][4].."\n") end end f:flush() f:close(f) end function ReloadRel() OpenRel() ShowRel(NewestStuff) ShowRel(AllStuff) end function DelRelOld(user, what) Okie = nil local title for a,b in AllStuff do title=b[4] if title == what then AllStuff[a]=nil user:SendData(Bot, what.." is removed from the releases|") Okie = 1 break end end if Okie then SaveRel() ReloadRel() else user:SendData(Bot, what.." wasn't found in the releases|") end end function SearchRel(user,what) local res=0 local rest={} local _,_,bdc=string.find(what,"([%%%[%]%(%)%*%+%-%?%^])") local msg="\r\n---------- You searched for keyword \""..what.."\". The results: ----------\r\n" if bdc then user:SendData(Bot,"you cannot use the character "..bdc) return end for a,b in AllStuff do if string.find(b[4],what) then table.insert(rest,{b[1],b[2],b[3],b[4]}) end end if table.getn(rest)~=0 then for i=1,table.getn(rest) do local type,who,when,title=rest[i][1],rest[i][2],rest[i][3],rest[i][4] res= res + 1 msg = msg.."\r\n "..when.." -- "..who.." -- "..title end msg=msg.."\r\n\r\n"..res.." results." else msg=msg.."\r\nSearch string "..what.." was not found in releases database." end user:SendPM(Bot,msg) end function OnError(ErrorMsg) if enabledebug==1 then for f=1,table.getn(senddebugto) do SendPmToNick(senddebugto[f],Bot, ErrorMsg.."\r\n".."Stack traceback: "..debug.traceback()) end end end OpConnected=NewUserConnected