PtokaX forum

Lua 5.3/5.2/5.1 Scripts (for PtokaX 0.4.0.0 and newer) => Finished Scripts => Topic started by: Daywalker? on 17 April, 2008, 22:58:28

Title: Transporter 1.0 RC1 [API 2]
Post by: Daywalker? on 17 April, 2008, 22:58:28
                                     Script Updated to RC2

--[[
Transporter 1.0 RC2 Lua 5.1.3 [API 2] script made by Daywalker

* Added !transport <FileName> <FileExtension lua/txt> <FileText>  command
* Saves the lua and txt files to the right folders in the Ptokax folder
* Added !newmotd <FileText> also as we are doing txt files
* Tnx to the ppl from whom i'm learning..

RC2
*Fixed reload textfiles tnx to CrazyGuy for making a nice function for it :)
]]

Tr = {
------------------------------- Main Settings -----------------------------------
Bot = "",
-- Hub Name if "" then it will be set to hubname
Hub = "",
-- Should bot have a key? true / false
BotIsOp = true,
-- Bot description
BotDesc = "FileTransporter",
-- Bot Email address
BotMail = "transport@files.txt",
-- Script version
Version = "1.0 RC2",
}
local s,w = 0,0
OnStartup = function()
if Tr.Bot == "" then Tr.Bot = SetMan.GetString(21) end
if Tr.Menu == "" then Tr.Menu = SetMan.GetString(0) end
if Tr.Hub == "" then Tr.Hub = SetMan.GetString(0) end
Tr.Pfx = SetMan.GetString(29):sub(1,1)
Tr.LuaPath = string.gsub(Core.GetPtokaXPath().."scripts/","/","\\")
Tr.TextPath = string.gsub(Core.GetPtokaXPath().."texts/","/","\\")
gc,no = nil,table.getn
if _VERSION ~= "Lua 5.1" then
return OnError("Error! This script is incompatible with ".._VERSION), true
end
if Tr.Bot ~= SetMan.GetString(21) or
Tr.Bot == SetMan.GetString(21) and SetMan.GetBool(17) == false then
Core.RegBot(Tr.Bot, Tr.BotDesc, Tr.BotMail, Tr.BotIsOp)
end
OnError("*** Transporter 1.0 RC1 for LUA ".._VERSION.." by Daywalker? has been started...")
end

OpConnected = UserConnected
RegConnected = UserConnected

ChatArrival = function(user, data)
local s,e,cmd = string.find( data, "%b<> %p(%w+)")
if cmd and TrCmds[cmd] then
local message = TrCmds[cmd](user,data)
Core.SendToNick(user.sNick,"<"..Tr.Bot.."> "..message.."|")
collectgarbage("collect")
return true
end
end
ToArrival = ChatArrival

OnExit = function()
OnError("*** Transporter 1.0 RC1 for LUA ".._VERSION.." by Daywalker? has been stopped...")
end

TrCmds = {
transport = function(user,data)
if user then
local reply = "*** Creating File: "
local s,e,Fname,Ext,tFile = string.find( data, "%b<> %p%w+%s(%w+)%s(%w+)%s(.*)|$")
if not Fname then
return "Error!, Use: "..Tr.Pfx..
"transport <FileName> <FileExtension lua/txt> <FileText>"
else
local file = Fname.."."..Ext
if Ext == "lua" then
local f,e = assert(io.open(Tr.LuaPath..file,"w"))
if f then
f:write(tFile) f:flush() f:close()
ScriptMan.Refresh()
reply = reply..file
else
OnError(e:sub(1,-2))
reply = reply.."Err in creating: "..file
end
end
if Ext == "txt" then
local f,e = assert(io.open(Tr.TextPath..file,"w"))
if f then
f:write(tFile) f:flush() f:close()
ReloadTextFiles()
reply = reply..file
else
OnError(e:sub(1,-2))
reply = reply.."Err in creating: "..file
end
end
end
return reply.." is completed.."
end
end,
newmotd = function(user,data)
if user then
local reply = "*** Creating New Motd"
local s,e,tFile = string.find( data, "%b<> %p%w+%s(.*)|$")
if not tFile then
return "Error!, Use: "..Tr.Pfx..
"newmotd <FileText>"
else
SetMan.SetMOTD(tFile)
end
return reply.." Is Completed.."
end
end,
}

