FreshStuff v.3.0...Dont work!?
 

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

FreshStuff v.3.0...Dont work!?

Started by WickeD, 03 January, 2004, 01:52:52

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

WickeD

Hi....

This fine script do only works for OP?s, Masters...and up...and not for users...why? Can eny one fix it so users can use it?

-- FreshStuff v.3.0
-- original idea/script by chilla
-- completely rewriten by plop


-- Name the commands to what U like
-- This command adds stuff, syntax : !addstuff THESTUFF2ADD
cmd1 = "!addstuff"

-- This command shows the stuff, syntax : !stuff
cmd2 = "!stuff"

-- This command deletes an entry, syntax : !delalbum THESTUFF2DELETE
cmd3 = "!delstuff"

-- This command shows the latest stuff, syntax : !newalbums
cmd4 = "!newstuff"

-- This command reloads the txt file. syntax : !reloadstuff
-- (this command is needed if you manualy edit the text file)
cmd5 = "!reloadstuff"

-- Show latest stuff on entry 1=yes, 0=no
ShowOnEntry = 1

-- Max stuff shown on newalbums/entry
MaxNew = 20

-- The file storing the stuff
file = "txt/AlbumsAll.txt"

-- Name of the bot
Bot = "[Bot]?Fresh-Stuff?"

--------------------- don't change anything below here
AllStuff = {}
NewestStuff = {}

function Main()
   frmHub:RegBot(Bot)
   Reload()
end

function NewUserConnected(user)
   if ShowOnEntry == 1 then
      user:SendPM(Bot, MsgNew.."|")
   end
end

function OpConnected(user)
   if ShowOnEntry == 1 then
      user:SendPM(Bot, MsgNew.."|")
   end
end

function DataArrival(user,data)
   if (strsub(data, 1, 1) == "<") then
      data = strsub(data,1,strlen(data)-1)
      s,e,cmd,tune = strfind(data, "%b<>%s+(%S+)%s*(.*)")
      if cmd == cmd2 then
         user:SendPM(Bot, MsgAll.."|")
         return 1
      elseif cmd == cmd4 then
         user:SendPM(Bot, MsgNew.."|")
         return 1
      elseif user.bOperator then
         if cmd == cmd3 then
            if tune ~= "" then
               DelStuff(user, tune)
            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 ~= "" then
               AddStuff(user, tune)
            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
            Reload()
            user:SendData(Bot, "Stuff reloaded!|")
            return 1
         end
      end
   end
end

function OpenStuff()
   AllStuff = nil
   NewestStuff = nil
   AllStuff = {}
   NewestStuff = {}
   Count = 0
   Count2 = 0
   readfrom(file)
   while 1 do
      local line = read()
      if ( line == nil ) then
         break
      else
         Count = Count +1
         AllStuff[Count]=line
      end
   end
   readfrom()
   if Count > MaxNew then
      local temp = Count - MaxNew + 1
      for i=temp, Count do
         Count2 = Count2 + 1
         NewestStuff[Count2]=AllStuff
      end
   else
      for i=1, Count do
         Count2 = Count2 + 1
         NewestStuff[Count2]=AllStuff
      end
   end
end

function SaveStuff()
   writeto(file)
   for i=1,Count do
      if AllStuff then
         write(AllStuff.."\n")
      end
   end
   writeto()
end

function ShowAlbums(table)
   Msg = "\r\n"
   if table == NewestStuff then
      if Count2 == 0 then
         MsgNew = "\r\n\r\n".." --------- The Latest Stuff -------- \r\nNo Stuff on the list yet\r\n --------- The Latest Stuff -------- \r\n\r\n"
      else
         for i=1, Count2 do
            Msg = Msg..NewestStuff.."\r\n"
         end
         MsgNew = "\r\n\r\n".." --------- The Latest Stuff -------- \r\n"..Msg.."\r\n --------- The Latest Stuff -------- \r\n\r\n"
      end
   else
      if Count == 0 then
         MsgAll = "\r\n\r\r\n".." --------- All The Stuff -------- \r\nNo Stuff on the list yet\r\n --------- All The Stuff -------- \r\n\r\n"
      else
         for i=1, Count do
            Msg = Msg..AllStuff.."\r\n"
         end
         MsgAll = "\r\n\r\r\n".." --------- All The Stuff -------- \r\n"..Msg.."\r\n --------- All The Stuff -------- \r\n\r\n"
      end
   end
end

function AddStuff(user, what)
   Count = Count + 1
   AllStuff[Count]=what
   user:SendData(Bot, what.." is added to the Stufflist|")
   SaveStuff()
   Reload()
end

function DelStuff(user, what)
   Okie = nil
   for a,b in AllStuff do
      if b == what then
         AllStuff[a]=nil
         user:SendData(Bot, what.." is removed from the Stufflist|")
         Okie = 1
         break
      end
   end
   if Okie then
      SaveStuff()
      Reload()
   else
      user:SendData(Bot, what.." wasn't found in the Stufflist|")
   end
end

function Reload()
   OpenStuff()
   ShowAlbums(NewestStuff)
   ShowAlbums(AllStuff)
end

//WickeD

ptaczek

So get...

[size=2]-- FreshStuff v.3.0 
-- original idea/script by chilla 
-- completely rewriten by plop 
-- public/restricted mode switch added by ptaczek Jan 03, 2004

-- Name the commands to what U like 
-- This command adds stuff, syntax : !addstuff THESTUFF2ADD 
cmd1 = "!addstuff" 

