link needed
 

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

link needed

Started by Themaster, 11 November, 2004, 17:42:53

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Themaster

Hey PPL i need a script to the link...like +addlink //www.google.com or other.
so it will save to in a txt file....

plz needed that script *S*
peace out...and love to your all scripter..that do the hard work  :D And all thx to your all there are here 2 help!!! :]

blade.lir.dk

bastya_elvtars

how should the text file look like?
Everything could have been anything else and it would have just as much meaning.

Themaster

#2
like a rule..or somethin like that i just want to have a script that show where they can fine som stuff on the //www.. if you understand what i mean. and the user's can add a link
peace out...and love to your all scripter..that do the hard work  :D And all thx to your all there are here 2 help!!! :]

blade.lir.dk

bastya_elvtars

hints: use a table to store the links


like table{["www.google.com"]=1,["www.lmfao.xyz"]=1}

with this you can see whether link is added already

and use the following:

function savefile(table,file)
	writeto(file)
		for a,b in table do
			write(a.."\n")
		end
	writeto()
end

-- to load:

function maketable(file)
	local table={}
	readfrom(file)
	while 1 do
		local line = read()
		if line == nil then 
			readfrom()
			break 
		end
		table[line] = 1
	end 
	readfrom()
	return table
end

-- this has 2 be called for i. e. with

linktable=maketable("links.txt")
Everything could have been anything else and it would have just as much meaning.

Themaster

i also need a command on it....i have try to make some....but i don't work
peace out...and love to your all scripter..that do the hard work  :D And all thx to your all there are here 2 help!!! :]

blade.lir.dk

Themaster

#5
I still need they +prefix code to that function with the link i want to made
peace out...and love to your all scripter..that do the hard work  :D And all thx to your all there are here 2 help!!! :]

blade.lir.dk

Themaster

thx. for that script i got in PM....and here it is

BotName = "weblink" 

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+)") 
	s,e,arg = strfind(data,"%b<>%s+%S+%s+(%S+)") 
		if cmd=="addlink" then 
		AddLink(user, data, cmd) 
		elseif cmd=="links" then 
		ShowLinks(user, data, cmd) 
		end 
	end 
end 

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

function ShowLinks(user, data, cmd) 
	local rules = "" 
	readfrom("txt/weblinks.txt") 
	while 1 do 
	local line = read() 
	if (line == nil) then 
	break 
	else 
	rules = rules.." "..line.."\r\n" 
	end 
	end 
	user:SendPM(BotName, "\r\n\r\n".." Websites posted by Users".."\r\n\r\n"..rules) 
	readfrom() 
end 

function AddLink(user, data, cmd) 
	s,e,cmd,homePage,desc = strfind( data, "%b<>%s+(%S+)%s+(%S+)%s+(.+)" ) 
	if desc == nil then 
	desc = "*** No description specified!" 
	s,e,homePage = strfind( data, "%b<>%s+%S+%s+(.+)" ) 
	end 
	if homePage == nil then 
	user:SendData(BotName, "*** You must enter the addres of the website you would like to post!") 
	else 
	WriteHomepage(user.sName.." - "..homePage.."\r\n".."Description: "..desc.."\r\n") 
	SendToAll(BotName, "The user <"..user.sName.."> has added the homepage "..homePage.." to the linkdatabase!") 
	end 
end 

function WriteHomepage(what) 
	appendto("txt/weblinks.txt") 
	write(what.."\n") 
	writeto() 
end

Thx a lot i 2 happy for it
peace out...and love to your all scripter..that do the hard work  :D And all thx to your all there are here 2 help!!! :]

blade.lir.dk

Themaster

need 2 stuff more to that function..

nr 1
Remeve one link if it not work that link there are being add..

nr 2.
A Clearfunction

 8)
peace out...and love to your all scripter..that do the hard work  :D And all thx to your all there are here 2 help!!! :]

blade.lir.dk

Themaster

Still need help with this script