-- code by CrazyGuy
ReloadTextFiles = function()
SetMan.SetBool(31,false)
SetMan.SetBool(31,true)
end

OnError = function(msg)
Core.SendToOps("<"..Tr.Bot.."> "..msg.."|")
end


shortly tested :)

// updated
Title: Re: Transporter 1.0 RC3 [API 2][ServiceFriendly]
Post by: Daywalker? on 19 April, 2008, 12:20:58
--[[
Transporter 1.0 RC3 Lua 5.1.3 [API 2] [ServiceFriendly] script made by Daywalker

* Added !transport <FileName> <FileExtension lua/txt> <FileText>  command
* Saves the lua and txt files to the right folders in the Ptokax folder
* Added !newmotd <FileText> also as we are doing txt files
* Tnx to the ppl from whom i'm learning..

RC2
*Fixed reload textfiles tnx to CrazyGuy for making a nice function for it :)

RC3
*Added Profiles check
*Tnx to Psycho_Chihuahua for finding me a endpipe bug
*Tnx Mutor for pointing me to the Dir command to list the folder
*Tnx UwV for example
*Added more commands
========================================
- Transporter Help-
--------------------------------------------------------------------------------
Command Description
????????????????????????????????????????
!transport Transport file to folder
!showfile Show specific file
!showfolder Show dir from folder
!newmotd Set a new Motd
!thelp Shows this help

????????????????????????????????????????

Note: create Tr.Folder

!!! Important !!! if you use this script to transport scripts note that when you copy from showfile that the "|" is replaced with "l" for display !!! Important !!!
]]

Tr = {
------------------------------- Main Settings -----------------------------------
Bot = "",
-- Hub Name if "" then it will be set to hubname
Hub = "",
-- Should bot have a key? true / false
BotIsOp = true,
-- Bot description
BotDesc = "FileTransporter",
-- Bot Email address
BotMail = "transport@files.txt",
-- Script version
Version = "1.0 RC3",
-- Profiles settings
Profiles  = {
[-1] = false, --Unregistered User
[0] = true, --Master
[1] = false, --Operator
[2] = false, --Vip
[3] = false, --Registered User
},
-- File to save lua
lFile = "luafile.txt",
-- File to save text
tFile = "txtfile.txt",
-- Folder to save dir
Folder = "TransFolder",
}

local s,w = 0,0
lList ={}
tList ={}

OnStartup = function()
if Tr.Bot == "" then Tr.Bot = SetMan.GetString(21) end
if Tr.Menu == "" then Tr.Menu = SetMan.GetString(0) end
if Tr.Hub == "" then Tr.Hub = SetMan.GetString(0) end
Tr.Pfx = SetMan.GetString(29):sub(1,1)
Tr.Path = string.gsub(Core.GetPtokaXPath().."scripts/"..Tr.Folder.."/","/","\\")
Tr.LuaPath = string.gsub(Core.GetPtokaXPath().."scripts/","/","\\")
Tr.TxtPath = string.gsub(Core.GetPtokaXPath().."texts/","/","\\")
Tr.lFile = Tr.Path..Tr.lFile
Tr.tFile = Tr.Path..Tr.tFile
gc,no = nil,table.getn
if _VERSION ~= "Lua 5.1" then
return OnError("Error! This script is incompatible with ".._VERSION), true
end
if Tr.Bot ~= SetMan.GetString(21) or
Tr.Bot == SetMan.GetString(21) and SetMan.GetBool(17) == false then
Core.RegBot(Tr.Bot, Tr.BotDesc, Tr.BotMail, Tr.BotIsOp)
end
OnError("*** Transporter "..Tr.Version.." for ".._VERSION.." by Daywalker? has been started...")
end

UserConnected = function(user)
if Tr.Profiles then
Core.SendToNick(user.sNick,"<"..Tr.Bot.."> *** Transporter "..Tr.Version.." Commands are enabled for your profile type !thelp for more info|")
end
end

OpConnected = UserConnected
RegConnected = UserConnected

ChatArrival = function(user, data)
local s,e,cmd = string.find( data, "%b<> %p(%w+)")
if cmd and TrCmds[cmd] then
local message = TrCmds[cmd](user,data)
Core.SendToNick(user.sNick,"<"..Tr.Bot.."> "..message.."|")
collectgarbage("collect")
return true
end
end
ToArrival = ChatArrival

