users favourite music script
 

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

users favourite music script

Started by Arthur Gram, 08 May, 2005, 17:38:41

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Arthur Gram

Hi
    Could someone point me in the direction of a script where users can add there fav tunes to a list and other people can view this list. I have seen this in hubs before where people type !addfav to add stuff to their list, and when they or other people want to view this list they type !fav usersnamehere e.g !fav ArthurGram. They can also delete tunes from their favs using command like !delfav whattheyaredeleting. Anyone know where i could get a script like this?

Cheers in advance

jiten

QuoteOriginally posted by Arthur Gram
Hi
    Could someone point me in the direction of a script where users can add there fav tunes to a list and other people can view this list. I have seen this in hubs before where people type !addfav to add stuff to their list, and when they or other people want to view this list they type !fav usersnamehere e.g !fav ArthurGram. They can also delete tunes from their favs using command like !delfav whattheyaredeleting. Anyone know where i could get a script like this?

Cheers in advance
Search the forum for "freshstuff".
It will suit your needs perfectly.

Cheers

Arthur Gram

nah not freshstuff i got that already what i want is more a database for each users favourite which is associated with there name in the hub, to do what i want with freshstuff all users would have to have there own section on the list? what i want is more each user has there own database and therefore there own note file for each of them. Get me?

plop

QuoteOriginally posted by Arthur Gram
nah not freshstuff i got that already what i want is more a database for each users favourite which is associated with there name in the hub, to do what i want with freshstuff all users would have to have there own section on the list? what i want is more each user has there own database and therefore there own note file for each of them. Get me?
sounds like freshstuff 4.x but with a more advanced db.
cool idea btw.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

Arthur Gram

ok i found a script to do what i want its a fucking proper good script, only thing missing is i want it show latest releases on entry anyone care to have a go at getting it to do this i been trying for ages with no luck.

Thanks in advance, here it is;

--------------------------------------------------------------------------------------------------------------------------
-- Database Bot v 0.8
-- for ptokax 3.2.6
-- by toen
-- 2k4
-------------------
-- Settings --
-------------------

Bot = "?PG?"

-- 0=disabled,1=guests,2=regged,3=vips,4=ops,5=mods,6=admins
VSHOWFAV = 2
VSHOWFRESH = 2
VSHOWBIGGUP = 2
VSHOWHELP = 2
VADDDATA = 3
VDELDATA =3
VSEARCHDATA = 2

maxl = 100 -- max lines saved in the fresh lists

cmd1 = "fresh"
cmd2 = "fav"
cmd3 = "biggup"
cmd4 = "add"
cmd5 = "del"
cmd6 = "cmd"
cmd7 = "cmd"
cmd8 = "search"

cmdvisible = 1 -- 0=on,1=off

favdir = "Database/fav/"
freshdir = "Database/fresh/"
biggupdir = "Database/biggup/"
helpdir = "Database/help/"
triggerdir = "Database/triggers/"


syntaxerr = "Wrong synthax. Type !cmd for further assistance. |"
rightserr = "You do not have sufficient rights to run that command!|"
disabled = "That command is disabled. |"


triggers={} --initialisation

-------------------
-- Main function --
-------------------

function Main ()
frmHub:RegBot(Bot)
TextLoad(triggerdir.."triggers.dat",triggers)
end

function NewUserConnected(user)
user:SendData(Bot, "=-- ATTENTION RIGHT CLICK MENU ENABLED, right click hub tab or write !cmd for your commands.")
UserCmds(user)
end

function OpConnected(user)
NewUserConnected(user)
end

