PtokaX forum

Lua 5.3/5.2/5.1 Scripts (for PtokaX 0.4.0.0 and newer) => Conversion Requests => Topic started by: ZadOff on 29 February, 2008, 06:31:44

Title: Please help
Post by: ZadOff on 29 February, 2008, 06:31:44
I have ptokax 3.6.0.0 and some scripts. I want to use 4.0.0.0 but my scripts not working on it. May you convert my scripts for 4.0.0.0. Please help. And if you can - send me new scripts on my mail:mekhtiev_n@mail.ru or give me a link on archive)))
Title: Re: Please help
Post by: ruler on 29 February, 2008, 07:20:45
most if not all of those scripts have already been converted, look here > http://board.ptokax.ath.cx/index.php?board=105.0
before requesting scripts or script conversions please check to see if they are already avaliable on the forum. the search button at the top is just there for show  ;D
Title: Re: Please help
Post by: F_O_X on 29 February, 2008, 13:22:26
zadoff The dude, all your attached scripts full dung to convert them as two fingers about asphalt.
Take the converter from Hungarista (http://dcpp.hu/converter.zip) and be pleased lives.

Look as converts scripts the converter about which I to you spoke
Title: Re: Please help
Post by: ZadOff on 29 February, 2008, 13:32:09
Link oh the converter is NOT working ((( give me please another one. And sorry - I can't find my scripts((( Sorry - but I'm not very smart on this things ... Help me please... :'(
Title: Re: Please help
Post by: F_O_X on 01 March, 2008, 21:03:17
Quote from: ZadOff on 29 February, 2008, 13:32:09
Link oh the converter is NOT working ((( give me please another one. And sorry - I can't find my scripts((( Sorry - but I'm not very smart on this things ... Help me please... :'(
http://dump.ru/files/o/o93267768/
Title: Re: Please help
Post by: Psycho_Chihuahua on 01 March, 2008, 22:19:47
Here's another Link --> Converter by Hungarista (http://board.ptokax.ath.cx/index.php?action=tpmod;dl=get57)
Title: Re: Please help
Post by: ZadOff on 04 March, 2008, 08:03:55
Thanks !!! But after convertion I have any scripts with this error:

Синтаксис [string "-- This script is converted with PtokaX LUA..."]:(NUMBER OF THE LINE): attempt to index global 'SetMan' (a nil value)

I don't know what to do(((

Title: Re: Please help
Post by: F_O_X on 04 March, 2008, 08:05:15
Quote from: Psycho_Chihuahua on 01 March, 2008, 22:19:47
Here's another Link --> Converter by Hungarista (http://board.ptokax.ath.cx/index.php?action=tpmod;dl=get57)
Psycho_Chihuahua Please correct the reference for uploading the converter in this theme: http://board.ptokax.ath.cx/index.php?topic=7338.msg70370#msg70370
Title: Re: Please help
Post by: ZadOff on 04 March, 2008, 08:23:30
Thanks
Title: Re: Please help
Post by: Psycho_Chihuahua on 04 March, 2008, 21:37:09
Quote from: F_O_X on 04 March, 2008, 08:05:15
Psycho_Chihuahua Please correct the reference for uploading the converter in this theme: http://board.ptokax.ath.cx/index.php?topic=7338.msg70370#msg70370



Done.
Title: Re: Please help
Post by: ZadOff on 05 March, 2008, 06:33:23
Can I place here a few of code for you? It not works((( Help


-- This script is converted with PtokaX LUA API Converter v0.9 at 03/04/08 09:33:25
--[[

Mute 1.0 LUA 5.0/5.1/5.11

By Mutor 06/24/06
Переведел и пофиксил некоторые ошибки NRJ (08/17/06)

Что же здесь вкусненького?
-VIP/OP/Master доступ к командам
-Можно глушить/снимать заглушку с ников онлайн и оффлайн
-Нельзя заглушить/снять заглушку с самого себя
-Менюшка
-Можно смотреть список заглушенных

***Важное замечание (это если вы хотите, чтобы командами могли пользоваться дополнительные профили; переводите сами ):
Allow certain profiles to use this script by
enabling this profile permission: [x] Gag,Ungag
Set permissions in the PtokaX GUI...
Options -> Profile Manager. Do this for each
profile that should be allowed these commands.


Помощь по скрипту

Команда Описание
????????????????????????????????????????
+mute            глушим юзера
+mhelp          помощь
+mlist          просмотреть всех заглушенных
+unmute          вернуть возможность говорить в чате

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

]]

MuteCfg = {
-- Имя бота
Bot = SetMan.GetString(21),
-- Бот оп или нет?
BotIsOp = 1,
-- Описание бота
BotDesc = "Mute bot",
-- Email бота
BotMail = "mail@mail.ru",
-- Название таблицы
File = "MutedCfg.txt",
-- Меню
SubMenu = "Заглушки юзеров",
-- Кому будут отправляться сообщения об ошибках?
OpNick = "SeT",
-- Таблица заглушенных ников
Muted = {},
}

OnStartup = function()
gc = nil
if _VERSION == "Lua 5.1" then
gc = "collect"
end
if loadfile(MuteCfg.File) then
dofile(MuteCfg.File)
else
Save_File(MuteCfg.File,MuteCfg,"MuteCfg")
end
if MuteCfg.Bot ~= SetMan.GetString(21) or
MuteCfg.Bot == SetMan.GetString(21) and not (SetMan.GetBool(17) and 1 or 0) then
Core.RegBot(MuteCfg.Bot,MuteCfg.BotDesc,MuteCfg.BotMail,false)
end
OnError("Скрипт Mute 1.0 LUA версии ".._VERSION.." запущен. Используется памяти: "..collectgarbage(count).." Кб.")
end

OnExit = function()
OnError("Скрипт Mute 1.0 LUA версии ".._VERSION.." остановлен.")
end

OnError = function(msg)
Core.SendToNick(MuteCfg.OpNick,"<"..MuteCfg.Bot.."> "..msg)
end

function NewUserConnected(user, data)
if (RegMan.GetReg(user.sNick) and RegMan.GetReg(user.sNick).iProfile) and ProfMan.GetProfile(user.iProfile) and ProfMan.GetProfile(user.iProfile).tProfilePermissions.bGag then
SendMuteCmds(user)
Core.SendToNick(user.sNick,"<"..MuteCfg.Bot.."> "..(ProfMan.GetProfile(user.iProfile) and ProfMan.GetProfile(user.iProfile).sProfileName).."'s команды заглушки пользователей доступны!"..
"Команды доступны через всплывающее меню по правой кнопке мыши..")
end
end
OpConnected = UserConnected

ChatArrival = function(user,data)
Core.GetUserAllData(user)
if MuteCfg.Muted[user.sNick] then
Core.SendPmToNick(user.sNick,MuteCfg.Bot,"Вам выставлена заглушка на чат! Вы не можете говорить ни в общем чате, ни в привате.")
Core.SendToNick(user.sNick,"<"..MuteCfg.Bot.."> Вы заглушены! Бесполезно пытаться что-либо написать.")
return true
else
if (RegMan.GetReg(user.sNick) and RegMan.GetReg(user.sNick).iProfile) and ProfMan.GetProfile(user.iProfile) and ProfMan.GetProfile(user.iProfile).tProfilePermissions.bGag then
local s,e,to = string.find(data,"^$To:%s(%S+)%sFrom:")
local s,e,cmd = string.find( data, "%b<>%s%p(%w+)")
if cmd and MuteCmds[cmd] then
if to and to == MuteCfg.Bot then
Core.SendPmToNick(user.sNick,MuteCfg.Bot,MuteCmds[cmd](user,data))
else
Core.SendToNick(user.sNick,"<"..MuteCfg.Bot.."> "..MuteCmds[cmd](user,data))
end
collectgarbage(gc)
return true
end
end
end
end
ToArrival = ChatArrival

MuteCmds = {
mute = function(user,data)
if user then
local s,e,nick = string.find( data, "%b<>%s%p%w+%s(%S+)|$")
if not nick then
function getcmdprefixarray() local p = {} for i=1,#SetMan.GetString(29) do table.insert(p,SetMan.GetString(29):sub(i,i)) end end
return "Ошибка!, Используйте: "..getcmdprefixarray()[1]..
"mute <ник>"
else
if nick == user.sNick then
return "Вы не можете заглушить самого себя "..user.sNick..". Не будьте дураком!"
end
if MuteCfg.Muted[nick] then
return "Пользователь: "..nick.." уже заглушен."
else
MuteCfg.Muted[nick] = 1
Save_File(MuteCfg.File,MuteCfg,"MuteCfg")
local status = "оффлайн"
if Core.GetUser(nick,true) then
        status = "онлайн"
Core.SendToNick(nick,"<"..MuteCfg.Bot.."> Вы были заглушены. "..
"Теперь Вы не можете говорить ни в главном чате, ни в привате.")
end
Core.SendToAll("<"..MuteCfg.Bot.."> Пользователь "..nick..", находящийся "..status..", заглушен "..
"и не может пользоваться ни чатом, ни приватом.")
return nil
end
end
else
return "Заглушить юзера"," %[line:Ник]"," %[nick]"
end
end,
unmute = function(user,data)
if user then
local s,e,nick = string.find( data, "%b<>%s%p%w+%s(%S+)|$")
if not nick then
function getcmdprefixarray() local p = {} for i=1,#SetMan.GetString(29) do table.insert(p,SetMan.GetString(29):sub(i,i)) end end
return "Ошибка!, Используйте: "..getcmdprefixarray()[1]..
"unmute <ник>"
else
if nick == user.sNick then
return "Вы не можете снять заглушку с самого себя, "..user.sNick..". Делать что ли нечего, да?"
end
if not MuteCfg.Muted[nick] then
return "Пользователь: "..nick.." не был заглушен."
else
MuteCfg.Muted[nick] = nil
Save_File(MuteCfg.File,MuteCfg,"MuteCfg")
local status = "оффлайн"
if Core.GetUser(nick,true) then
status = "онлайн"
Core.SendToNick(nick,"<"..MuteCfg.Bot.."> Заглущка на чат снята. "..
"Теперь вы можете говорить в чате и привате.")
end
Core.SendToAll("<"..MuteCfg.Bot..">  С пользователя "..nick..", находящегося "..status..", снята заглушка. "..
"Теперь он может общаться и в чате, и в привате.")
return nil
end
end
else
return "Снять заглушку"," %[line:Ник]"," %[nick]"
end
end,
mlist = function(user,data)
if user then
if next(MuteCfg.Muted) then
local Count = 0
local reply = "Список заглушенных юзеров...\r\n\r\n\tНомер\t\tНик\r\n"..
"\t"..string.rep("?",40).."\r\n"
for i,v in pairs(MuteCfg.Muted) do
Count = Count + 1
reply = reply.."\t"..string.format("[ %-3s ]",Count).."\t\t"..i.."\r\n"
end
return reply.."\n\t"..string.rep("?",40).."\r\n\r\n"
else
return "На данный момент никто не заглушен."
end
else
return "Список заглушенных юзеров","",""
end
end,
mhelp = function(user,data)
if user then
local reply = "Помощь по командам\r\n\r\n\tКоманда\t\tОписание\r\n"..
"\t"..string.rep("?",40).."\r\n"
for i,v in pairs(MuteCmds) do
local desc,args = MuteCmds[i]()
reply = reply.."\t+"..string.format("%-15s",i).."\t"..desc.."\r\n"
end
return reply.."\n\t"..string.rep("?",40).."\r\n\r\n"
else
return "Помощь","",""
end
end,
}

SendMuteCmds = function(user)
for i,v in pairs(MuteCmds) do
local desc,arg1,arg2 = MuteCmds[i]()
Core.SendToNick(user.sNick,"$UserCommand 1 1 "..MuteCfg.SubMenu.."\\"..
desc.."$<%[mynick]> +"..i..arg1.."&#124;")
Core.SendToNick(user.sNick,"$UserCommand 1 2 "..MuteCfg.SubMenu.."\\"..
desc.."$$To: "..MuteCfg.Bot.." From: %[mynick] $<%[mynick]> +"..i..arg2.."&#124;")
collectgarbage(gc)
end
end

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

Save_File = function(file,table, tablename )
local hFile = io.open (file , "wb")
Save_Serialize(table, tablename, hFile)
hFile:close()
collectgarbage(gc)
end
RegConnected = UserConnected
Title: Re: Please help
Post by: ZadOff on 05 March, 2008, 06:34:47
the second script :'(
-- This script is converted with PtokaX LUA API Converter v0.9 at 03/04/08 09:33:25
--[[

Простой скрипт регистрации
от NRJ v. 1.2 (22/09/06)

Команды:
!regme <pass> - зарегистрироваться
!passwd <new_pass> - изменить пароль (встроенная команда)
!unreg - удалить регистрацию

Changelog:

**1.2**
- незарегистрированные пользователи при входе на хаб получают сообщение о неоходимости регистрации
- добавлена команда !reghelp

**1.1**
- добавлена команда !unreg
- добавлено меню для зарегистрированного пользователя

]]--

----------------------------------------------------- Конфигурация -----------------------------------------------------
------------------------------------------------------------------------------------------------------------------------

ShowInfo = 1 -- позазывать дополнительную информацию о том, как можно избежать повторных вводов пароля при входе на хаб
ShowToAll = 1 -- показывать всем пользователям, что на хабе новый зарегистрированный участник

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

bot = SetMan.GetString(21)

function UserConnected(user)
Core.GetUserAllData(user)
if not(RegMan.GetReg(user.sNick)) and not (RegMan.GetReg(user.sName)) then
local msg = "\r\n\r\n"..
"\t????????????????????????????????????????????????????????\r\n"..
"\t\tВЫ НЕ ЗАРЕГИСТРИРОВАНЫ НА ХАБЕ ! ! !\r\n"..
"\t????????????????????????????????????????????????????????\r\n\r\n"..
"\tПомощь по регистрации: !reghelp\r\n\r\n"..
"\t"..string.rep("-", 112).."\r\n"
Core.SendPmToNick(user.sNick,bot,msg)
end
UserMenu(user)
end


function ChatArrival(user,data)
Core.GetUserAllData(user)
local data = string.sub(data,1,-2)
local s,e,cmd =string.find(data, "%b<>%s+(%S+)")
if cmd == "!regme" then
if not(RegMan.GetReg(user.sNick)) and not (RegMan.GetReg(user.sName)) then
local s,e,pass = string.find(data, "%b<>%s+%S+%s+(%S+)")
if (pass == nil) then
local pass=math.random(os.date("%H%M%S"))
RegMan.AddReg(user.sNick, pass, 3)
Core.SendToNick(user.sNick,"<"..bot.."> Вы были зарегистрированы на хабе. Ваш ник:"..user.sNick.." Пароль: "..pass..". Не забудьте перезайти на хаб!")
if (ShowInfo == 1) then
Core.SendToNick(user.sNick,"<"..bot.."> Теперь для входа на хаб под вашим ником необходимо знать пароль. Вы можете вводить его каждый раз вручную, либо прописать пароль в настройках клиента. Для этого найдите в списке избранных хабов этот хаб, зайдите в его свойства и пропишите в строках Nick и Password ваши ник и пароль.")
end
if (ShowToAll == 1) then
Core.SendToAll("<"..bot.."> Поприветствуем нового зарегистрировавшегося участника - "..user.sNick.." !!!")
end
else
RegMan.AddReg(user.sNick, pass, 3)
Core.SendToNick(user.sNick,"<"..bot.."> Вы были зарегистрированы на хабе. Ваш ник:"..user.sNick.." Пароль: "..pass..". Не забудьте перезайти на хаб!")
if (ShowInfo == 1) then
Core.SendToNick(user.sNick,"<"..bot.."> Теперь для входа на хаб под вашим ником необходимо знать пароль. Вы можете вводить его каждый раз вручную, либо прописать пароль в настройках клиента. Для этого найдите в списке избранных хабов этот хаб, зайдите в его свойства и пропишите в строках Nick и Password ваши ник и пароль.")
end
if (ShowToAll == 1) then
Core.SendToAll("<"..bot.."> Поприветствуем нового зарегистрировавшегося участника - "..user.sNick.." !!!")
end
end
else
Core.SendToNick(user.sNick,"<"..bot.."> Вы уже зарегистрированы!")
end
return true
end
if cmd == "!unreg" then
if (user.iProfile == 3) then
RegMan.DelReg(user.sNick)
Core.SendToNick(user.sNick,"<"..bot.."> Ваш аккаунт был был удален")
else
Core.SendToNick(user.sNick,"<"..bot.."> Команда доступна только для зарегистрированных пользователей!")
end
return true
end
if cmd == "!reghelp" then
local msg = "\r\n\r\n"..
"\t"..string.rep("=", 50).."\r\n"..
"\t\tПомощь по регистрации\r\n"..
"\t"..string.rep("-", 100).."\r\n\r\n"..
"\t!reghelp\t\t - Этот файл помощи\r\n"..
"\t!regme <пасс>\t - Зарегистрироваться (можно не указывать пасс)\r\n"..
"\t!passwd <пасс>\t - Сменить пароль (встроенная команда хаба)\r\n"..
"\t!unreg\t\t - Удалить аккаунт\r\n\r\n"..
"\tТакже все команды доступны в меню хаба:\r\n"..
"\tНажмите правой кнопкой мыши на любого пользователя\r\n"..
"\tи выбирете подменю 'Регистрация'\r\n"
Core.SendPmToNick(user.sNick,bot,msg)
end
end

ToArrival = ChatArrival

function UserMenu(user)
if (user.iProfile == -1) then
Core.SendToNick(user.sNick,"$UserCommand 0 3")
Core.SendToNick(user.sNick,"$UserCommand 1 3 Регистрация\\Зарегистрироваться$<%[mynick]> !regme %[line:Введите пароль или оставьте поле пустым]&#124;")
end
if (user.iProfile == 3) then
Core.SendToNick(user.sNick,"$UserCommand 0 3")
Core.SendToNick(user.sNick,"$UserCommand 1 3 Регистрация\\Сменить пароль$<%[mynick]> !passwd %[line:Введите новый пароль]&#124;")
Core.SendToNick(user.sNick,"$UserCommand 1 3 Регистрация\\Удалить регистрацию$<%[mynick]> !unreg&#124;")
end
end
RegConnected = UserConnected
Title: Re: Please help
Post by: ZadOff on 05 March, 2008, 06:35:47
Third script
-- This script is converted with PtokaX LUA API Converter v0.9 at 03/04/08 09:33:26
--[[

Скрипт: User Info
Автор: dragos_sto

Перевод и меню: by NRJ

]]--

----------------------------------- Конфигурация -----------------------------------
------------------------------------------------------------------------------------

pathUser = "UserInfo" -- Название папки, в которой будут храниться информация о юзерах
pathIp = "IpInfo" -- Название папки, в которой будут храниться информация о IP
ext = ".log" -- Расширение файлов
userlastlog = 20 -- кол-во последних ников, которые использовал юзер
iplastlog = 20 -- кол-во последних IP, которые использовал юзер
botname = SetMan.GetString(21) -- Имя бота

-- Команды
command = {
[1] = "userinfo",
[2] = "ipinfo",
[3] = "userlast",
[4] = "iplast",
[5] = "userlist",
[6] = "lhelp",
}

prefcmd = "" -- Префиксы для команд
firstpref = "#"

-- У кого есть доступ к командам
AllowedProfiles = {
[0] = 1,   -- Masters
[1] = 0,   -- Operators
}

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

os.execute("mkdir ".."\""..string.gsub(pathUser, "/", "\\").."\"")
os.execute("mkdir ".."\""..string.gsub(pathIp, "/", "\\").."\"")

onlineuser = {}

function Main(user,data)
prefcmd = "]"
function getcmdprefixarray() local p = {} for i=1,#SetMan.GetString(29) do table.insert(p,SetMan.GetString(29):sub(i,i)) end end
local pref,count = getcmdprefixarray(),0
for pre,preval in pairs(pref) do
if count == 0 then
firstpref = preval
count = 1
end
prefcmd = "%"..preval..""..prefcmd
end
prefcmd = "["..prefcmd
--[%!%+%?]
end

function UserConnected(curUser)
Core.GetUserAllData(curUser)
if AllowedProfiles[curUser.iProfile] == 1 then
Core.SendToNick(curUser.sNick,"$UserCommand 1 3 User Log\\Помощь$<%[mynick]> "..firstpref..""..command[6].."&#124;")
Core.SendToNick(curUser.sNick,"$UserCommand 1 3 User Log\\Инфо по нику$<%[mynick]> "..firstpref..""..command[1].." %[line:Введите ник]&#124;")
Core.SendToNick(curUser.sNick,"$UserCommand 1 3 User Log\\Инфо по IP$<%[mynick]> "..firstpref..""..command[2].." %[line:Введите IP-адрес]&#124;")
Core.SendToNick(curUser.sNick,"$UserCommand 1 3 User Log\\Посл. "..userlastlog.." откл. по нику $<%[mynick]> "..firstpref..""..command[3].." %[line:Введите ник]&#124;")
Core.SendToNick(curUser.sNick,"$UserCommand 1 3 User Log\\Посл. "..iplastlog.." откл. по IP$<%[mynick]> "..firstpref..""..command[4].." %[line:Введите IP-адрес]&#124;")
Core.SendToNick(curUser.sNick,"$UserCommand 1 3 User Log\\Когда вошел..$<%[mynick]> "..firstpref..""..command[5].." %[line:Введите ник]&#124;")
end
local ma = ""
local count = 0
local usernam = tostring (string.lower(curUser.sNick))
local userip = tostring (curUser.sIP)
if io.open(pathUser.."/"..usernam..ext) == nil then io.open(pathUser.."/"..usernam..ext,"w") end
for line in io.lines(pathUser.."/"..usernam..ext) do
if ( string.sub(line,  1, string.len(userip) ) == userip ) then
local des = string.match(line,"%S+%=%=(%d+)$")
des = des + 1
count = 1
ma = ma..""..userip.."=="..des.."\r\n"
else
ma = ma..line.."\r\n"
end
end
if count == 0 then ma = ma..""..userip.."==".."1".."\r\n" end
local f,_ = io.open(pathUser.."/"..usernam..ext,"w+")
f:write(ma)
f:flush()
f:close()
ma = ""
count = 0
if io.open(pathIp.."/"..userip..ext) == nil then io.open(pathIp.."/"..userip..ext,"w") end
for line in io.lines(pathIp.."/"..userip..ext) do
if ( string.sub(line,  1, string.len(usernam) ) == usernam ) then
    local des = string.match ( line, "%S+%=%=(%d+)$" )
    des = des + 1
    count = 1
    ma = ma..usernam.."=="..des.."\r\n"
else
    ma = ma..line.."\r\n"
end
end
if count == 0 then ma = ma..""..usernam.."==".."1".."\r\n" end
local f,_ = io.open(pathIp.."/"..userip..ext,"w+")
f:write(ma)
f:flush()
f:close()
ma = "Юзер "..usernam.." вошел "..os.date("%d-%m-%Y").." в "..os.date("%H:%M:%S").." с IP "..userip
onlineuser[usernam] = ma
io.flush()
end

function UserDisconnected(curUser)
Core.GetUserAllData(curUser)
local ma = ""
local count = 0
local usernam = tostring (string.lower(curUser.sNick))
local userip = tostring (curUser.sIP)
count = 0
if io.open(pathUser.."/"..usernam.."last"..ext) == nil then io.open(pathUser.."/"..usernam.."last"..ext,"w") end
ma = "Последнее посещение "..os.date("%d-%m-%Y").." в "..os.date("%H:%M:%S").." с IP-адресом "..userip.."\r\n"
for line in io.lines(pathUser.."/"..usernam.."last"..ext) do
if count < userlastlog then
count = count + 1
ma = ma..line.."\r\n"
end
end
local f,_ = io.open(pathUser.."/"..usernam.."last"..ext,"w+")
f:write(ma)
f:flush()
f:close()
count = 0
if io.open(pathIp.."/"..userip.."last"..ext) == nil then io.open(pathIp.."/"..userip.."last"..ext,"w") end
ma = "Последнее посещение "..os.date("%d-%m-%Y").." в "..os.date("%H:%M:%S").." с ником "..usernam.."\r\n"
for line in io.lines(pathIp.."/"..userip.."last"..ext) do
if count < iplastlog then
count = count + 1
ma = ma..line.."\r\n"
end
end
local f,_ = io.open(pathIp.."/"..userip.."last"..ext,"w+")
f:write(ma)
f:flush()
f:close()
onlineuser[usernam] = nil
io.flush()
end

OpConnected = UserConnected

OpDisconnected = UserDisconnected

tCmds = {
[command[1]] = function(user, data)
if data == "" or data == nil then
Core.SendToNick(user.sNick, "<"..botname.."> Вы не выбрали ни ник, ни IP-адрес|")
elseif io.open(pathUser.."/"..data..ext) == nil then
Core.SendToNick(user.sNick, "<"..botname.."> В логах нет юзера с ником "..data.."!!!")
else
Core.SendToNick(user.sNick, "<"..botname.."> IP-адреса для пользователя "..data..": \r\n")
for line in io.lines(pathUser.."/"..data..ext) do
Core.SendToNick(user.sNick, "<"..botname.."> \t"..line)
end
end
return true
end,
[command[2]] = function(user, data)
if data == "" or data == nil then
Core.SendToNick(user.sNick, "<"..botname.."> Вы не выбрали ни ник, ни IP-адрес|")
elseif io.open(pathIp.."/"..data..ext) == nil then
Core.SendToNick(user.sNick, "<"..botname.."> В логах нет IP-адреса "..data.."!!!")
else
Core.SendToNick(user.sNick, "<"..botname.."> Ники юзеров для IP-адреса "..data..": \r\n")
for line in io.lines(pathIp.."/"..data..ext) do
Core.SendToNick(user.sNick, "<"..botname.."> \t"..line)
end
end
return true
end,
[command[3]] = function(user, data)
if data == "" or data == nil then
Core.SendToNick(user.sNick, "<"..botname.."> Вы не выбрали ни ник, ни IP-адрес|")
elseif io.open(pathUser.."/"..data.."last"..ext) == nil then
Core.SendToNick(user.sNick, "<"..botname.."> В логах нет юзера с ником "..data.." !!!")
else
for line in io.lines(pathUser.."/"..data.."last"..ext) do
Core.SendToNick(user.sNick, "<"..botname.."> "..line)
end
end
return true
end,
[command[4]] = function(user, data)
if data == "" or data == nil then
Core.SendToNick(user.sNick, "<"..botname.."> Вы не выбрали ни ник, ни IP-адрес|")
elseif io.open(pathIp.."/"..data.."last"..ext) == nil then
Core.SendToNick(user.sNick, "<"..botname.."> В логах нет IP-адреса "..data.."!!!")
else
for line in io.lines(pathIp.."/"..data.."last"..ext) do
Core.SendToNick(user.sNick, "<"..botname..">"..line)
end
end
return true
end,
[command[5]] = function(user, data)
if onlineuser ~= nil or onlineuser ~= "" then
for seto,setoval in pairs(onlineuser) do
Core.SendToNick(user.sNick, "<"..botname.."> "..setoval.."|")
end
return true
end
end,
[command[6]] = function(user, data)
Core.SendToNick(user.sNick, "\t\t Помощь по скрипту логирования юзеров и их IP-адресов\r\n")
Core.SendToNick(user.sNick, "\t"..firstpref..""..command[1].." <ник> \t - Узнать все IP-адреса юзера, и сколько раз он заходил с каждого")
Core.SendToNick(user.sNick, "\t"..firstpref..""..command[2].." <IP> \t - Узнать все ники, с которых был произведен заход с IP, и сколько раз")
Core.SendToNick(user.sNick, "\t"..firstpref..""..command[3].." <ник> \t - Посмотреть последние "..userlastlog.." отключений юзера от хаба ")
Core.SendToNick(user.sNick, "\t"..firstpref..""..command[4].." <ник> \t - Посмотреть последние "..iplastlog.." отключений IP от хаба ")
Core.SendToNick(user.sNick, "\t"..firstpref..""..command[5].." <ник> \t - Посмотреть, во сколько и с какого IP вошел юзер на хабе\r\n")
return true
end,
}

function ChatArrival(user,data)
Core.GetUserAllData(user)
if AllowedProfiles[user.iProfile] == 1 then
if (string.sub(data,1,1) == "<") then
local data1=string.sub(data,1,string.len(data)-1)
local cmd = string.match(data1,"%b<>%s+"..prefcmd.."(%S+)")
if cmd then
cmd = string.lower(cmd)
if tCmds[cmd] then
local _,hodata = string.match(data1,"%b<>%s+"..prefcmd.."(%S+)%s+(%S*)$")
if hodata == nil then hodata = "" end
hodata = string.lower(hodata)
hodata = tostring (hodata)
if  tCmds[cmd] then
return tCmds[cmd](user, hodata)
end
end
end
end
end
end


RegConnected = UserConnectedRegDisconnected = UserDisconnected
Title: Re: Please help
Post by: ZadOff on 05 March, 2008, 06:36:43
And the last script
-- This script is converted with PtokaX LUA API Converter v0.9 at 03/04/08 09:33:25
--[[
User Log 1.0 LUA 5.0/5.11
By Mutor 08/19/06

Перевод:
By NRJ 08/21/06

User Log Помощь по командам

Команда Описание
????????????????????????????????????????
+check          Проверить лог юзера...
+listlog        Посмотреть User Log
+loghelp        Помощь по командам

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



]]

LogCfg = {
-- Бот возьмет имя с хаба или же вы зададите емус свое имя?
Bot = SetMan.GetString(21),
-- Назание хаба
Hub = SetMan.GetString(0),
-- Будет ли у бота ключик
BotIsOp = 1,
-- Описание бота
BotDesc = "User Log",
-- Email бота
BotMail = "user@domain.com",
-- В каком файле все будет храниться
File = "UserLog.txt",
-- Название менюшки
SubMenu = "Лог юзеров",
-- Ник админа для статуc-сообщений и сообщениях об ошибках
OpNick = "NRJ",
-- Уровень доступа к командам
--[профиль#] = {0/1 (0=Команды/меню отключено / 1=Команды/меню включено),"Название профиля"},
Profiles = {
[-1] = {0,"Незарегистрированный пользователь"},
[0] = {1,"Мастер"},
[1] = {1,"Оператор"},
[2] = {0,"VIP"},
[3] = {0,"Зарегестрированный пользователь"},
[4] = {1,"Moderator"}, --для RoboCop'a
[5] = {1,"NetFounder"}, --для RoboCop'a
},
-- Таблица логов
UserLog = {},
}

OnStartup = function()
gc,no = nil,table.getn
if _VERSION == "Lua 5.1" then
gc,no = "collect",table.maxn
end
if loadfile(LogCfg.File) then
dofile(LogCfg.File)
else
for i,v in ipairs(Core.GetOnlineUsers(true)) do
user = GetItemByName(v.sNick)
Log(user)
end
Save_File(LogCfg.File,LogCfg,"LogCfg")
end
if LogCfg.Bot ~= SetMan.GetString(21) or
LogCfg.Bot == SetMan.GetString(21) and not (SetMan.GetBool(17) and 1 or 0) then
Core.RegBot(LogCfg.Bot,LogCfg.BotDesc,LogCfg.BotMail,false)
end
collectgarbage(gc)
OnError("User Log 1.0 LUA версии ".._VERSION.." от Mutor'a стартовал. Задействовано памяти: "..collectgarbage(count).." Кб.")
end

OnExit = function()
OnError("User Log 1.0 LUA версии ".._VERSION.." от Mutor'a остановлен.")
--Save_File(LogCfg.File,LogCfg,"LogCfg")
end

OnError = function(msg)
Core.SendToNick(LogCfg.OpNick,"<"..LogCfg.Bot.."> "..msg)
end

function NewUserConnected(user, data)
Log(user)
if LogCfg.Profiles[user.iProfile] and LogCfg.Profiles[user.iProfile][1] == 1 then
SendLogCmds(user)
Core.SendToNick(user.sNick,"<"..LogCfg.Bot.."> Добро пожаловать, "..user.sNick..", "..(ProfMan.GetProfile(user.iProfile) and ProfMan.GetProfile(user.iProfile).sProfileName)..
"'s User Log команды доступны нажатием правой кнопки мыши на любого пользователя.")
end
end
OpConnected = UserConnected

ChatArrival = function(user,data)
Core.GetUserAllData(user)
data = string.sub(data,1,-2)
if LogCfg.Profiles[user.iProfile] and LogCfg.Profiles[user.iProfile][1] == 1 then
local s,e,cmd = string.find( data, "%b<>%s%p(%w+)")
local s,e,to = string.find(data,"^$To:%s(%S+)%sFrom:")
if cmd and LogCmds[cmd] then
if to and to == LogCfg.Bot then
Core.SendPmToNick(user.sNick,LogCfg.Bot,LogCmds[cmd](user,data))
else
Core.SendToNick(user.sNick,"<"..LogCfg.Bot.."> "..LogCmds[cmd](user,data))
end
collectgarbage(gc)
return true
end
end
end
ToArrival = ChatArrival

Log = function(user)
local nick,profile,time,exists = user.sNick,(ProfMan.GetProfile(user.iProfile) and ProfMan.GetProfile(user.iProfile).sProfileName) or "Unregistered User",os.date("*t"),nil
for i,v in ipairs(LogCfg.UserLog) do
if v[1] == user.sNick then
exists = true
                        v[2],v[3] = profile,time
break
end
end
if not exists then
local t = {nick,profile,time}
table.insert(LogCfg.UserLog,t)
end
Save_File(LogCfg.File,LogCfg,"LogCfg")
collectgarbage(gc)
end

GetLog = function(nick)
if nick then
local msg = nil
for i,v in ipairs(LogCfg.UserLog) do
if v[1] == nick then
msg = {v[1],v[2],v[3]}
break
end
end
collectgarbage(gc)
return msg
end
end

LogCmds = {
check = function(user,data)
if user then
local s,e,nick = string.find( data, "%b<>%s%p%w+%s(%S+)")
if not nick then
function getcmdprefixarray() local p = {} for i=1,#SetMan.GetString(29) do table.insert(p,SetMan.GetString(29):sub(i,i)) end end
return "Ошибка!, Используйте: "..getcmdprefixarray()[1]..
"check <ник>"
else
local msg,prof = "Пользователь: ",(ProfMan.GetProfile((RegMan.GetReg(nick) and RegMan.GetReg(nick).iProfile)) and ProfMan.GetProfile((RegMan.GetReg(nick) and RegMan.GetReg(nick).iProfile)).sProfileName) or "Unregistered"
local usr,on = GetItemByName(nick)," в оффлайне"
if GetLog(nick) then
local t = GetLog(nick)
if usr then
on = "онлайн"
end
msg = msg..t[1]..". Последнее появление на хабе: "..
t[3]["day"].."."..t[3]["month"].."."..t[3]["year"]..
" - "..t[3]["hour"]..":"..t[3]["min"].." В данный момент "..on
else
msg = msg..nick.." имеет профиль "..prof.." и не существует в логе "..
"and is currently "..on
end
return msg
end
else
return "Проверить лог юзера..."," %[line:Ник]"," %[nick]"
end
end,
listlog = function(user,data)
if user then
local reply = "Список User Log\r\n\r\n\tUser\t\t\tПосл. посещение\t\tСтатус\r\n"..
"\t????????????????????????????????????????????????????????????\r\n"
for i,v in ipairs(LogCfg.UserLog) do
local usr,on = GetItemByName(v[1]),"- Оффлайн -"
if usr then
on = "+ Онлайн +"
end
reply = reply.."\t"..string.format("%-30s",v[1]).."\t"..
string.format("%-16s",v[3]["day"].."."..v[3]["month"].."."..v[3]["year"]..
" - "..v[3]["hour"]..":"..v[3]["min"]).."\t\t"..on.."\r\n"
end
return reply.."\n\t????????????????????????????????????????????????????????????\r\n\r\n"
else
return "Показать лог юзера","",""
end
end,
loghelp = function(user,data)
if user then
local reply = "User Log Помощь по командам\r\n\r\n\tКоманда\t\tОписание\r\n"..
"\t????????????????????????????????????????\r\n"
for i,v in pairs(LogCmds) do
local desc,args = LogCmds[i]()
reply = reply.."\t+"..string.format("%-15s",i).."\t"..desc.."\r\n"
end
return reply.."\n\t????????????????????????????????????????\r\n\r\n"
else
return "Помощь по командам","",""
end
end,
}

SendLogCmds = function(user)
for i,v in pairs(LogCmds) do
local desc,arg1,arg2 = LogCmds[i]()
Core.SendToNick(user.sNick,"$UserCommand 1 1 "..LogCfg.SubMenu.."\\"..
desc.."$<%[mynick]> +"..i..arg1.."&#124;")
Core.SendToNick(user.sNick,"$UserCommand 1 2 "..LogCfg.SubMenu.."\\"..
desc.."$$To: "..LogCfg.Bot.." From: %[mynick] $<%[mynick]> +"..i..arg2.."&#124;")
collectgarbage(gc)
end
end

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

Save_File = function(file,table, tablename )
local hFile = io.open (file , "wb")
Save_Serialize(table, tablename, hFile)
io.flush()
hFile:close()
collectgarbage(gc)
end
RegConnected = UserConnected
Title: Re: Please help
Post by: ZadOff on 05 March, 2008, 06:38:55
I AM VERY SORRY BUT - it is very important for me because i have a hub. 150 guys. PLEASE help :'(
Title: Re: Please help
Post by: F_O_X on 05 March, 2008, 08:17:56
ZadOff Use search, all your scripts for a long time are already converted.
And from Russian on English and back here anybody will not be engaged in translation.
In Russian I already have laid out scripts in this theme:
http://forum.proc.ru/index.php?showtopic=40376


In search inquiry write for example date or key function of a required script.
Then you will have hope, that the script to you is converted.

Example:
We search for first your script. Search by word Mute.
http://board.ptokax.ath.cx/index.php?topic=6099.0

And so for all scripts search.
Title: Re: Please help
Post by: ZadOff on 05 March, 2008, 11:58:12
SPECIAL FOR !!! F O X !!! 1 - my scripts is lua 5.1.2 - and I need to convert them to 5.1.3 !!! for ptokax 0.4.0.0
                                   2 - those scripts on your link are 5.1.1 !!!

If you can't help me - don't flood
Title: Re: Please help
Post by: F_O_X on 05 March, 2008, 12:08:41
Quote from: ZadOff on 05 March, 2008, 11:58:12
SPECIAL FOR !!! F O X !!! 1 - my scripts is lua 5.1.2 - and I need to convert them to 5.1.3 !!! for ptokax 0.4.0.0
                                   2 - those scripts on your link are 5.1.1 !!!

If you can't help me - don't flood

Well, well. Then sit and wait at the sea of weather.
Title: Re: Please help
Post by: ZadOff on 06 March, 2008, 06:11:53
I hope that someone who knows scripts - help me - in my 4 scripts only 1 error - and I don't know how to fix them(((
Title: Re: Please help
Post by: speedX on 06 March, 2008, 09:54:46
Quote from: ZadOff on 06 March, 2008, 06:11:53
I hope that someone who knows scripts - help me - in my 4 scripts only 1 error - and I don't know how to fix them(((

Then post your errors with the script.....
Title: Re: Please help
Post by: ZadOff on 06 March, 2008, 10:50:15
for first script: Синтаксис [string "-- This script is converted with PtokaX LUA..."]:39: attempt to index global 'SetMan' (a nil value)
for sercond script: Синтаксис [string "-- This script is converted with PtokaX LUA..."]:33: attempt to index global 'SetMan' (a nil value)
for third script: Синтаксис [string "-- This script is converted with PtokaX LUA API Converter v0.9 ..."]:249: unexpected symbol near '='
for fourth script: Синтаксис [string "-- This script is converted with PtokaX LUA..."]:25: attempt to index global 'SetMan' (a nil value)
Title: Re: Please help
Post by: Madman on 06 March, 2008, 12:47:28
what ptokax version are you useing?
Title: Re: Please help
Post by: F_O_X on 06 March, 2008, 13:11:56
Quote from: ZadOff on 06 March, 2008, 10:50:15
for first script: ????????? [string "-- This script is converted with PtokaX LUA..."]:39: attempt to index global 'SetMan' (a nil value)
for sercond script: ????????? [string "-- This script is converted with PtokaX LUA..."]:33: attempt to index global 'SetMan' (a nil value)
for third script: ????????? [string "-- This script is converted with PtokaX LUA API Converter v0.9 ..."]:249: unexpected symbol near '='
for fourth script: ????????? [string "-- This script is converted with PtokaX LUA..."]:25: attempt to index global 'SetMan' (a nil value)
1, 2 and 4 errors. Your name is not mentioned hub (Hub bot).
1, 2 ? 4 ??????. ? ?????????? ?? ??????? ??? ???? (???????? ????).
Bot = SetMan.GetString(21),
Fill in the column Nick
(http://www.ptokax.org/files/images/3%20-%20Bots.png)

3 ??????: ??? ???????
3 mistake: there is no blank
RegConnected = UserConnectedRegDisconnected = UserDisconnected
RegConnected = UserConnected
RegDisconnected = UserDisconnected


Zadoff ?? ??????? ??????? ?????? ?????? 5 ? 6    Zadoff do not break a rule of a forum points 5 and 6
http://board.ptokax.ath.cx/index.php?action=rules

Title: Re: Please help
Post by: ZadOff on 06 March, 2008, 13:30:36
Quote from: Madman on 06 March, 2008, 12:47:28
what ptokax version are you useing?

I have 0.3.6.0 but i want to use 0.4.0.0
Title: Re: Please help
Post by: ZadOff on 06 March, 2008, 13:34:16
Quote from: F_O_X on 06 March, 2008, 13:11:56
1, 2 and 4 general mistake. His name is not specified in options of a hub (general bot).

3 mistake: there is no blank
RegConnected = UserConnectedRegDisconnected = UserDisconnected
RegConnected = UserConnected
RegDisconnected = UserDisconnected


done, but another error after fix -

[15:31] sintaksis [string "-- This script is converted with PtokaX LUA..."]:19: attempt to index global 'SetMan' (a nil value)

and i don't understand what to do with 1 2 & 4(((
Title: Re: Please help
Post by: F_O_X on 06 March, 2008, 16:11:00
Quote from: ZadOff on 06 March, 2008, 13:34:16
done, but another error after fix -

[15:31] sintaksis [string "-- This script is converted with PtokaX LUA..."]:19: attempt to index global 'SetMan' (a nil value)
Error on line 19 in 4 script, it is again filled graph Nick
Title: Re: Please help
Post by: ZadOff on 07 March, 2008, 07:58:00
SORRY - BUT
i filled graph Nick but no change - an error is present
i try to delete this line in scripts - and errors is gone -  but scripts is not working
((( HELP