OnExit = function()
OnError("*** Transporter "..Tr.Version.." for ".._VERSION.." by Daywalker? has been stopped...")
end

TrCmds = {
transport = function(user,data)
if user then
local reply = "*** Creating File: "
local s,e,Fname,Ext,tFile = string.find( data, "%b<> %p%w+%s(%w+)%s(%w+)%s(.*)|$")
if not Fname then
return "Error!, Use: "..Tr.Pfx..
"transport <FileName> <FileExtension (lua/txt)> <FileText>"
else
local file = Fname.."."..Ext
if Ext == "lua" then
local f,e = assert(io.open(Tr.LuaPath..file,"w"))
if f and Tr.Profiles then
f:write(tFile) f:flush() f:close()
ScriptMan.Refresh()
reply = reply..file
else
if not f then
OnError(e:sub(1,-2))
end
if not Tr.Profiles then
reply = reply.."Err in creating: "..file.." [Reason: To low Profile]"
end
end
end
if Ext == "txt" then
local f,e = assert(io.open(Tr.TxtPath..file,"w"))
if f and Tr.Profiles then
f:write(tFile) f:flush() f:close()
ReloadTextFiles()
reply = reply..file
else
if not f then
OnError(e:sub(1,-2))
end
if not Tr.Profiles then
reply = reply.."Err in creating: "..file.." [Reason: To low Profile]"
end
end
end
end
return reply.." is completed.."
end
end,
newmotd = function(user,data)
if user then
local reply = "*** Creating New Motd"
local s,e,tFile = string.find( data, "%b<> %p%w+%s(.*)|$")
if not tFile then
return "Error!, Use: "..Tr.Pfx..
"newmotd <FileText>"
else
if Tr.Profiles then
SetMan.SetMOTD(tFile)
else
reply = reply.."Err in creating: Motd.txt [Reason: To low Profile]"
end
end
return reply.." Is Completed.."
end
end,
showfile = function(user,data)
if user then
local reply = "*** Show selected file: "
local s,e,tFile,Ext = string.find( data, "%b<> %p%w+%s(%w+)%.(%w+)|$")
if not tFile then
return "Error!, Use: "..Tr.Pfx..
"showfile <FileName>"
else
if Ext == "lua" then
FilePath = Tr.LuaPath..tFile.."."..Ext
reply = reply..FilePath
local s,f,e = "",io.open(FilePath)
if f then
s = f:read("*a")
f:close()
if s:len() > 0 then
local text = s:gsub("|","l")
if Tr.Profiles then
reply = reply.."\n\n"..text.."\n\n|"
else
reply = reply.."Err in showing: "..file.." [Reason: To low Profile]"
end
end
else
if FilePath ~= "" then
OnError(e:sub(1,-2).." ["..FilePath.."]")
end
end
end
if Ext == "txt" then
FilePath = Tr.TxtPath..tFile.."."..Ext
reply = reply..FilePath
local s,f,e = "",io.open(FilePath)
if f then
s = f:read("*a")
f:close()
if s:len() > 0 then
local text = s:gsub("|","l")
if Tr.Profiles then
reply = reply.."\n\n"..text.."\n\n|"
else
reply = reply.."Err in showing: "..file.." [Reason: To low Profile]"
end
end
else
if FilePath ~= "" then
OnError(e:sub(1,-2).." ["..FilePath.."]")
end
end
end
end
return reply
end
end,
showfolder = function(user,data)
if user then
local reply = "*** Show files in specific folder: \n\n"
local s,e,Ext = string.find( data, "%b<> %p%w+%s(%w+)|$")
if not Ext then
return "Error!, Use: "..Tr.Pfx..
"showfolder <Extension(lua/txt)>"
else
if Ext == "lua" then
os.execute("dir \""..Tr.LuaPath.."\" /A-D-S-H /B /O:N > "..Tr.lFile.."")
lList ={}
local h = io.open(Tr.lFile,"r")
for line in h:lines() do
if string.find (line,"^(%w+)%.lua$") then
local _,_,list = string.find(line,"^(%w+)%.lua")
table.insert(lList,list)
end
end
h:close()
for i,v in pairs(lList) do
if v then
if Tr.Profiles then
reply = reply.."\t\t\t\t["..i.."] \t "..v..".lua\n"
else
reply = reply.."Err in showing: ScriptFolder [Reason: To low Profile]"
end
end
end
end
if Ext == "txt" then
os.execute("dir \""..Tr.TxtPath.."\" /A-D-S-H /B /O:N > "..Tr.tFile.."")
tList ={}
local h = io.open(Tr.tFile,"r")
for line in h:lines() do
if string.find (line,"^(%w+)%.txt$") then
local _,_,list = string.find(line,"^(%w+)%.txt")
table.insert(tList,list)
end
end
h:close()
for i,v in pairs(tList) do
if v then
if Tr.Profiles then
reply = reply.."\t\t\t\t["..i.."] \t "..v..".txt\n"
else
reply = reply.."Err in showing: TextFolder [Reason: To low Profile]"
end
end
end
end
end
return reply
end
end,
thelp = function(user,data)
if user then
local x
local reply = "\n\t\t"..string.rep("=",40)..
  "\n\t\t\t- Transporter Help-"..
  "\n\t\t"..string.rep("-",80)..
  "\n\t\tCommand\t\tDescription\n"..
  "\t\t"..string.rep("?",40).."\n"..
  "\t\t!transport\t\tTransport file to folder\n"..
  "\t\t!showfile\t\tShow specific file\n"..
  "\t\t!showfolder\tShow dir from folder\n"..
  "\t\t!newmotd\t\tSet a new Motd\n"..
  "\t\t!thelp\t\tShows this help\n"
if Tr.Profiles then
x = 1
end
if x then
return reply.."\n\t\t"..string.rep("?",40).."\n\n"..
"\t\t\t\t!!! Important !!!\n"..
"\t\tif you use this script to transport scripts note that when you copy\n"..
"\t\tfrom showfile that the endpipe is replaced with the letter l for display\n\n"
else
return "Sorry "..user.sNick.." These commands are disabled for your profile."
end
end
end,
}