function UserCmds(user)
user:SendData("$UserCommand 0 1 ||")
user:SendData("$UserCommand 1 1 ?PG?\\Show\\Current month$<%[mynick]> !fresh||")
user:SendData("$UserCommand 1 1 ?PG?\\Show\\Singles/ EPs$<%[mynick]> !fresh s||")
user:SendData("$UserCommand 1 1 ?PG?\\Show\\Albums/ Compilations$<%[mynick]> !fresh a||")
user:SendData("$UserCommand 1 1 ?PG?\\Show\\Mixes$<%[mynick]> !fresh m||")
user:SendData("$UserCommand 1 1 ?PG?\\Show\\User Productions$<%[mynick]> !fresh u||")
user:SendData("$UserCommand 1 1 ?PG?\\Show\\Web links$<%[mynick]> !fresh w||")
user:SendData("$UserCommand 1 1 ?PG?\\Search:$<%[mynick]> !search %[line: String]||")
user:SendData("$UserCommand 1 1 ?PG?\\Add\\Single / EP:$<%[mynick]> !add fresh s %[line:Entry]||")
user:SendData("$UserCommand 1 1 ?PG?\\Add\\Album / Compilation:$<%[mynick]> !add fresh a %[line:Entry]||")
user:SendData("$UserCommand 1 1 ?PG?\\Add\\Mix:$<%[mynick]> !add fresh m %[line:Entry]||")
user:SendData("$UserCommand 1 1 ?PG?\\Add\\User Production:$<%[mynick]> !add fresh u %[line:Entry]||")
user:SendData("$UserCommand 1 1 ?PG?\\Add\\Weblink:$<%[mynick]> !add fresh w %[line:Entry]||")
user:SendData("$UserCommand 1 1 ?PG?\\Delete\\Single / EP:$<%[mynick]> !del fresh s %[line:Entry]||")
user:SendData("$UserCommand 1 1 ?PG?\\Delete\\Album / Compilation / EP:$<%[mynick]> !del fresh a %[line:Entry]||")
user:SendData("$UserCommand 1 1 ?PG?\\Delete\\Mix:$<%[mynick]> !del fresh m %[line:Entry]||")
user:SendData("$UserCommand 1 1 ?PG?\\Delete\\User Productions:$<%[mynick]> !del fresh u %[line:Entry]||")
user:SendData("$UserCommand 1 1 ?PG?\\Delete\\Weblink:$<%[mynick]> !del fresh w %[line:Entry]||")
user:SendData("$UserCommand 0 2 ||")
user:SendData("$UserCommand 1 2 ?PG?\\User Favorites\\User Favs$<%[mynick]> !fav %[nick]||")
user:SendData("$UserCommand 1 1 ?PG?\\User Favorites\\Add:$<%[mynick]> !add fav %[line:Entry]||")
user:SendData("$UserCommand 1 1 ?PG?\\User Favorites\\Del:$<%[mynick]> !del fav %[line:Entry]||")
user:SendData("$UserCommand 1 1 ?PG?\\User Favorites\\Show users that have some fav added:$<%[mynick]> !fav||")
user:SendData("$UserCommand 1 1 ?PG?\\Help$<%[mynick]> !cmd||")
end


------------------
-- Data Arrival --
------------------

function DataArrival(user,data)

whoTo,cmd,arg,arg2,arg3=nil,nil,nil,nil,nil

returndata = 0


-- get args from main chat
if (strsub(data,1,1)=="<") then

data=strsub(data,1,strlen(data)-1)

s,e,cmd = strfind(data,"%b<>%s+(%S+)")
s,e,arg = strfind(data,"%b<>%s+%S+%s+(.*)")
if arg ~= nil then
s,e,arg2 = strfind(data,"%b<>%s+%S+%s+%S+%s+(.*)")
if arg2 ~= nil then
s,e,arg,arg2 = strfind(data,"%b<>%s+%S+%s+(%S+)%s+(.*)")
s,e,arg3 = strfind(data,"%b<>%s+%S+%s+%S+%s+%S+%s+(.*)")
if arg3 ~= nil then
s,e,arg,arg2,arg3 = strfind(data,"%b<>%s+%S+%s+(%S+)%s+(%S+)%s+(.*)")
end
end
end
end

