plz plz help with this problem of mine....read in..
 

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

plz plz help with this problem of mine....read in..

Started by GaMeFaNaTiC, 26 October, 2003, 12:20:24

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

GaMeFaNaTiC

function doalbums(user)
	if (not user.bOperator) or (user.bOperator) then
		local albums =""
		readfrom("TUNEZ/albums.txt")
		while 1 do
		local line = read()
			if (line == nil) then 
			break
			else
			albums = albums..line.."\r\n"
			end
			end
		SendPmToNick(user.sName, Bot, albums)
		readfrom()
	end
end


This bit lets you do !albums and reads wteva is in the text file. now i want to knw if you can add an extra line so you can use a !addalbum feature in main instead of writing names in the text file. also can u change this bit so only ops can do it. plzzz help. thnks !!!!!!!!!!

Flux

I can't help u editing the script as i am not that advanced, but why don't you try this script freshstuff-v.2.54 many people use it there hubs for adding Mp3's to vinyls CDA Moviez etc. I use an older version which i have edited to bring character to the hub since i run a DJ hub.
You should be able to find the scripts here http://217.120.180.188/forum4/index.php.

I apologize if this is not what you exactly want and i hope that you will get the help of this small script.. ;)  ;)
? Official HoD Website - http://www.houseofdance.net
? Official HoD Hub Community -  hodhub.dyndns.org:2007

GaMeFaNaTiC

ive used that befor but this seems to be better if ther was a add feature.

pHaTTy

function doalbums(user)
	if user.bOperator then
		local albums =""
		readfrom("TUNEZ/albums.txt")
		while 1 do
		local line = read()
			if (line == nil) then 
			break
			else
			albums = albums..line.."\r\n"
			end
			end
		SendPmToNick(user.sName, Bot, albums)
		readfrom()
	end
end

but im not sure what you mean about the add to name of album :S
Resistance is futile!

Tuben

#4
Post the hole script ;)

You need too load the hole Txt whit the albums in a table..

Then Txt in a

Album = {}

But cant help if you dont post the script..

and hove it looks in the Album.txt ;)

-Dark-Mind-[ DOWNLOAD ]

GaMeFaNaTiC

lol by add smthing i mean. say wen u wna add text to !albums then people can see the latest albums for example Obie Trice - Cheers. to do this, i have to write that text in the txt file called albums. now in order for all the ops to do this, i need smthing that can make a new command called !addalbum ...... e.g. !addalbum Obie Trice - Cheers. this then adds the text to the txt file and itz added to !albums.

p.s. itz part of the skybot... so the script will be longgg...

Tuben

Then i can make a little script in the side..

So you se hove a mean maybe not good but ;)
-Dark-Mind-[ DOWNLOAD ]

GaMeFaNaTiC

i also found this in the script which is similar to what i want. but it is to add and remove vips etc. i also wnted a delete feature which this has.. can some1 change it so it read albums.txt and adds to tht and deletes to tht .

--// Read Level
function ReadVips()
	readfrom("CHANNEL-COMMNDS/vips.lst")
	while 1 do 
		local line = read() 
		if line == nil then
			break 
		else 
			VipsTotal = VipsTotal + 1
			rawset(VipsList,VipsTotal,line)
		end 
	end 
	readfrom() 
end
function ReadSuperOps()
	readfrom("CHANNEL-COMMNDS/superops.lst")
	while 1 do 
		local line = read() 
		if line == nil then
			break 
		else 
			SuperOpsTotal = SuperOpsTotal + 1
			rawset(SuperOpsList,SuperOpsTotal,line)
		end 
	end 
	readfrom() 
end
function ReadAdmin()
	readfrom("CHANNEL-COMMNDS/admin.lst")
	while 1 do 
		local line = read() 
		if line == nil then
			break 
		else 
			AdminTotal = AdminTotal + 1
			rawset(AdminList,AdminTotal,line)
		end 
	end 
	readfrom() 
end
--// Write Level
function WriteVips()
	writeto("SkyBot/vips.lst") 
	for i=1,VipsTotal,1 do
		write(rawget(VipsList,i).."\n") 
	end
	writeto() 
end 
function WriteSuperOps()
	writeto("SkyBot/superops.lst") 
	for i=1,SuperOpsTotal,1 do
		write(rawget(SuperOpsList,i).."\n") 
	end
	writeto() 
end 
function WriteAdmin()
	writeto("SkyBot/admin.lst") 
	for i=1,AdminTotal,1 do
		write(rawget(AdminList,i).."\n") 
	end
	writeto() 
end 
--// Delete Level
function DeleteVips(Nick)
	errlvl = 1
	for i=1,VipsTotal,1 do
		if rawget(VipsList,i) == Nick then
			if i ~= VipsTotal then
				rawset(VipsList,i,rawget(VipsList,VipsTotal))
			end
			VipsTotal = VipsTotal - 1
			SortVips()
			WriteVips()
			errlvl = 0
			break
		end
	end
	-- returns 1 if Vips could not be found
	return errlvl