-- code by CrazyGuy
ReloadTextFiles = function()
SetMan.SetBool(31,false)
SetMan.SetBool(31,true)
end
---------------------------------

OnError = function(msg)
Core.SendToOps("<"..Tr.Bot.."> "..msg.."|")
end


i didn't want to update previous script so you have a choice wich one to pick ^^

// edit fixed typo in  local f,e = assert(io.open(Tr.TextPath..file,"w"))  to local f,e = assert(io.open(Tr.TxtPath..file,"w"))
Title: Re: Transporter 1.0 RC1 [API 2]
Post by: rolipoli on 19 April, 2008, 14:00:53
Syntax transporter.lua:78: attempt to call field 'Refresh' (a nil value) for the first RC2 ,and for the second RC3 Syntax transporter.lua:128: attempt to call field 'Refresh' (a nil value)

Title: Re: Transporter 1.0 RC1 [API 2]
Post by: Daywalker? on 19 April, 2008, 14:20:39
QuoteSyntax transporter.lua:78: attempt to call field 'Refresh' (a nil value) for the first RC2 ,and for the second RC3 Syntax transporter.lua:128: attempt to call field 'Refresh' (a nil value)

what version of Ptokax do you use when running this script?

Title: Re: Transporter 1.0 RC1 [API 2]
Post by: rolipoli on 19 April, 2008, 14:35:37
PtokaX DC Hub 0.4.0.0d
Title: Re: Transporter 1.0 RC1 [API 2]
Post by: Psycho_Chihuahua on 20 April, 2008, 13:11:50
Quote from: rolipoli on 19 April, 2008, 14:35:37
PtokaX DC Hub 0.4.0.0d

Then it's about time you updated to the NEW API (as in 0.4.1.0RC4) - you can find the new version in our Download Database
Title: Re: Transporter 1.0 RC1 [API 2]
Post by: Daywalker? on 20 April, 2008, 19:41:01
zactly .

:)
Title: Re: Transporter 1.0 RC1 [API 2]
Post by: rolipoli on 22 April, 2008, 19:18:14
Thanks!!!I've suspected something like that but wasn't 100% sure about it.
Title: Re: Transporter 1.0 RC1 [API 2]
Post by: rolipoli on 28 April, 2008, 11:05:52
I have a little request if it's possible,can be added the delete command?
Title: Re: Transporter 1.0 RC1 [API 2](updated to RC4)
Post by: Daywalker? on 14 May, 2008, 21:51:14
A little late respond to last request but i saw it yesterday for the first time  :o
anyway here's the new update  ;D