-- get args from pm
if(strsub(data, 1, 4) == "$To:") then
data=strsub(data,1,strlen(data)-1)
s,e,whoTo = strfind(data,"$To:%s+(%S+)")
if (whoTo == Bot) then
s,e,cmd = strfind(data,"$To:%s+%S+%s+From:%s+%S+%s+$%b<>%s+(%S+)")
s,e,arg = strfind(data,"$To:%s+%S+%s+From:%s+%S+%s+$%b<>%s+%S+%s+(.*)")
if arg ~= nil then
s,e,arg2 = strfind(data,"$To:%s+%S+%s+From:%s+%S+%s+$%b<>%s+%S+%s+%S+%s+(.*)")
if arg2 ~= nil then
s,e,arg,arg2 = strfind(data,"$To:%s+%S+%s+From:%s+%S+%s+$%b<>%s+%S+%s+(%S+)%s+(.*)")
s,e,arg3 = strfind(data,"$To:%s+%S+%s+From:%s+%S+%s+$%b<>%s+%S+%s+%S+%s+%S+%s+(.*)")
if arg3 ~= nil then
s,e,arg,arg2,arg3 = strfind(data,"$To:%s+%S+%s+From:%s+%S+%s+$%b<>%s+%S+%s+(%S+)%s+(%S+)%s+(.*)")
end
end
end
end
end

user:SendData(bot, cmd)
user:SendData(bot, arg)
user:SendData(bot, arg2)
user:SendData(bot, arg3)

-- Script Commands --


if (cmd=="!"..cmd1 or cmd=="+"..cmd1) then
ShowFresh(user,arg)
returndata = cmdvisible

elseif (cmd=="!"..cmd2 or cmd=="+"..cmd2) then
ShowFav(user,arg)
returndata = cmdvisible

elseif (cmd=="!"..cmd3 or cmd=="+"..cmd3) then
ShowBiggup(user)
returndata = cmdvisible

elseif (cmd=="!"..cmd6 or cmd=="+"..cmd6 or cmd=="?"..cmd6 or cmd=="!"..cmd7) then
ShowHelp(user)
returndata = cmdvisible

elseif (cmd=="!"..cmd4 or cmd=="+"..cmd4) then
AddData(user,arg,arg2,arg3)
returndata = cmdvisible

elseif (cmd=="!"..cmd5 or cmd=="+"..cmd5) then
DelData(user,arg,arg2,arg3)
returndata = cmdvisible

elseif (cmd=="!"..cmd8 or cmd=="+"..cmd8) then
SearchData(user,arg, freshdir.."singles.txt"," SINGLEs/EPs ")
SearchData(user,arg, freshdir.."albums.txt"," ALBUMs/LPs ")
SearchData(user,arg, freshdir.."mixes.txt"," MIXEs ")
SearchData(user,arg, freshdir.."users.txt","USER PRODUCTIONs")
SearchData(user,arg, freshdir.."weblinks.txt"," WEBLINKs ")
returndata = cmdvisible

else for x=1,getn(triggers) do
if cmd=="!"..triggers[x] then
SendToAll(Bot,"\r\n"..fileshow(nil,triggerdir.."/"..triggers[x]..".txt"))
end
end
end

return returndata
end



--------------------------------------
-- Search Data --
--------------------------------------
function SearchData(user,arg, file, caption)
if VSEARCHDATA ~= 0 then
if VSEARCHDATA <= CheckUserLevel(user) then
if arg=="" then --check for right parameters
user:SendPM(Bot, syntaxerr)
return
else local ha=readfrom(file)
local tmp = "\r\n=------------------------------------------------------------------------------------ "..caption.." --------------------------------------------------------------------------------------="
if ha then
while 1 do
local line = read(ha, "*l")
if line and (line~="") then
if strfind(strlower(line), strlower(arg),1,1) then
tmp = tmp.."\r\n"..line
end
else
break
end
end
user:SendPM(Bot,tmp)
end
end
else
user:SendPM(Bot,rightserr)
end
else user:SendPM(Bot, disabled)
end
end
--------------------------------------
-- Show Data functions --
--------------------------------------

-- Show Favorites functions --