end
function DeleteSuperOp(opNick)
	errlvl = 1
	for i=1,SuperOpsTotal,1 do
		if rawget(SuperOpsList,i) == opNick then
			if i ~= SuperOpsTotal then
				rawset(SuperOpsList,i,rawget(SuperOpsList,SuperOpsTotal))
			end
			SuperOpsTotal = SuperOpsTotal - 1
			SortSuperOps()
			WriteSuperOps()
			errlvl = 0
			break
		end
	end
	-- returns 1 if SuperOp could not be found
	return errlvl
end
function DeleteAdmin(opNick)
	errlvl = 1
	for i=1,AdminTotal,1 do
		if rawget(AdminList,i) == opNick then
			if i ~= AdminTotal then
				rawset(AdminList,i,rawget(AdminList,SuperOpsTotal))
			end
			AdminTotal = AdminTotal - 1
			SortAdmin()
			WriteAdmin()
			errlvl = 0
			break
		end
	end
	-- returns 1 if Admin level could not be found
	return errlvl
end

Tuben

You can try this.


BotName = "-Album_Databas-"

function Main()
frmHub:RegBot(BotName)
LoadAlbum()
end

Albums = "Albums.ini"


AlbumArray = {}


function LoadAlbum()
readfrom(Albums)
	while 1 do
		local line = read()
		if line == nil then
			break
		else
		         iGrupp = strsub(line, 1, strfind(line, ";")-1)
                         iAlbum = strsub(line, strfind(line, ";")+1,-1)			
			 AlbumArray[iGrupp] = iAlbum
			
		end
	end
	readfrom()
end

function WriteAlbum()
	local handle = openfile(Albums,"w")
		for iGrupp,iAlbum in AlbumArray do
			write(handle,""..iGrupp..";"..iAlbum.."\r\n")
			writeto()
		end
	closefile(handle)
	end	
function GetArgs2(sdata)
	local _,_, arg1,arg2 = strfind(sdata,"%S+%s+%S+%s+(.*);(.*)")
return arg1,arg2
end
function GetArgs5(sdata)
	local _,_, arg4,arg5 = strfind(sdata,"$To:%s+%S+%s+From:%s+%S+%s+$%S+%s+%S+%s+(.*);(.*)")
return arg4,arg5
end
function DataArrival(curUser,sdata)


if (strsub(sdata,1,4) == "$To:") or strfind(sdata,"<")  then 
	sdata = strsub(sdata,1,-2)
	local _,_,   check,cmd = strfind(sdata,"$To:+%s+(%S+)%s+From:+%s+%S+%s+$+%S+%s+(%S+)")
	local _,_,   cmd = strfind(sdata,"%b<>%s+(%S+)")		
	if (check == BotName) or (strsub(sdata,1,1) ~= "$")  then
	
if cmd == "!albums" then
Redalbums(curUser)

elseif cmd=="!searchgrupp" then 
SearchGrupp(curUser,sdata)

elseif cmd == "!addalbum" and curUser.bOperator  then
AddAlbum(cmd,curUser,sdata)
end
end
end
end

function AddAlbum(cmd,curUser,sdata)
if strsub(sdata,1,4) == "$To:" then
arg1,arg2=GetArgs5(sdata)
else
arg1,arg2=GetArgs2(sdata)
end


if arg1==nil or arg2==nil then
curUser:SendData(BotName,"SyntaX is wrong...")
return 1
end
for i,n in AlbumArray do
if n == arg2 then
curUser:SendData(BotName,"The Album ( "..arg2.." ) alredady exist in the file..")
return 1
end
end
appendto(Albums)
write("\r\n"..arg1..";"..arg2)
writeto()
LoadAlbum()
SendToOps(BotName,"New album is added: "..arg1.." - "..arg2)
end

		
function Redalbums(curUser)
	readfrom(Albums)
	local message = ""
	while 1 do
	local line = read()
	if (line == nil) then  break  else	
	message = message..line.."\r\n"	
	Suba = gsub(message,";"," - ")
	end
	end
	curUser:SendPM(BotName,"\r\nHer you have all albums in the DataBas.\r\n\r\n"..Suba)
	end

Commands is. !addalbum ;

!albums

And you must do a Albums.ini

and wite at the first line Grupp;Album
-Dark-Mind-[ DOWNLOAD ]

GaMeFaNaTiC

elo again... thnks for this script but what it grup :S and how to i make a albums.ini file ? wher do i hav to put it.

Tuben

-Dark-Mind-[ DOWNLOAD ]

GaMeFaNaTiC

ok got it now wt is grup.... can i also delete or is it only add.... thnks

GaMeFaNaTiC

yo tuben dnt wry mate.. i just wnted a feature that can write in main and txt wil go to the txt file. from the skybot. dint wnt to make other scripts. i use skybot 0.2 if some1 knws how to make a write function to the albums thn plz help. thnks :D

Tuben

Only to add.

!addalbum ;
-Dark-Mind-[ DOWNLOAD ]

Tuben

#14
I now ;))

;PPP

But i had it in my Hdd ;))