-- This command shows the stuff, syntax : !stuff 
cmd2 = "!stuff" 

-- This command deletes an entry, syntax : !delalbum THESTUFF2DELETE 
cmd3 = "!delstuff" 

-- This command shows the latest stuff, syntax : !newalbums 
cmd4 = "!newstuff" 

-- This command reloads the txt file. syntax : !reloadstuff 
-- (this command is needed if you manualy edit the text file) 
cmd5 = "!reloadstuff" 

-- Show latest stuff on entry 1=yes, 0=no 
ShowOnEntry = 1 

-- Max stuff shown on newalbums/entry 
MaxNew = 20 

-- The file storing the stuff 
file = "txt/AlbumsAll.txt" 

-- Name of the bot 
Bot = "[Bot]?Fresh-Stuff?" 

[COLOR=orangered]-- Switch for restricted/public mode
-- nil for restricted mode, 1 or any other number for public mode
-- Ex.:
-- isPublic = nil will set the script to restricted mode
-- isPublic = 1   will set the script to public mode
isPublic = nil[/color]

--------------------- don't change anything below here 
AllStuff = {} 
NewestStuff = {} 

function Main() 
	frmHub:RegBot(Bot) 
	Reload() 
end 

function NewUserConnected(user) 
	if ShowOnEntry == 1 then 
		user:SendPM(Bot, MsgNew.."|") 
	end 
end 

function OpConnected(user) 
	if ShowOnEntry == 1 then 
		user:SendPM(Bot, MsgNew.."|") 
	end 
end 

function DataArrival(user,data) 
	if (strsub(data, 1, 1) == "<") then 
		data = strsub(data,1,strlen(data)-1) 
		s,e,cmd,tune = strfind(data, "%b<>%s+(%S+)%s*(.*)") 
		if cmd == cmd2 then 
			user:SendPM(Bot, MsgAll.."|") 
			return 1 
		elseif cmd == cmd4 then 
			user:SendPM(Bot, MsgNew.."|") 
			return 1 
		elseif user.bOperator or isPublic then 
			if cmd == cmd3 then 
				if tune ~= "" then 
					DelStuff(user, tune) 
				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 ~= "" then 
					AddStuff(user, tune) 
				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 
				Reload() 
				user:SendData(Bot, "Stuff reloaded!|") 
				return 1 
			end 
		end 
	end 
end 

function OpenStuff() 
	AllStuff = nil 
	NewestStuff = nil 
	AllStuff = {} 
	NewestStuff = {} 
	Count = 0 
	Count2 = 0 
	readfrom(file) 
	while 1 do 
		local line = read() 
		if ( line == nil ) then 
			break 
		else 
			Count = Count +1 
			AllStuff[Count]=line 
		end 
	end 
	readfrom() 
	if Count > MaxNew then 
		local temp = Count - MaxNew + 1 
		for i=temp, Count do 
			Count2 = Count2 + 1 
			NewestStuff[Count2]=AllStuff[i] 
		end 
	else 
		for i=1, Count do 
			Count2 = Count2 + 1 
			NewestStuff[Count2]=AllStuff[i] 
		end 
	end 
end 

function SaveStuff() 
	writeto(file) 
	for i=1,Count do 
		if AllStuff[i] then 
			write(AllStuff[i].."\n") 
		end 
	end 
	writeto() 
end 

function ShowAlbums(table) 
	Msg = "\r\n" 
	if table == NewestStuff then 
		if Count2 == 0 then 
			MsgNew = "\r\n\r\n".." --------- The Latest Stuff -------- \r\nNo Stuff on the list yet\r\n --------- The Latest Stuff -------- \r\n\r\n" 
		else 
			for i=1, Count2 do 
				Msg = Msg..NewestStuff[i].."\r\n" 
			end 
			MsgNew = "\r\n\r\n".." --------- The Latest Stuff -------- \r\n"..Msg.."\r\n --------- The Latest Stuff -------- \r\n\r\n" 
		end 
	else 
		if Count == 0 then 
			MsgAll = "\r\n\r\r\n".." --------- All The Stuff -------- \r\nNo Stuff on the list yet\r\n --------- All The Stuff -------- \r\n\r\n" 
		else 
			for i=1, Count do 
				Msg = Msg..AllStuff[i].."\r\n" 
			end 
			MsgAll = "\r\n\r\r\n".." --------- All The Stuff -------- \r\n"..Msg.."\r\n --------- All The Stuff -------- \r\n\r\n" 
		end 
	end 
end 

function AddStuff(user, what) 
	Count = Count + 1 
	AllStuff[Count]=what 
	user:SendData(Bot, what.." is added to the Stufflist|") 
	SaveStuff() 
	Reload() 
end 

function DelStuff(user, what) 
	Okie = nil 
	for a,b in AllStuff do 
		if b == what then 
			AllStuff[a]=nil 
			user:SendData(Bot, what.." is removed from the Stufflist|") 
			Okie = 1 
			break 
		end 
	end 
	if Okie then 
		SaveStuff() 
		Reload() 
	else 
		user:SendData(Bot, what.." wasn't found in the Stufflist|") 
	end 
end 

function Reload() 
	OpenStuff() 
	ShowAlbums(NewestStuff) 
	ShowAlbums(AllStuff) 
end[/size]
-ptaczek-

This whole physical universe is a hologram.
[Cosmosis - Contact: The First Step]

WickeD

Thx m8.....!!!!  =)

//WickeD

SMF spam blocked by CleanTalk