--[[
Transporter 1.0 RC5 Lua 5.1.3 [API 2] [ServiceFriendly] script made by Daywalker

* Added !transport <FileName> <FileExtension lua/txt> <FileText>  command
* Saves the lua and txt files to the right folders in the Ptokax folder
* Added !newmotd <FileText> also as we are doing txt files
* Tnx to the ppl from whom i'm learning..

RC2
*Fixed reload textfiles tnx to CrazyGuy for making a nice function for it :)

RC3
*Added Profiles check
*Tnx to Psycho_Chihuahua for finding me a endpipe bug
*Tnx Mutor for pointing me to the Dir command to list the folder
*Tnx UwV for example
*Added more commands
========================================
- Transporter Help-
--------------------------------------------------------------------------------
Command Description
????????????????????????????????????????
!transport Transport file to folder
!showfile Show specific file
!showfolder Show dir from folder
!newmotd Set a new Motd
!thelp Shows this help

????????????????????????????????????????

RC4
*Added the !cleanup command to delete files in a folder
*Added PXLuaFileSystem-1.2.1 for show what's in the directory
*Fixed !showfolder
*Removed Folder and files for writing to

RC5
* fixed Profile issue (tnx shardana for the report)

========================================
- Transporter Help-
--------------------------------------------------------------------------------
Command Description
????????????????????????????????????????
!transport <FileName> <FileExtension (lua/txt)> <FileText> Transport file to folder
!cleanup <FileName.FileExtension (lua/txt)> Delete file from folder
!showfile <FileName.FileExtension (lua/txt)> Show specific file
!showfolder <FileExtension (lua/txt)> Show dir from folder
!newmotd <FileText> Set a new Motd
!thelp Shows this help

????????????????????????????????????????

!!! Important !!!
if you use this script to transport scripts note that when you copy
from showfile that the endpipe is replaced with the letter l for display

!!! Important !!! This script uses  PXLuaFileSystem-1.2.1 you can download this @ http://www.PtokaX.org/files/Libs-0.4.0.0RC6/PXLuaFileSystem-1.2.1.7z and unpack it in the PX root folder!!! Important !!!

Spec tnx to CrazyGuy and NightLitch for pointing me in the right directions
]]

Tr = {
------------------------------- Main Settings -----------------------------------
Bot = "",
-- Hub Name if "" then it will be set to hubname
Hub = "",
-- Should bot have a key? true / false
BotIsOp = true,
-- Bot description
BotDesc = "FileTransporter",
-- Bot Email address
BotMail = "transport@files.txt",
-- Script version
Version = "1.0 RC5",
-- Profiles settings
Profiles  = {
[-1] = false, --Unregistered User
[0] = true, --Master
[1] = false, --Operator
[2] = false, --Vip
[3] = false, --Registered User
},
}

require"pxlfs"

OnStartup = function()
if Tr.Bot == "" then Tr.Bot = SetMan.GetString(21) end
if Tr.Menu == "" then Tr.Menu = SetMan.GetString(0) end
if Tr.Hub == "" then Tr.Hub = SetMan.GetString(0) end
Tr.Pfx = SetMan.GetString(29):sub(1,1)
Tr.LuaPath = string.gsub(Core.GetPtokaXPath().."scripts/","/","\\")
Tr.TxtPath = string.gsub(Core.GetPtokaXPath().."texts/","/","\\")
gc,no = nil,table.getn
if _VERSION ~= "Lua 5.1" then
return OnError("Error! This script is incompatible with ".._VERSION), true
end
if Tr.Bot ~= SetMan.GetString(21) or
Tr.Bot == SetMan.GetString(21) and SetMan.GetBool(17) == false then
Core.RegBot(Tr.Bot, Tr.BotDesc, Tr.BotMail, Tr.BotIsOp)
end
OnError("*** Transporter "..Tr.Version.." for ".._VERSION.." by Daywalker? has been started...")
end

UserConnected = function(user)
if Tr.Profiles then
Core.SendToNick(user.sNick,"<"..Tr.Bot.."> *** Transporter "..Tr.Version.." Commands are enabled for your profile type !thelp for more info|")
end
end

