hi there..
this is my present release bot script..
it gives me all the releases in the release.txt file...
but i only want the last 30 releases...
can someone help me with this...
any help will be appriciated...
thanks alot
sBot = "-Rls-Bot-"
timedate = date()
file = "releases.txt"
display1 = "Item"
display2 = "Description"
display3 = "Releases"
function Main()
frmHub:RegBot(sBot)
end
function DataArrival(user, data)
if (strsub(data, 1, 1) == "<" ) then
data=strsub(data,1,strlen(data)-1)
_,_,cmd=strfind(data, "%b<>%s+(%S+)")
if (cmd=="+rls") then
ReadRelease(user, data, cmd)
return 1
elseif (cmd=="+add") then
if user.bOperator or user.iProfile == 2 then
s,e,cmd,release,desc = strfind( data, "%b<>%s+(%S+)%s+(%S+)%s+(.+)" )
if desc == nil then
description = "No "..display2.." specified!"
s,e,cmd,release = strfind( data, "%b<>%s+(%S+)%s+(%S+)" )
else
description = desc
end
if release == nil then
user:SendData(sBot, "*** No "..display1.." specified!")
return 1
end
News("By: "..user.sName.."\t Date: "..timedate.."\r\n"..display1..": "..release.."\r\n"..display2..": "..description.."\r\n")
SendToAll(sBot, "New "..display3.." Added....By <"..user.sName.."> Type +rls in Main-Chat to show "..display1..".")
return 1
else
user:SendData(sBot, "*** +add is only availible to [VIP] and above!")
return 1
end
end
end
end
function ReadRelease(user, data, cmd)
local release = ""
readfrom(file)
while 1 do
local line = read()
if (line == nil) then
break
else
release = release.." "..line.."\r\n"
end
end
user:SendPM(sBot, "\r\n\r\n".." "..display3.."s posted by users: ".."\r\n\r\n"..release)
readfrom()
end
function News(what)
appendto(file)
write(what.."\n")
writeto()
end
This might work, haven't tried it, did it in 5min in school so enjoy!
sBot = "-Rls-Bot-"
timedate = date()
file = "releases.txt"
temp = {n=0}
display1 = "Item"
display2 = "Description"
display3 = "Releases"
function Main()
frmHub:RegBot(sBot)
end
function DataArrival(user, data)
if (strsub(data, 1, 1) == "<" ) then
data=strsub(data,1,strlen(data)-1)
_,_,cmd=strfind(data, "%b<>%s+(%S+)")
if (cmd=="+rls") then
ReadRelease(user, data, cmd)
return 1
elseif (cmd=="+add") then
if user.bOperator or user.iProfile == 2 then
s,e,cmd,release,desc = strfind( data, "%b<>%s+(%S+)%s+(%S+)%s+(.+)" )
if desc == nil then
description = "No "..display2.." specified!"
s,e,cmd,release = strfind( data, "%b<>%s+(%S+)%s+(%S+)" )
else
description = desc
end
if release == nil then
user:SendData(sBot, "*** No "..display1.." specified!")
return 1
end
News("By: "..user.sName.."\t Date: "..timedate.."\r\n"..display1..": "..release.."\r\n"..display2..": "..description.."\r\n")
SendToAll(sBot, "New "..display3.." Added....By <"..user.sName.."> Type +rls in Main-Chat to show "..display1..".")
return 1
else
user:SendData(sBot, "*** +add is only availible to [VIP] and above!")
return 1
end
end
end
end
function ReadRelease(user, data, cmd)
local release = ""
readfrom(file)
while 1 do
local line = read()
if (line == nil) then
break
else
tinsert(temp, line)
end
end
c1,c2 = 10, temp.n
for i = 1,getn(temp) do
if c1 == 10 then
release = release.." "..temp[c2].."\r\n"
c1 = c1 - 1
c2 = c2 - 1
else
release = release.." "..temp[c2].."\r\n"
c1 = c1 - 1
c2 = c2 - 1
end
if c1 == 0 then break end
end
user:SendPM(sBot, "\r\n\r\n".." "..display3.."s posted by users: ".."\r\n\r\n"..release)
readfrom()
temp = nil
temp = {n=0}
end
function News(what)
appendto(file)
write(what.."\n")
writeto()
end
/NightLitch
thanks alot mate..
i found one done by nerbos and it is way more than what i wanted....
thanks alot for your time and effort.. i will use your and see how it works...
thank you soo much again ...
peace