function ShowFav(user,arg)
if VSHOWFAV ~= 0 then
if VSHOWFAV <= CheckUserLevel(user) then
ShowFavUser(user,arg)
else
user:SendPM(Bot,rightserr)
end
else user:SendPM(Bot, disabled)
end
end

function ShowFavUser (user, arg)
local file=favdir
if arg then
if arg~="" and arg~="all" then
file=file..arg..".txt"
else
ShowFavAll(user)
return
end
else
ShowFavAll(user)
return
end

local str="\r\n"
str=str.."\r\n=------------------------------------------------------------------------------------ "..arg.." ------------------------------------------------------------------------------------=\r\n"
str=str..fileshow(nil,favdir..arg..".txt").."\r\n"

if user then
user:SendPM(Bot, str.."|")
return
else
return str
end

end

function ShowFavAll(user)
file=favdir.."!nick_index.dat"
local ha=readfrom(file)
local str=""
if ha then
while ha do
local line = read(ha, "*l")
if line then
user:SendPM(Bot, line.."|")
-- str=str..ShowFavUser(nil, line)
else
break
end
end
closefile(ha)
user:SendPM(Bot, str.."|")
end
end


-- Show Fresh function --

function ShowFresh(user,arg)
if VSHOWFRESH ~= 0 then
if VSHOWFRESH <= CheckUserLevel(user) then
if (arg ~= nil) then
if arg == "s" then
str = "=------------------------------------------------------------------------------------ SINGLEs/EPs --------------------------------------------------------------------------------------=\r\n\r\n"
user:SendPM(Bot,str..fileshow(nil, freshdir.."singles.txt"))
elseif arg == "a" then
str = "=------------------------------------------------------------------------------------ ALBUMs/LPs ---------------------------------------------------------------------------------------=\r\n\r\n"
user:SendPM(Bot,str..fileshow(nil, freshdir.. "albums.txt"))
elseif arg == "m" then
str = "=---------------------------------------------------------------------------------------- MIXEs ------------------------------------------------------------------------------------------------=\r\n\r\n"
user:SendPM(Bot,str..fileshow(nil, freshdir.."mixes.txt"))
elseif arg == "u" then
str = "=---------------------------------------------------------------- USER PRODUCTIONs ----------------------------------------------------------------=\r\n\r\n"
user:SendPM(Bot,str..fileshow(nil, freshdir.."users.txt"))
elseif arg == "w" then
str = "=------------------------------------------------------------------------------------------ WEBLINKs ------------------------------------------------------------------------------------------=\r\n\r\n"
user:SendPM(Bot,str..fileshow(nil, freshdir.."weblinks.txt"))
end

else arg = date("%B-%Y")
user:SendPM(Bot,"Search: "..arg)
SearchData(user,arg, freshdir.."singles.txt"," SINGLEs/EPs ")
SearchData(user,arg, freshdir.."albums.txt"," ALBUMs/LPs ")
SearchData(user,arg, freshdir.."mixes.txt"," MIXEs ")
SearchData(user,arg, freshdir.."users.txt","USER PRODUCTIONs")
SearchData(user,arg, freshdir.."weblinks.txt"," WEBLINKs ")

end
else
user:SendPM(Bot,rightserr)
end
else user:SendPM(Bot, disabled)
end
end


-- Show Biggup function --

function ShowBiggup(user)
if VSHOWBIGGUP ~= 0 then
if VSHOWBIGGUP <= CheckUserLevel(user) then
str = "=------------------------------------------------------------------------------------ BIGGUPs --------------------------------------------------------------------------------------=\r\n\r\n"
user:SendPM(Bot,str..fileshow(nil,biggupdir.."biggups.txt"))

else
user:SendPM(Bot,rightserr)
end
else user:SendPM(Bot, disabled)
end
end

function ShowHelp(user)
if VSHOWHELP ~= 0 then
if VSHOWHELP <= CheckUserLevel(user) then
str = "\r\n\r\n"
user:SendPM(Bot,str..fileshow(nil,helpdir.."dbhelp.txt")..fileshow(nil,triggerdir.."/triggers.txt"))


end
end
end