OpConnected = UserConnected
RegConnected = UserConnected

ChatArrival = function(user, data)
local s,e,cmd = string.find( data, "%b<> %p(%w+)")
if cmd and TrCmds[cmd] then
local message = TrCmds[cmd](user,data)
Core.SendToNick(user.sNick,"<"..Tr.Bot.."> "..message.."|")
collectgarbage("collect")
return true
end
end
ToArrival = ChatArrival

OnExit = function()
OnError("*** Transporter "..Tr.Version.." for ".._VERSION.." by Daywalker? has been stopped...")
end

TrCmds = {
transport = function(user,data)
if user then
local reply = "*** Creating File: "
local s,e,Fname,Ext,tFile = string.find( data, "%b<> %p%w+%s(%w+)%s(%w+)%s(.*)|$")
if not Fname then
return "Error!, Use: "..Tr.Pfx..
"transport <FileName> <FileExtension (lua/txt)> <FileText>"
else
local file = Fname.."."..Ext
if Ext == "lua" then
local f,e = assert(io.open(Tr.LuaPath..file,"w"))
if f and Tr.Profiles == true then
f:write(tFile) f:flush() f:close()
ScriptMan.Refresh()
reply = reply..file
else
if not f then
OnError(e:sub(1,-2))
else
reply = reply.."Err in creating: "..file.." [Reason: To low Profile]"
end
end
end
if Ext == "txt" then
local f,e = assert(io.open(Tr.TxtPath..file,"w"))
if f and Tr.Profiles == true then
f:write(tFile) f:flush() f:close()
ReloadTextFiles()
reply = reply..file
else
if not f then
OnError(e:sub(1,-2))
else
reply = reply.."Err in creating: "..file.." [Reason: To low Profile]"
end
end
end
end
return reply.." is completed.."
end
end,
cleanup = function(user,data)
if user then
local reply = "*** Removing File: "
local s,e,Fname = string.find( data, "%b<> %p%w+%s(%S+%.%S+)|$")
if not Fname then
return "Error!, Use: "..Tr.Pfx..
"cleanup <FileName>"
else
if string.find (Fname,"^%w+%.lua$") then
local f,e = assert(os.remove(Tr.LuaPath..Fname,"w"))
if f and Tr.Profiles == true then
ScriptMan.Refresh()
reply = reply..Fname
else
if not f then
OnError(e:sub(1,-2))
else
reply = reply.."Err in removing: "..Fname.." [Reason: To low Profile]"
end
end
end
if string.find (Fname,"^%w+%.txt$") then
local f,e = assert(os.remove(Tr.TxtPath..Fname,"w"))
if f and Tr.Profiles == true then
ReloadTextFiles()
reply = reply..Fname
else
if not f then
OnError(e:sub(1,-2))
else
reply = reply.."Err in removing: "..Fname.." [Reason: To low Profile]"
end
end
end
end
return reply.." is completed.."
end
end,
newmotd = function(user,data)
if user then
local reply = "*** Creating New Motd"
local s,e,tFile = string.find( data, "%b<> %p%w+%s(.*)|$")
if not tFile then
return "Error!, Use: "..Tr.Pfx..
"newmotd <FileText>"
else
if Tr.Profiles == true then
SetMan.SetMOTD(tFile)
else
reply = reply.."Err in creating: Motd.txt [Reason: To low Profile]"
end
end
return reply.." Is Completed.."
end
end,
showfile = function(user,data)
if user then
local reply = "*** Show selected file: "
local s,e,tFile,Ext = string.find( data, "%b<> %p%w+%s(%w+)%.(%w+)|$")
if not tFile then
return "Error!, Use: "..Tr.Pfx..
"showfile <FileName>"
else
if Ext == "lua" then
FilePath = Tr.LuaPath..tFile.."."..Ext
reply = reply..FilePath
local s,f,e = "",io.open(FilePath)
if f and Tr.Profiles == true then
s = f:read("*a")
f:close()
if s:len() > 0 then
local text = s:gsub("|","l")
if Tr.Profiles == true then
reply = reply.."\n\n"..text.."\n\n|"
else
reply = reply.."Err in showing: "..file.." [Reason: To low Profile]"
end
end
else
if FilePath ~= "" then
OnError(e:sub(1,-2).." ["..FilePath.."]")
end
end
end
if Ext == "txt" then
FilePath = Tr.TxtPath..tFile.."."..Ext
reply = reply..FilePath
local s,f,e = "",io.open(FilePath)
if f then
s = f:read("*a")
f:close()
if s:len() > 0 then
local text = s:gsub("|","l")
if Tr.Profiles == true then
reply = reply.."\n\n"..text.."\n\n|"
else
reply = reply.."Err in showing: "..file.." [Reason: To low Profile]"
end
end
else
if FilePath ~= "" then
OnError(e:sub(1,-2).." ["..FilePath.."]")
end
end
end
end
return reply
end
end,
showfolder = function(user,data)
if user then
local reply = "*** Show files in specific folder: \n\n"
local s,e,Ext = string.find( data, "%b<> %p%w+%s(%w+)|$")
if not Ext then
return "Error!, Use: "..Tr.Pfx..
"showfolder <Extension(lua/txt)>"
else
if Ext == "lua" then
if Tr.Profiles == true then
local script = ScriptMan.GetScripts()
for i,v in ipairs(script) do
local k = v.iMemUsage or "Out Of Order"
local run = "Out Of Order"
if v.bEnabled then run = "Running and using "..k.." kB memory" end
reply = reply.."\t[ "..i.." ]\t "..v.sName.."\t\t ("..run..")\r\n"
end
else
reply = reply.."Err in showing: "..v.sName.." [Reason: To low Profile]"
end
end
if Ext == "txt" then
if Tr.Profiles == true then
    for file in lfs.dir(Tr.TxtPath) do
        if file ~= "." and file ~= ".." then
if string.find (file,"^%w+%.txt$") then
reply = reply.."\t "..file.."\n"
end
        end
    end
else
reply = reply.."Err in showing: "..file.." [Reason: To low Profile]"
end
end
end
return reply
end
end,
thelp = function(user,data)
if user then
local x
local reply = "\n\t\t"..string.rep("=",40)..
  "\n\t\t\t- Transporter Help-"..
  "\n\t\t"..string.rep("-",80)..
  "\n\t\tCommand\t\tDescription\n"..
  "\t\t"..string.rep("?",40).."\n"..
  "\t\t!transport <FileName> <FileExtension (lua/txt)> <FileText>\tTransport file to folder\n"..
  "\t\t!cleanup <FileName.FileExtension (lua/txt)>\t\tDelete file from folder\n"..
  "\t\t!showfile <FileName.FileExtension (lua/txt)>\t\tShow specific file\n"..
  "\t\t!showfolder <FileExtension (lua/txt)>\t\t\tShow dir from folder\n"..
  "\t\t!newmotd <FileText>\t\t\t\tSet a new Motd\n"..
  "\t\t!thelp\t\t\t\t\t\tShows this help\n"
if Tr.Profiles then
x = 1
end
if x then
return reply.."\n\t\t"..string.rep("?",40).."\n\n"..
"\t\t\t\t!!! Important !!!\n"..
"\t\tif you use this script to transport scripts note that when you copy\n"..
"\t\tfrom showfile that the endpipe is replaced with the letter l for display\n\n"
else
return "Sorry "..user.sNick.." These commands are disabled for your profile."
end
end
end,
}

-- code by CrazyGuy
ReloadTextFiles = function()
SetMan.SetBool(31,false)
SetMan.SetBool(31,true)
end
---------------------------------

OnError = function(msg)
Core.SendToOps("<"..Tr.Bot.."> "..msg.."|")
end


// edit updated to RC5 fixed profile issue
Title: Re: Transporter 1.0 RC1 [API 2]
Post by: rolipoli on 15 May, 2008, 11:47:00
Good work!!!
Title: Re: Transporter 1.0 RC1 [API 2]
Post by: shardana on 18 May, 2008, 00:07:38
The allow/block profile don't work. ???
Everybody can use transporter
Title: Re: Transporter 1.0 RC1 [API 2]
Post by: Daywalker? on 19 May, 2008, 22:30:57
tnx for the report hopely it's fixed now  ;)

updated script above
Title: Re: Transporter 1.0 RC1 [API 2]
Post by: rolipoli on 26 May, 2008, 21:20:56
"*** Creating File: Err in creating: lagtest.lua [Reason: To low Profile] is completed.. " this is appear when a master try to transport  lua or text file