help with freshstuff...track order..
 

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

help with freshstuff...track order..

Started by GaMeFaNaTiC, 18 December, 2003, 16:23:57

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

GaMeFaNaTiC

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

--Name this bot to anything you like 
bot = "[gG?]Network" 

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

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

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


File1 = "AlbumsAll.txt" 
File2 = "AlbumsConnect.txt" 

function Main() 
frmHub:RegBot(bot)
end

newtunes={} 

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

function NewUserConnected(curUser) 
DoNotOpenFile(curUser, File2) 

end 

function OpConnected(curUser) 
DoNotOpenFile(curUser, File2) 
end 



function DataArrival(curUser,data) 

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

if (strfind(strlower(data), strlower(cmd1))) and curUser.bOperator then 
s,e,cmd,tune = strfind( data, "%b<>%s+(%S+)%s+(.*)" ) 
if ( tune == nil or tune == "" ) then 
curUser:SendPM(bot, " If you want to add a tune type +addalbum YOURSTUFF in main chat ") 
return 1 
else 
ReadTunes1(File1) 
curtune=" [gG?] "..tune.." " 
newtunes[1]=curtune 
SendToAll(newtunes[1]) 
WriteAddtunes1(File1) 
WriteNewTunes1(File2) 
return 1 
end 
end 

if (strfind(strlower(data), strlower(cmd2))) then 
OpenFile(curUser, File1) 
end 

if (strfind(strlower(data), strlower(cmd3))) and curUser.bOperator then 
if curUser.bOperator then 
s,e,cmd,num = strfind( data, "%b<>%s+(%S+)%s+(.*)" ) 
num2=tonumber (num) 
if ( num2 == nil ) then 
curUser:SendPM(bot, " To delete a Tune type +delalbum THESTUFFNUMBER!!! in main chat ") 
return 1 

else 

ReadTunes2(File1) 
newtunes[num2]=nil 
curUser:SendPM(bot, " Tune Nr. "..num2.." was deleted.") 
WriteAddtunes1(File1) 
WriteNewTunes1(File2) 
return 1 
end 
end 
end 
end 
end 
---------------------------------------------------------------------- 
function ReadTunes1(File1) 
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 = ind+1 
newtunes[ind]=val 
line = read(handle) 
end 
closefile(handle) 
end 
end 
---------------------------------------------------------------------- 
function ReadTunes2(File1) 
local handle = openfile("txt/"..File1, "r") 
var1 = 0 
if (handle) then 
local line = read(handle) 
while line do 
var1 = var1 +1 
s,e,ind,val = strfind( line, "(%S+)%s+(.*)") 
newtunes[var1]=val 
line = read(handle) 
end 
closefile(handle) 
end 
end 
---------------------------------------------------------------------- 
function WriteAddtunes1(File1) 
local handle = openfile("txt/"..File1, "w") 
var2 = 0 
for index, value in newtunes do 
var2 = var2+1 
write(handle,var2.." "..value.."\r\n") 
if var2 == 20 then 
break 
end 
end 
closefile(handle) 
end 
---------------------------------------------------------------------- 
function WriteNewTunes1(File2) 
local handle = openfile("txt/"..File2, "w") 
var3 = 0 
for index, value in newtunes do 
var3 = var3+1 
write(handle,var3.." "..value.."\r\n") 
if var3 == 5 then 
break 
end 
end 
closefile(handle) 
end 
---------------------------------------------------------------------- 
function OpenFile(curUser, File) 
local msgfromtxt ="\r\n" 
readfrom("txt/"..File) 
while 1 do 
local line = read() 
if ( line == nil ) then 
break 
else 
msgfromtxt = msgfromtxt.." "..line.."\r\n" 
end 
end 
--end 
curUser:SendPM(bot, "\r\n".. 
"\r\n".. 
" --------- The Latest Albums -------- \r\n".. 
msgfromtxt.."\r\n".. 
" --------- The Latest Albums -------- \r\n".. 
"\r\n") 
readfrom() 
end 

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


hi.. this script works yea but i want it to do one more thing to make it perfect.. u c wen i add something like Name - Text and then hit the command +albums, the txt comes at the top (number 1). this can be a problem if there are lots of them cse the new ones wont show and the old ones wil be at the bottom. so i was wondering..  is there a way to make it come at the bottom wen u addalbum instead of the top... plzzz help.. cheers  :))

SMF spam blocked by CleanTalk