Navigate in 1 textfile ( all your help files in 1 text and navigate on keywords
 

Navigate in 1 textfile ( all your help files in 1 text and navigate on keywords

Started by -RICK-, 30 April, 2006, 23:11:15

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

-RICK-

-- RICK--
-- 2006
-- Lua 5.0
-- On request
-- Navigate in 1 textfile? 
-- Sends PM to new connected Users and they can choose what help file and they can navigate endless
-- Make folder helpfile/helptext.txt(put all your helptexts in it starting with? --trigger < here your text>? *-* end)
-- Put in same folder all helptext.txt files


--[[
Example
helptext.txt

-- commands? ? ? ? ?-- begin textfile start trigger is? ? -- <space> command
help
slots
ect
*-* commands? ? ? ? ? ? ? ? ? ? -- is end of textfile stoptrigger is? *-* <space> command

-- help
bla bla
bla
*-* help

-- slots
tel me
something about slots
*-* slots

]]--


sBotName = "testhelp"? ?-- botname
Login = 1? ? ? ? ? ? ? ?-- show login text
StartCommand = "commands" -- First text u want to show @ login

tsettings = {? ? ? ? ? ?--Who recieves massages at login or/and have acces to text files? 1= recieve or/and have acces
["AllowedProfiles"] ={ 
[0] = 1,? ?-- Masters				
[1] = 1,? ?-- Operators	? ?			
[2] = 0,? ?-- Vips		? ? ? 	
[3] = 0,? ?-- Regs	
[4] = 1,? ?-- Moderator
[5] = 1,? ?-- Netfounder		? ? ? 			
[-1] = 1,? -- Users			? ? ?
}
}

function Main() 
	frmHub:RegBot(sBotName) 	
end 

function ToArrival(user, data)
	data=string.sub(data,1,string.len(data)-1)
	local s,e,cmd = string.find(data,"%$%b<>%s+(%S+)")
? ? ? ? cmd = string.lower(cmd)
		showtext(user, cmd)		
		return 1
	end

NewUserConnected = function(user)
? ? if tsettings["AllowedProfiles"][user.iProfile] == 1 and Login == 1 then
? ? ? ? cmd = StartCommand
? ? ? ? showtext(user, cmd)
? ? end
end
OpConnected=NewUserConnected

function showtext(user, cmd)
? ? if tsettings["AllowedProfiles"][user.iProfile] == 1 then
? ? ? ? local contents =""
? ? ? ? local bFile = io.open("helpfile/helptext.txt") 
? ? ? ? if bFile then
? ? ? ? ? ? for line in io.lines("helpfile/helptext.txt") do
? ? ? ? ? ? StTR=("-- "..cmd)
? ? ? ? ? ? StopTR=("*-* "..cmd)
? ? ? ? ? ? ? ? if string.find(line,StTR) then
? ? ? ? ? ? ? ? ? ? start = 1
? ? ? ? ? ? ? end
? ? ? ? ? ? ? ? if string.find(line,StopTR) then
? ? ? ? ? ? ? ? ? ? start = nil
? ? ? ? ? ? ? ? ? ? end
? ? ? ? ? ? ? ? ? ? if start == 1 then
? ? ? ? ? ? ? ? ? ? ? ? line = ("\t"..line.."\r\n")
? ? ? ? ? ? ? ? ? ? ? ? contents = contents..line? 
? ? ? ? ? ? ? ? end
? ? ? ? ? ? ? ? ? ? end
? ? ? ? ? ? user:SendPM(sBotName,"\r\n"..contents.."\r\n|")
? ? ? ? end

? ? end
end
[code\]

SMF spam blocked by CleanTalk