Author Topic: Transporter 1.0 RC1 [API 2]  (Read 4492 times)

0 Members and 1 Guest are viewing this topic.

Offline Daywalker?

  • Scripter
  • Member
  • ******
  • Posts: 45
  • Karma: +9/-9
Transporter 1.0 RC1 [API 2]
« on: 17 April, 2008, 22:58:28 »
                                     Script Updated to RC2

Code: [Select]
--[[
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
« Last Edit: 17 April, 2008, 23:38:21 by Daywalker? »

PtokaX forum

Transporter 1.0 RC1 [API 2]
« on: 17 April, 2008, 22:58:28 »

Offline Daywalker?

  • Scripter
  • Member
  • ******
  • Posts: 45
  • Karma: +9/-9
Re: Transporter 1.0 RC3 [API 2][ServiceFriendly]
« Reply #1 on: 19 April, 2008, 12:20:58 »
Code: [Select]
--[[
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 American Idiot 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 
Code: [Select]
local f,e = assert(io.open(Tr.TextPath..file,"w"))  to
Code: [Select]
local f,e = assert(io.open(Tr.TxtPath..file,"w"))
« Last Edit: 13 May, 2008, 22:45:22 by Daywalker? »

Offline rolipoli

  • Junior Member
  • **
  • Posts: 19
  • Karma: +0/-1
  • Transilvania-Erd?ly
Re: Transporter 1.0 RC1 [API 2]
« Reply #2 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)


Offline Daywalker?

  • Scripter
  • Member
  • ******
  • Posts: 45
  • Karma: +9/-9
Re: Transporter 1.0 RC1 [API 2]
« Reply #3 on: 19 April, 2008, 14:20:39 »
Quote
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)

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


Offline rolipoli

  • Junior Member
  • **
  • Posts: 19
  • Karma: +0/-1
  • Transilvania-Erd?ly
Re: Transporter 1.0 RC1 [API 2]
« Reply #4 on: 19 April, 2008, 14:35:37 »
PtokaX DC Hub 0.4.0.0d

Offline Psycho_Chihuahua

  • Systemspecialist IT
  • Emperor
  • **
  • Posts: 1 054
  • Karma: +112/-1
  • I am wherever i want to be
    • PtokaX Luaboard
Re: Transporter 1.0 RC1 [API 2]
« Reply #5 on: 20 April, 2008, 13:11:50 »
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
PtokaxWiki ?PtokaX Mirror + latest Libs

01100001011011000111001101101111001000000110101101101110011011110111011101101110001000000110000101110011001000000101010001101111011010110110111101101100011011110111001101101000

Offline Daywalker?

  • Scripter
  • Member
  • ******
  • Posts: 45
  • Karma: +9/-9
Re: Transporter 1.0 RC1 [API 2]
« Reply #6 on: 20 April, 2008, 19:41:01 »
zactly .

:)

Offline rolipoli

  • Junior Member
  • **
  • Posts: 19
  • Karma: +0/-1
  • Transilvania-Erd?ly
Re: Transporter 1.0 RC1 [API 2]
« Reply #7 on: 22 April, 2008, 19:18:14 »
Thanks!!!I've suspected something like that but wasn't 100% sure about it.

Offline rolipoli

  • Junior Member
  • **
  • Posts: 19
  • Karma: +0/-1
  • Transilvania-Erd?ly
Re: Transporter 1.0 RC1 [API 2]
« Reply #8 on: 28 April, 2008, 11:05:52 »
I have a little request if it's possible,can be added the delete command?

Offline Daywalker?

  • Scripter
  • Member
  • ******
  • Posts: 45
  • Karma: +9/-9
Re: Transporter 1.0 RC1 [API 2](updated to RC4)
« Reply #9 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

Code: [Select]
--[[
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 American Idiot 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
« Last Edit: 19 May, 2008, 22:30:09 by Daywalker? »

Offline rolipoli

  • Junior Member
  • **
  • Posts: 19
  • Karma: +0/-1
  • Transilvania-Erd?ly
Re: Transporter 1.0 RC1 [API 2]
« Reply #10 on: 15 May, 2008, 11:47:00 »
Good work!!!

Offline shardana

  • Newbie
  • *
  • Posts: 6
  • Karma: +1/-1
Re: Transporter 1.0 RC1 [API 2]
« Reply #11 on: 18 May, 2008, 00:07:38 »
The allow/block profile don't work. ???
Everybody can use transporter

Offline Daywalker?

  • Scripter
  • Member
  • ******
  • Posts: 45
  • Karma: +9/-9
Re: Transporter 1.0 RC1 [API 2]
« Reply #12 on: 19 May, 2008, 22:30:57 »
tnx for the report hopely it's fixed now  ;)

updated script above

Offline rolipoli

  • Junior Member
  • **
  • Posts: 19
  • Karma: +0/-1
  • Transilvania-Erd?ly
Re: Transporter 1.0 RC1 [API 2]
« Reply #13 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

« Last Edit: 26 May, 2008, 21:22:32 by rolipoli »

PtokaX forum

Re: Transporter 1.0 RC1 [API 2]
« Reply #13 on: 26 May, 2008, 21:20:56 »