PLZ PLL
peace out...and love to your all scripter..that do the hard work  :D And all thx to your all there are here 2 help!!! :]

blade.lir.dk

nErBoS

Hi,

Try out this one...

--## LINK POSTER BOT
--## Request by Themaster
--## Made by nErBoS
--## Commands:
--##	+addlink 	- Adds a Link to the Link List
--##	+dellink  - Removes a Linf from the Link List (ONLY FOR OPs)
--##	+linklist	- Showes the Link List

sBot = "LP-Bot"

arrLink = {}
fLink = "link.dat"

--## Configuration ##--

uLaterPtokax = 0	-- Choose 0 if you are using a Ptokax Version 0.3.3.0 or higher
			-- Choose 1 if you are using a Ptokax Version lower then 0.3.3.0

--## END ##--

function Main()
	frmHub:RegBot(sBot)
	LoadFromFile(fLink)
end

function OnExit()
	SaveToFile(fLink , arrLink , "arrLink")
end

function DataArrival(user, data)
	if (strsub(data,1,1) == "<" or strsub(data,1,5+strlen(sBot)) == "$To: "..sBot) then
		data = strsub(data,1,strlen(data)-1)
		local s,e,cmd = strfind(data, "%b<>%s+(%S+)")
		if (cmd == "+addlink") then
			local s,e,sLink = strfind(data, "%b<>%s+%S+%s+(.+)")
			if (sLink == nil) then
				user:SendPM(sBot, "Syntax Error, +addlink , you must write a link.")
			elseif (arrLink[strlower(sLink)] ~= nil) then
				user:SendPM(sBot, "The Link "..sLink.." is already in our Link List.")
			else
				arrLink[strlower(sLink)] = user.sName
				user:SendPM(sBot, "The Link "..sLink.." has been added to our Link List, thank you.")
				if (uLaterPtokax == 1) then
					OnExit()
				end
			end
			return 1
		elseif (user.bOperator and cmd == "+dellink") then
			local s,e,sLink = strfind(data, "%b<>%s+%S+%s+(.+)")
			if (sLink == nil) then
				user:SendPM(sBot, "Syntax Error, +dellink , you must write a link.")
			elseif (arrLink[strlower(sLink)] == nil) then
				user:SendPM(sBot, "The Link "..sLink.."isn't in our Link List.")
			else
				arrLink[strlower(sLink)] = nil
				user:SendPM(sBot, "The Link "..sLink.." has been removed from our Link List.")
				if (uLaterPtokax == 1) then
					OnExit()
				end
			end
			return 1
		elseif (cmd == "+linklist") then
			local sLink,sPoster,sTmp = "The Link List of our HUB:\r\n\r\n"
			for sLink, sPoster in arrLink do
				sTmp = sTmp.."LINK: "..sLink.." POSTED BY: "..sPoster.."\r\n"
			end
			user:SendPM(sBot, sTmp)
			return 1
		end
	end
end

function Serialize(tTable, sTableName, sTab)
	assert(tTable, "tTable equals nil");
	assert(sTableName, "sTableName equals nil");

	assert(type(tTable) == "table", "tTable must be a table!");
	assert(type(sTableName) == "string", "sTableName must be a string!");

	sTab = sTab or "";
	sTmp = ""

	sTmp = sTmp..sTab..sTableName.." = {\n"

	for key, value in tTable do
		local sKey = (type(key) == "string") and format("[%q]",key) or format("[%d]",key);

		if(type(value) == "table") then
			sTmp = sTmp..Serialize(value, sKey, sTab.."\t");
		else
			local sValue = (type(value) == "string") and format("%q",value) or tostring(value);
			sTmp = sTmp..sTab.."\t"..sKey.." = "..sValue
		end

		sTmp = sTmp..",\n"
	end

	sTmp = sTmp..sTab.."}"
	return sTmp
end

function SaveToFile(file , table , tablename)
	writeto(file)
	write(Serialize(table, tablename))
	writeto()
end