------------------------------------------------------------------------
------------------------------------------------------------------------------

Arthur Gram

--------------------------------------
-- Add Data functions --
--------------------------------------

function AddData(user,arg,arg2,arg3)
lvl = CheckUserLevel(user)
if VADDDATA ~= 0 then
if VADDDATA <= lvl then
if arg == "fresh" then
if arg2 == "s" then file=freshdir.."singles.txt"
fileweb=freshdir.."singles_web.txt"
elseif arg2 == "a" then file=freshdir.."albums.txt"
fileweb=freshdir.."albums_web.txt"
elseif arg2 == "m" then file=freshdir.."mixes.txt"
fileweb=freshdir.."mixes_web.txt"
elseif arg2 == "u" then file=freshdir.."users.txt"
fileweb=freshdir.."users_web.txt"
elseif arg2 == "w" then file=freshdir.."weblinks.txt"
fileweb=freshdir.."weblinks_web.txt"
else user:SendPM(Bot, syntaxerr)
end
AddFresh(user,file,fileweb,arg3)

elseif arg == "fav" then
if arg3 == nil then
AddFav(user,arg2)
else AddFav(user,arg2.." "..arg3)
end
elseif arg == "biggup" then
if arg3 == nil then
AddBiggup(user,arg2)
else AddBiggup(user,arg2.." "..arg3)
end
else user:SendPM(Bot, syntaxerr)
end

else user:SendPM(Bot,rightserr)
end
else user:SendPM(Bot, disabled)
end
end

-- Add Biggup function --

function AddBiggup (user, entry)
if entry=="" then --check for right parameters
user:SendPM(Bot, syntaxerr)
return
else local file=biggupdir.."biggups.txt" --writing block
local fh=appendto(file)
write(fh, date("%d-%B-%Y").." * "..user.sName.." * "..entry.."\n")
closefile(fh)
user:SendPM(Bot, "***ADDED***")
end
end


-- Add Fav function --

function AddFav (user, entry)
if entry=="" then --check for right parameters
user:SendPM(Bot, syntaxerr)
return
else local file=favdir..user.sName..".txt"
local ha=readfrom(file)

if ha then --DUPES CHECK
while ha do
local line = read(ha, "*l")
if line then
x, y, dat, entryR = strfind(line, "(.+)*(.+)")
if " "..entry==entryR then
user:SendPM(Bot, user.sName..", you already added this favorite: ["..entry.. "] at "..dat)
return
end
else
break
end
end
closefile(ha)
else local fhn=appendto(favdir.."!nick_index.dat") --else adds user to INDEX file
write(fhn, user.sName.."\n")
closefile(fhn)
end


local fh=appendto(file) --writing block
write(fh, date("%d-%B-%Y").." * "..user.sName.." * "..entry.."\n")
closefile(fh)
user:SendPM(Bot, "***ADDED***")
end
end

-- Add Fresh function --

function AddFresh (user, file, fileweb, entry)
if entry=="" then --check for right parameters
user:SendPM(Bot, syntaxerr)
return
else
--dup check routine
local dups=nil
local coord=nil
local fileend=nil --needed to update file in middle
local ha=readfrom(file)
if ha then
while 1 do
local line = read(ha, "*l")
if line then
x, y, dateR, entryR = strfind(line, "(.*)*(.*)")
if x then
if entryR==" "..entry then
dups=1
end --if for alone/duplicate nick


end --if for line format
else
break
end --if for new readline
end --while for readfile
closefile(ha)
end --//dup check


--writing block
if dups then
user:SendPM(Bot, "*** ALREADY ADDED - DATE: "..dateR.." ***")
else
local fh=appendto(file)
write(fh, date("%d-%B-%Y").." * "..user.sName.." * "..entry.."\n")
closefile(fh)
user:SendPM(Bot, "***ADDED***")
SendToAll("=----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------=")
SendToAll("NEW RELEASE ADDED: \t"..entry)
SendToAll("=------------------------------------------------------------------------------------------------ use right click on hub tab to see more commands ---=")
filecut(file,maxl)