This one have a search funktion also ;))

BotName = "-Album_Databas-"

function Main()
frmHub:RegBot(BotName)
LoadAlbum()
end

Albums = "Albums.ini"


AlbumArray = {}


function LoadAlbum()
readfrom(Albums)
	while 1 do
		local line = read()
		if line == nil then
			break
		else
		         iGrupp = strsub(line, 1, strfind(line, ";")-1)
                         iAlbum = strsub(line, strfind(line, ";")+1,-1)			
			 AlbumArray[iGrupp] = iAlbum
			
		end
	end
	readfrom()
end

function WriteAlbum()
	local handle = openfile(Albums,"w")
		for iGrupp,iAlbum in AlbumArray do
			write(handle,""..iGrupp..";"..iAlbum.."\r\n")
			writeto()
		end
	closefile(handle)
	end	
function GetArgs2(sdata)
	local _,_, arg1,arg2 = strfind(sdata,"%S+%s+%S+%s+(.*);(.*)")
return arg1,arg2
end
function GetArgs1(sdata)
	local _,_, arg1 = strfind(sdata,"%S+%s+%S+%s+(.*)")
return arg1
end
function GetArgs4(sdata)
	local _,_, arg4 = strfind(sdata,"$To:%s+%S+%s+From:%s+%S+%s+$%S+%s+%S+%s+(.*)")
return arg4
end
function GetArgs5(sdata)
	local _,_, arg4,arg5 = strfind(sdata,"$To:%s+%S+%s+From:%s+%S+%s+$%S+%s+%S+%s+(.*);(.*)")
return arg4,arg5
end
function DataArrival(curUser,sdata)


if (strsub(sdata,1,4) == "$To:") or strfind(sdata,"<")  then 
	sdata = strsub(sdata,1,-2)
	local _,_,   check,cmd = strfind(sdata,"$To:+%s+(%S+)%s+From:+%s+%S+%s+$+%S+%s+(%S+)")
	local _,_,   cmd = strfind(sdata,"%b<>%s+(%S+)")		
	if (check == BotName) or (strsub(sdata,1,1) ~= "$")  then
	
if cmd == "!albums" then
Redalbums(curUser)

elseif cmd=="!searchgroup" then 
SearchGrupp(curUser,sdata)

elseif cmd=="!searchalbum" then 
SearchAlbum(curUser,sdata)

elseif cmd == "!addalbum" and curUser.bOperator  then
AddAlbum(cmd,curUser,sdata)
end
end
end
end

function AddAlbum(cmd,curUser,sdata)
if strsub(sdata,1,4) == "$To:" then
arg1,arg2=GetArgs5(sdata)
else
arg1,arg2=GetArgs2(sdata)
end


if arg1==nil or arg2==nil then
curUser:SendData(BotName,"SyntaX is wrong...")
return 1
end
for i,n in AlbumArray do
if n == arg2 then
curUser:SendData(BotName,"The Album ( "..arg2.." ) alredady exist in the file..")
return 1
end
end
appendto(Albums)
write("\r\n"..arg1..";"..arg2)
writeto()
LoadAlbum()
SendToOps(BotName,"New album is added: "..arg1.." - "..arg2)
end

		
function Redalbums(curUser)
	readfrom(Albums)
	local message = ""
	while 1 do
	local line = read()
	if (line == nil) then  break  else	
	message = message..line.."\r\n"	
	Suba = gsub(message,";"," - ")
	end
	end
	curUser:SendPM(BotName,"\r\nHer you have all albums in the DataBas.\r\n\r\n"..Suba)
	end


	function SearchGrupp(curUser,sdata)
		if strsub(sdata,1,4) == "$To:" then
		arg1=GetArgs4(sdata)
			else
		arg1=GetArgs1(sdata)
		end
		if arg1==nil then 
			curUser:SendData(BotName,"The syntax is wrong...")
		return 1
		end
		for i,n in AlbumArray do
		if strfind(i,arg1) then
		curUser:SendPM(BotName,"\r\nI have found this matches too the search for the group "..arg1.."\r\n"..strrep("~",40).."\r\n\r\n"..i.." - "..n)
end
			
			
			
			end
		end

	function SearchAlbum(curUser,sdata)
		if strsub(sdata,1,4) == "$To:" then
		arg1=GetArgs4(sdata)
		else
		arg1=GetArgs1(sdata)
		end
		if arg1==nil then 
			curUser:SendData(BotName,"The syntax is wrong...")
		return 1
		end
		for i,n in AlbumArray do
		if strfind(n,arg1) then
		curUser:SendPM(BotName,"\r\nI have found this matches too the search for the album "..arg1.."\r\n"..strrep("~",40).."\r\n\r\n"..i.." - "..n)
end
			
			
			
			end
		end


Dostn mather but it works ..So why dont use it..

!searchalbum and !searchgroup ;))))))

Have a nice day..

"Edit"

Why dont you do it a Cp can do it ;))
-Dark-Mind-[ DOWNLOAD ]

SMF spam blocked by CleanTalk