function LoadFromFile(file)
	if (readfrom(file) ~= nil) then
		readfrom(file)
		dostring(read("*all"))
		readfrom()
	end
end

Best regards, nErBoS
--## nErBoS Spot ##--

Themaster

Thx nerbos...but it got a error on linklist

Syntax error: attempt to concat local `sTmp' (a nil value)
stack traceback:
   1:  function `Commands' at line 69 [file `blade/Commands.lua']
   2:  function `DataArrival' at line 120 [file `...Themaster\Skrivebord\Hub\scripts\Blade? 1.0.lua']
peace out...and love to your all scripter..that do the hard work  :D And all thx to your all there are here 2 help!!! :]

blade.lir.dk

Themaster

i miss 2 thing on that command here...

1. I can't get linklist to work

2. need a Description off what that like are...like //www.google.com  Desc = is a search site
peace out...and love to your all scripter..that do the hard work  :D And all thx to your all there are here 2 help!!! :]

blade.lir.dk

kepp

It's funny that you mention it..
I made this a few days ago to another hub

all i had to do was translating it :)

-- Link-Poster
-- made by Kepp (N?ttan)
--
-- To use create a folder in 'scripts' directory called Link-Poster.
-- The use notepad or your favorite text-editor and create a file called
-- 'Lankar.tbl'
--
-- Write this 'Links = {}' in the file! Save it, run the script, report bugs

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

sBot = "Link-Poster";
sFile = "Link-Poster/Lankar.tbl";

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

assert(dofile(sFile),sFile.." cannot be found.");

function Main()
   frmHub:RegBot(sBot);
end

function DataArrival(user,data)
   local data = strsub(data,1,-2);
   if (strsub(data,1,1) == "<") then
      local s,e,sCmd = strfind(data,"^%b<>%s+(%S+)");
      if (Commands[strlower(sCmd)]) then
         SendToAll(Commands[strlower(sCmd)](user,data));
      end
      if (rc == 1) then return 1 end
   end
end

function WriteFile(table, tablename, file)
   local handle = openfile(file, "w")
   Serialize(table, tablename, handle)
   closefile(handle)
end

function Serialize(tTable, sTableName, hFile, sTab)
   sTab = sTab or "";
   write(hFile, sTab..sTableName.." = {\n" );
   for key, value in tTable do
      local sKey = (type(key) == "string") and format("[%q]",key) or format("[%d]",key);
      if(type(value) == "table") then
         Serialize(value, sKey, hFile, sTab.."\t");
      else
         local sValue = (type(value) == "string") and format("%q",value) or tostring(value);
         write(hFile, sTab.."\t"..sKey.." = "..sValue);
      end
      write(hFile, ",\n");
   end
   write(hFile, sTab.."}");
end