end
end
end

--------------------------------------
-- Del Data functions --
--------------------------------------

function DelData(user,arg,arg2,arg3)
lvl = CheckUserLevel(user)
if VDELDATA ~= 0 then
if VDELDATA <= lvl then
if arg == "fresh" then
if arg2 == "s" then DoDelData(user,freshdir.."singles.txt",arg3)
elseif arg2 == "a" then DoDelData(user,freshdir.."albums.txt",arg3)
elseif arg2 == "m" then DoDelData(user,freshdir.."mixes.txt",arg3)
elseif arg2 == "l" then DoDelData(user,freshdir.."users.txt",arg3)
elseif arg2 == "w" then DoDelData(user,freshdir.."weblinks.txt",arg3)
else user:SendPM(Bot, syntaxerr)
end
else if arg == "fav" then
if arg3 == nil then
DoDelData(user,favdir..user.sName..".txt",arg2)
else DoDelData(user,favdir..user.sName..".txt",arg2.." "..arg3)
end
elseif (arg == "biggup") and (lvl >= 3) then
if arg3 == nil then
DoDelData(user,biggupdir.."biggups.txt",arg2)
else DoDelData(user,biggupdir.."biggups.txt",arg2.." "..arg3)
end
else user:SendPM(Bot, syntaxerr)
end
end
else user:SendPM(Bot, rightserr)
end
else user:SendPM(Bot, disabled)
end
end


function DoDelData(user, file, entry)
local array={}
array[0]=""
local x=0

readfrom(file)
repeat x=x+1
array[x]=read()
until (array[x]==nil)
readfrom()

remove(file)

for x=0,getn(array) do

local y, z, entryR = strfind(array[x], "*(.*)")
if y then
if entryR~=" "..entry then
appendto(file)
write(array[x].."\n")
writeto()

else user:SendPM(Bot, "***DELETED***")
end
end
end
end




--------------------------------------
-- Helper functions --
--------------------------------------
function CheckUserLevel(user)
name,pass,lev=nil,nil,nil
local temp,r={},0
TextLoad("../RegisteredUsers.dat",temp)
for x=1,getn(temp) do s,e,name,pass,lev=strfind(temp[x],"(.-)\124(.-)\124(.+)")
if (user.sName==name) then
r=r+1
break
end
end

if (r==0) then
return 1 --guest
else

if lev == "0" then return 7 --hubowner
elseif lev == "6" then return 6 --admin
elseif lev == "5" then return 5 --mod
elseif lev == "1" then return 4 --op
elseif lev == "2" then return 3 --vip
elseif lev == "3" then return 2 --reg
else return 1
end


end

end

--------- Text Loaded ---------

function TextLoad(file,array,text) array[0]="" local x=0
readfrom(file)
repeat if (text) then
text=text..array[x].."\r\n"
end
x=x+1
array[x]=read()
until (array[x]==nil)
readfrom()
return text
end

function fileshow(user,filename)
local tmp =""
readfrom(filename)
while 1 do
local line = read()
if (line == nil) then
break
else
tmp = tmp..line.."\r\n"
end
end
readfrom()
if user then
user:SendPM(Bot,tmp.."|")
else
return tmp
end


end

function filecut(file, MaxT)
array={}
array[0]=""
local x=0
readfrom(file)
repeat x=x+1
array[x]=read()
until (array[x]==nil)
readfrom()
if x > MaxT then
remove(file)
for x=(getn(array)-MaxT),getn(array) do
appendto(file)
write(array[x].."\n")
writeto()
end
end
end
--------------------------------------------------------------------------

Dessamator

#6
simple, just add this line to ur newuserconnected function :


function NewUserConnected(user) 
[COLOR=blue]ShowFresh(user,"s")[/COLOR] 
user:SendData(Bot, "=-- ATTENTION RIGHT CLICK MENU ENABLED, right click hub tab or write !cmd for your commands.") 
UserCmds(user) 
end
Ignorance is Bliss.

SMF spam blocked by CleanTalk