Commands = {
   ["+addtable"] = 
   function(user,data)
      if (user.iProfile == 0 or user.iProfile == 1) then
         local s,e,Header = strfind(data,"^%b<>%s+%S+%s+(.+)");
         if (Header == "") then
            user:SendData(sBot,"Please write a a description to be used for links!");
            rc = 1;
         else
            local Exists = 0;
            for i,v in Links do
               if strlower(i) == strlower(Header) then
                  Exists = 1;
                  break
               end
            end
            if (Exists == 1) then
               user:SendData(sBot,"The table \""..Header.."\" is allready in file!");
               rc = 1;
            else
               Links[Header] = {};
               WriteFile(Links,"Links",sFile);
               user:SendData(sBot,"\""..Header.."\" table is now registered in the file as a tile for diferent links!");
               rc = 1;
            end
         end
      else
         user:SendData(sBot,"You are not allowed to use this command!");
         rc = 1;
      end
   end,
   
   ["+addlink"] = 
   function(user,data)
      if (user.iProfile == 0 or user.iProfile == 1) then
         local s,e,Lank,sHeader = strfind(data,"^%b<>%s+%S+%s+(%S+)%s*(.*)");
         if Lank then
            if (sHeader == "") then
               user:SendData(sBot,"Please write the table were the link shall be under!");
               rc = 1;
            else
               local iMode = 0;
               local Header = "";
               for i,v in Links do
                  if strlower(i) == strlower(sHeader) then
                     iMode = 1;
                     Header = i;
                     break
                  end
               end
               if (iMode == 1) then
                  Links[Header][Lank] = 1;
                  WriteFile(Links,"Links",sFile);
                  user:SendData(sBot,"The link \""..Lank.."\" is now registered under \""..Header.."\" table!");
                  rc = 1;
               else
                  user:SendData(sBot,"The \""..Header.."\" table dosen't exist, be kind enough to create it first!");
                  rc = 1;
               end
            end
         else
            user:SendData(sBot,"Please provide the link!");
            rc = 1;
         end
      else
         user:SendData(sBot,"You are not allowed to use this command!");
         rc = 1;
      end
   end,
   
   ["+links"] = 
   function(user,data)
      local sMsg = "";
      for i,v in Links do
         sMsg = sMsg.."\r\n(  "..i.."  )\r\n"
         for i,v in Links[i] do
            sMsg = sMsg..i.."\r\n";
         end
      end
      user:SendPM(sBot,sMsg);
      rc = 1;
   end
};
Guarding    

Themaster

It still is the same problem i get
peace out...and love to your all scripter..that do the hard work  :D And all thx to your all there are here 2 help!!! :]

blade.lir.dk

kepp

Guarding    

Themaster

when i use linklist

elseif (cmd == "+linklist") then
			local sLink,sPoster,sTmp = "The Link List of our HUB:\r\n\r\n"
			for sLink, sPoster in arrLink do
				sTmp = sTmp.."LINK: "..sLink.." POSTED BY: "..sPoster.."\r\n"
			end
			user:SendPM(sBot, sTmp)
			return 1
		end
peace out...and love to your all scripter..that do the hard work  :D And all thx to your all there are here 2 help!!! :]

blade.lir.dk

bastya_elvtars

elseif (cmd == "+linklist") then

			local sLink,sPoster,sTmp = "The Link List of our HUB:\r\n\r\n",nil,""

			for sLink, sPoster in arrLink do

				sTmp = sTmp.."LINK: "..sLink.." POSTED BY: "..sPoster.."\r\n"

			end

			user:SendPM(sBot, sTmp)

			return 1

		end
Everything could have been anything else and it would have just as much meaning.

Themaster

thx bastya that work  :]
peace out...and love to your all scripter..that do the hard work  :D And all thx to your all there are here 2 help!!! :]

blade.lir.dk

nErBoS

Hi,

Correct away...

local sTmp,sLink,sPoster = "The Link List of our HUB:\r\n\r\n"

Best regards, nErBoS
--## nErBoS Spot ##--

Themaster

thx PPL.. I have the correct code now and it work great

--## LINK POSTER BOT
--## Request by Themaster
--## Made by nErBoS
--## Commands:
--##	+addlink 	- Adds a Link to the Link List
--##	+dellink  - Removes a Linf from the Link List (ONLY FOR OPs)
--##	+linklist	- Showes the Link List

sBot = "LP-Bot"

arrLink = {}
fLink = "link.dat"

--## Configuration ##--

uLaterPtokax = 0	-- Choose 0 if you are using a Ptokax Version 0.3.3.0 or higher
			-- Choose 1 if you are using a Ptokax Version lower then 0.3.3.0

--## END ##--

function Main()
	frmHub:RegBot(sBot)
	LoadFromFile(fLink)
end

function OnExit()
	SaveToFile(fLink , arrLink , "arrLink")
end

function DataArrival(user, data)
	if (strsub(data,1,1) == "<" or strsub(data,1,5+strlen(sBot)) == "$To: "..sBot) then
		data = strsub(data,1,strlen(data)-1)
		local s,e,cmd = strfind(data, "%b<>%s+(%S+)")
		if cmd == "addlink" then
			local s,e,sLink = strfind(data, "%b<>%s+%S+%s+(.+)")
			if (sLink == nil) then
				user:SendPM(BotName, "Syntax Error, +addlink , you must write a link.")
			elseif (arrLink[strlower(sLink)] ~= nil) then
				user:SendPM(BotName, "The Link "..sLink.." is already in our Link List.")
			else
				arrLink[strlower(sLink)] = user.sName
				user:SendPM(BotName, "The Link "..sLink.." has been added to our Link List, thank you.")
				if (uLaterPtokax == 1) then
					OnExit()
				end
			end
			return 1
		elseif user.bOperator and cmd == "dellink" then
			local s,e,sLink = strfind(data, "%b<>%s+%S+%s+(.+)")
			if (sLink == nil) then
				user:SendPM(BotName, "Syntax Error, +dellink , you must write a link.")
			elseif (arrLink[strlower(sLink)] == nil) then
				user:SendPM(BotName, "The Link "..sLink.."isn't in our Link List.")
			else
				arrLink[strlower(sLink)] = nil
				user:SendPM(BotName, "The Link "..sLink.." has been removed from our Link List.")
				if (uLaterPtokax == 1) then
					OnExit()
				end
			end
			return 1
		elseif cmd == "showlink" then
         local sLink,sPoster,sTmp = "The Link List of our HUB:\r\n\r\n",nil,""
			for sLink, sPoster in arrLink do
            sTmp = sTmp.."LINK: "..sLink.." POSTED BY: "..sPoster.."\r\n"
         end
			user:SendPM(BotName, sTmp)
			return 1
		end
	end
end

function Serialize(tTable, sTableName, sTab)
	assert(tTable, "tTable equals nil");
	assert(sTableName, "sTableName equals nil");

	assert(type(tTable) == "table", "tTable must be a table!");
	assert(type(sTableName) == "string", "sTableName must be a string!");

	sTab = sTab or "";
	sTmp = ""

	sTmp = sTmp..sTab..sTableName.." = {\n"

	for key, value in tTable do
		local sKey = (type(key) == "string") and format("[%q]",key) or format("[%d]",key);

		if(type(value) == "table") then
			sTmp = sTmp..Serialize(value, sKey, sTab.."\t");
		else
			local sValue = (type(value) == "string") and format("%q",value) or tostring(value);
			sTmp = sTmp..sTab.."\t"..sKey.." = "..sValue
		end

		sTmp = sTmp..",\n"
	end

	sTmp = sTmp..sTab.."}"
	return sTmp
end

function SaveToFile(file , table , tablename)
	writeto(file)
	write(Serialize(table, tablename))
	writeto()
end

function LoadFromFile(file)
	if (readfrom(file) ~= nil) then
		readfrom(file)
		dostring(read("*all"))
		readfrom()
	end
end
That code work ...

Peace PPL....
peace out...and love to your all scripter..that do the hard work  :D And all thx to your all there are here 2 help!!! :]

blade.lir.dk

Themaster

#20
One thin more 2 this script..Need a Description on what the link is about

LINK: http://www.portforward.com/ POSTED BY: Themaster? and what on that link.. so all can see what that link is !
peace out...and love to your all scripter..that do the hard work  :D And all thx to your all there are here 2 help!!! :]

blade.lir.dk

Themaster

plz PPL i can't get it on
peace out...and love to your all scripter..that do the hard work  :D And all thx to your all there are here 2 help!!! :]

blade.lir.dk

nErBoS

#22
Hi,

Here you have...

--## LINK POSTER BOT 1.0
--## Request by Themaster
--## Added description to the Links
--## Made by nErBoS
--## Commands:
--##	+addlink  	- Adds a Link to the Link List
--##	+dellink 			- Removes a Linf from the Link List (ONLY FOR OPs)
--##	+linklist			- Showes the Link List

sBot = "LP-Bot"

arrLink = {}
fLink = "link.dat"

--## Configuration ##--

uLaterPtokax = 0	-- Choose 0 if you are using a Ptokax Version 0.3.3.0 or higher
			-- Choose 1 if you are using a Ptokax Version lower then 0.3.3.0

--## END ##--

function Main()
	frmHub:RegBot(sBot)
	LoadFromFile(fLink)
end

function OnExit()
	SaveToFile(fLink , arrLink , "arrLink")
end

function DataArrival(user, data)
	if (strsub(data,1,1) == "<" or strsub(data,1,5+strlen(sBot)) == "$To: "..sBot) then
		data = strsub(data,1,strlen(data)-1)
		local s,e,cmd = strfind(data, "%b<>%s+(%S+)")
		if cmd == "+addlink" then
			local s,e,sLink,sDesc = strfind(data, "%b<>%s+%S+%s+(%S+)%s+(.+)")
			if (sLink == nil or sDesc == nil) then
				user:SendPM(BotName, "Syntax Error, +addlink  , you must write a link and a description.")
			elseif (arrLink[strlower(sLink)] ~= nil) then
				user:SendPM(BotName, "The Link "..sLink.." is already in our Link List.")
			else
				arrLink[strlower(sLink)] = {["BY"] = user.sName, ["DESC"] = sDesc}
				user:SendPM(BotName, "The Link "..sLink.." has been added to our Link List, thank you.")
				if (uLaterPtokax == 1) then
					OnExit()
				end
			end
			return 1
		elseif user.bOperator and cmd == "+dellink" then
			local s,e,sLink = strfind(data, "%b<>%s+%S+%s+(.+)")
			if (sLink == nil) then
				user:SendPM(BotName, "Syntax Error, +dellink , you must write a link.")
			elseif (arrLink[strlower(sLink)] == nil) then
				user:SendPM(BotName, "The Link "..sLink.."isn't in our Link List.")
			else
				arrLink[strlower(sLink)] = nil
				user:SendPM(BotName, "The Link "..sLink.." has been removed from our Link List.")
				if (uLaterPtokax == 1) then
					OnExit()
				end
			end
			return 1
		elseif cmd == "+showlink" then
			local sTmp,sLink,arrTable = "The Link List of our HUB:\r\n\r\n"
			for sLink, arrTable in arrLink do
				sTmp = sTmp.."LINK: "..sLink.." POSTED BY: "..arrTable["BY"].." DESCRIPTION: "..arrTable["DESC"].."\r\n"
			end
			user:SendPM(BotName, sTmp)
			return 1
		end
	end
end

function Serialize(tTable, sTableName, sTab)
	assert(tTable, "tTable equals nil");
	assert(sTableName, "sTableName equals nil");

	assert(type(tTable) == "table", "tTable must be a table!");
	assert(type(sTableName) == "string", "sTableName must be a string!");

	sTab = sTab or "";
	sTmp = ""

	sTmp = sTmp..sTab..sTableName.." = {\n"

	for key, value in tTable do
		local sKey = (type(key) == "string") and format("[%q]",key) or format("[%d]",key);

		if(type(value) == "table") then
			sTmp = sTmp..Serialize(value, sKey, sTab.."\t");
		else
			local sValue = (type(value) == "string") and format("%q",value) or tostring(value);
			sTmp = sTmp..sTab.."\t"..sKey.." = "..sValue
		end

		sTmp = sTmp..",\n"
	end

	sTmp = sTmp..sTab.."}"
	return sTmp
end

function SaveToFile(file , table , tablename)
	writeto(file)
	write(Serialize(table, tablename))
	writeto()
end

function LoadFromFile(file)
	if (readfrom(file) ~= nil) then
		readfrom(file)
		dostring(read("*all"))
		readfrom()
	end
end

NOTE: You must delete the "link.dat" before you can use this script (by doing that you will lose all your links). To delete that file you have to shutdown the ptokax.

Best regards, nErBoS
--## nErBoS Spot ##--

SMF spam blocked by CleanTalk