I used plop's 425 converter but i keep getting this error in the converted lua file:
Syntax ...16.04rls\scripts\clonecmd.lua_5.0.lua:37: attempt to call method `EnableFullData' (a nil value)
can someone correct the script? here's the original lua 4:
--Clone Alert 1.1
--by Mutor The Ugly
--PM Clone login to Opchat
--Added a Delay on banning user (made by nErBoS requested by Xtreme)
--Added Commands and table to Imune nicks (made by nErBoS idea given by TheRevenge)
-- Commands:
-- !imune
-- !delimune
BotName = frmHub:GetHubBotName()
--OpChatName = frmHub:GetOpChatName() --Use this line for inbuilt Px opchat
OpChatName = "?bot?" --Use this line for a scripted opchat
supervip = {}
fSuperVip = "logs/svip.txt" -- Path of file that contains SuperVips
sec = 1
min = 60*sec
iDelay = 60*sec -- Time of delay before ban the user
iBan = 5 -- Time of Ban in Minutes
arrImune = {}
fImune = "logs/imune.dat"
arrDelay = {}
--## Configuration ##--
uLaterPtokax = 0 -- Choose 0 if you are using Ptokax Version 0.3.3.0 or higher
-- Choose 1 if you are using Ptokax Version lower then 0.3.3.0
--## END ##--
function Main()
frmHub:EnableFullData(1)
frmHub:RegBot(BotName)
StartTimer()
LoadFromFile(fImune)
end
function OnExit()
SaveToFile(fImune , arrImune , "arrImune")
end
function OnTimer()
local now,nick,time = clock()
for nick, time in arrDelay do
if (now >= time+iDelay) then
if (GetItemByName(nick) ~= nil) then
GetItemByName(nick):TimeBan(iBan)
--GetItemByName(nick):NickBan()
end
arrDelay[nick] = nil
end
end
end
function UserDisconnected(curUser)
arrDelay[curUser.sName] = nil
end
function DataArrival(curUser,sdata)
if (strsub(sdata,1,8) == "$GetINFO") then
LoadFromFile(fSuperVip)
local _,_, user1 = strfind(sdata,"$GetINFO%s+(%S+)%s+")
if arrImune[strlower(curUser.sName)] == nil and user1 ~= curUser.sName then
user1 = GetItemByName(user1)
if user1 ~= nil then
if not (curUser.bOperator or user1.bOperator) then
if user1.sIP == curUser.sIP then
if (user1.sMyInfoString ~= nil and curUser.sMyInfoString ~= nil) then
if (GetShare(user1.sMyInfoString) ~= GetShare(curUser.sMyInfoString)) then
local curtime = date()
--SendPmToOps(OpChatName, "*** Cloned user <"..curUser.sName.."> ("..curUser.sIP..") logged in. User is a clone of <"..user1.sName..">, but with different share. Probably on a LAN.")
--SendToVips("*** Cloned user <"..curUser.sName.."> ("..curUser.sIP..") logged in. User is a clone of <"..user1.sName..">, but with different share. Probably on a LAN.")
--arrDelay[curUser.sName] = clock()
else
SendPmToOps(OpChatName, "*** Cloned user <"..curUser.sName.."> ("..curUser.sIP..") logged in and timebanned in 60 seconds for 5 minutes. User is a clone of <"..user1.sName..">")
SendToVips("*** Cloned user <"..curUser.sName.."> ("..curUser.sIP..") logged in and timebanned in 60 seconds for 5 minutes. User is a clone of <"..user1.sName..">")
SendPmToNick(curUser.sName,BotName, "Double Login is not allowed. You are already connected to this hub with this nick: "..user1.sName)
SendPmToNick(curUser.sName,BotName, "You're being timebanned in 60 seconds.")
SendPmToNick(curUser.sName,BotName, "Your IP: "..user1.sIP)
arrDelay[curUser.sName] = clock()
end
end
end
end
end
end
end
if (strsub(sdata,1,1) == "<" or strsub(sdata,1,5+strlen(BotName)) == "$To: "..BotName) then
sdata = strsub(sdata,1,strlen(sdata)-1)
s,e,cmd = strfind(sdata, "%b<>%s+(%S+)")
if (cmd == "!imune" and curUser.bOperator) then
local s,e,nick = strfind(sdata, "%b<>%s+%S+%s+(%S+)")
if (nick == nil) then
curUser:SendData(BotName, "Syntax Error, +imune , you must write a nick.")
elseif (arrImune[strlower(nick)] ~= nil) then
curUser:SendPM(BotName, "The user: "..nick.." is already imune.")
else
curUser:SendPM(BotName, "The user: "..nick.." is now imune.")
arrImune[strlower(nick)] = 1
if (uLaterPtokax == 1) then
OnExit()
end
end
return 1
elseif (cmd == "!delimune" and curUser.bOperator) then
local s,e,nick = strfind(sdata, "%b<>%s+%S+%s+(%S+)")
if (nick == nil) then
curUser:SendData(BotName, "Syntax Error, +delimune , you must write a nick.")
elseif (arrImune[strlower(nick)] == nil) then
curUser:SendPM(BotName, "The user: "..nick.." is not imune.")
else
curUser:SendPM(BotName, "The user: "..nick.." is now not imune.")
arrImune[strlower(nick)] = nil
if (uLaterPtokax == 1) then
OnExit()
end
end
return 1
elseif (cmd == "!showimune" and curUser.bOperator) then
Doimuned(curUser)
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
function imuned()
local disp = ""
for index, value in arrImune do
local line = index
disp = disp.."\t ? "..line.."\r\n"
end
return disp
end
function Doimuned(curUser)
curUser:SendPM(BotName,"\r\n\r\n\t\t\t\t\t(? ?.??.-> These are the imuned <-.??.???)\r\n\r\n"..imuned().."|")
end
function GetShare(sMyInfo)
local s,e,share = strfind(sMyInfo, "%$(%d+)%$")
return tonumber(share)
end
function SendToVips(msg)
local usr,aux
for usr, aux in supervip do
if (GetItemByName(usr) ~= nil) then
GetItemByName(usr):SendPM(BotName, msg)
end
end
end
Thanks in advance.
I keep gettin the same error when usin that converter on all the scripts I use too :(
QuoteOriginally posted by jiten
attempt to call method `EnableFullData' (a nil value)
EnableFullData is removed in new PtokaX, is not more needed ;)
Ain't it a built-in clone alert in px?
hi there. well, i tried to convert the clone alert script do LUA 5 and this is the best i could do (now I don't get any syntax error but, the script doesn't seem to work):
--Clone Alert 1.1
--by Mutor The Ugly
--PM Clone login to Opchat
--Added a Delay on banning user (made by nErBoS requested by Xtreme)
--Added Commands and table to Imune nicks (made by nErBoS idea given by TheRevenge)
-- Commands:
-- !imune
-- !delimune
BotName = frmHub:GetHubBotName()
--OpChatName = frmHub:GetOpChatName() --Use this line for inbuilt Px opchat
OpChatName = "?bot?" --Use this line for a scripted opchat
supervip = {}
fSuperVip = "logs/svip.txt" -- Path of file that contains SuperVips
sec = 1
min = 60*sec
iDelay = 60*sec -- Time of delay before ban the user
iBan = 5 -- Time of Ban in Minutes
arrImune = {}
fImune = "logs/imune.dat"
arrDelay = {}
--## Configuration ##--
uLaterPtokax = 0 -- Choose 0 if you are using Ptokax Version 0.3.3.0 or higher
-- Choose 1 if you are using Ptokax Version lower then 0.3.3.0
--## END ##--
function Main()
frmHub:RegBot(BotName)
StartTimer()
LoadFromFile(fImune)
end
function OnExit()
SaveToFile(fImune , arrImune , "arrImune")
end
function OnTimer()
local now,nick,time = os.clock()
for nick, time in arrDelay do
if (now >= time+iDelay) then
if (GetItemByName(nick) ~= nil) then
GetItemByName(nick):TimeBan(iBan)
--GetItemByName(nick):NickBan()
end
arrDelay[nick] = nil
end
end
end
function UserDisconnected(curUser)
arrDelay[curUser.sName] = nil
end
function ChatArrival(curUser,sdata)
if (string.sub(sdata,1,8) == "$GetINFO") then
LoadFromFile(fSuperVip)
local _,_, user1 = string.find(sdata,"$GetINFO%s+(%S+)%s+")
if arrImune[string.lower(curUser.sName)] == nil and user1 ~= curUser.sName then
user1 = GetItemByName(user1)
if user1 ~= nil then
if not (curUser.bOperator or user1.bOperator) then
if user1.sIP == curUser.sIP then
if (user1.sMyInfoString ~= nil and curUser.sMyInfoString ~= nil) then
if (GetShare(user1.sMyInfoString) ~= GetShare(curUser.sMyInfoString)) then
local curtime = os.date()
--SendPmToOps(OpChatName, "*** Cloned user <"..curUser.sName.."> ("..curUser.sIP..") logged in. User is a clone of <"..user1.sName..">, but with different share. Probably on a LAN.")
--SendToVips("*** Cloned user <"..curUser.sName.."> ("..curUser.sIP..") logged in. User is a clone of <"..user1.sName..">, but with different share. Probably on a LAN.")
--arrDelay[curUser.sName] = os.clock()
else
SendPmToOps(OpChatName, "*** Cloned user <"..curUser.sName.."> ("..curUser.sIP..") logged in and timebanned in 60 seconds for 5 minutes. User is a clone of <"..user1.sName..">")
SendToVips("*** Cloned user <"..curUser.sName.."> ("..curUser.sIP..") logged in and timebanned in 60 seconds for 5 minutes. User is a clone of <"..user1.sName..">")
SendPmToNick(curUser.sName,BotName, "Double Login is not allowed. You are already connected to this hub with this nick: "..user1.sName)
SendPmToNick(curUser.sName,BotName, "You're being timebanned in 60 seconds.")
SendPmToNick(curUser.sName,BotName, "Your IP: "..user1.sIP)
arrDelay[curUser.sName] = os.clock()
end
end
end
end
end
end
end
if (string.sub(sdata,1,1) == "<" or string.sub(sdata,1,5+string.len(BotName)) == "$To: "..BotName) then
sdata = string.sub(sdata,1,string.len(sdata)-1)
s,e,cmd = string.find(sdata, "%b<>%s+(%S+)")
if (cmd == "!imune" and curUser.bOperator) then
local s,e,nick = string.find(sdata, "%b<>%s+%S+%s+(%S+)")
if (nick == nil) then
curUser:SendData(BotName, "Syntax Error, +imune , you must write a nick.")
elseif (arrImune[string.lower(nick)] ~= nil) then
curUser:SendPM(BotName, "The user: "..nick.." is already imune.")
else
curUser:SendPM(BotName, "The user: "..nick.." is now imune.")
arrImune[string.lower(nick)] = 1
if (uLaterPtokax == 1) then
OnExit()
end
end
return 1
elseif (cmd == "!delimune" and curUser.bOperator) then
local s,e,nick = string.find(sdata, "%b<>%s+%S+%s+(%S+)")
if (nick == nil) then
curUser:SendData(BotName, "Syntax Error, +delimune , you must write a nick.")
elseif (arrImune[string.lower(nick)] == nil) then
curUser:SendPM(BotName, "The user: "..nick.." is not imune.")
else
curUser:SendPM(BotName, "The user: "..nick.." is now not imune.")
arrImune[string.lower(nick)] = nil
if (uLaterPtokax == 1) then
OnExit()
end
end
return 1
elseif (cmd == "!showimune" and curUser.bOperator) then
Doimuned(curUser)
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 string.format("[%q]",key) or string.format("[%d]",key);
if(type(value) == "table") then
sTmp = sTmp..Serialize(value, sKey, sTab.."\t");
else
local sValue = (type(value) == "string") and string.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)
local handle = io.open(file,"w+")
handle:write(Serialize(table, tablename))
handle:flush()
handle:close()
end
function LoadFromFile(file)
local handle = io.open(file,"r")
if (handle ~= nil) then
loadstring(handle:read("*all"))
handle:flush()
handle:close()
end
end
function imuned()
local disp = ""
for index, value in arrImune do
local line = index
disp = disp.."\t ? "..line.."\r\n"
end
return disp
end
function Doimuned(curUser)
curUser:SendPM(BotName,"\r\n\r\n\t\t\t\t\t(? ?.??.-> These are the imuned <-.??.???)\r\n\r\n"..imuned().."|")
end
function GetShare(sMyInfo)
local s,e,share = string.find(sMyInfo, "%$(%d+)%$")
return tonumber(share)
end
function SendToVips(msg)
local usr,aux
for usr, aux in supervip do
if (GetItemByName(usr) ~= nil) then
GetItemByName(usr):SendPM(BotName, msg)
end
end
end
convert
function ChatArrival(curUser,sdata)
if (string.sub(sdata,1,8) == "$GetINFO") then
to
function GetINFOArrival(curUser,sdata)
Well, i've done the replacement just like you said, but I still don't get any response from the bot. I can't figure out what's wrong.
I guess that the problem is here or in the immunity part:
function GetINFOArrival(curUser,sdata)
LoadFromFile(fSuperVip)
local _,_, user1 = string.find(sdata,"$GetINFO%s+(%S+)%s+")
if arrImune[string.lower(curUser.sName)] == nil and user1 ~= curUser.sName then
user1 = GetItemByName(user1)
if user1 ~= nil then
if not (curUser.bOperator or user1.bOperator) then
if user1.sIP == curUser.sIP then
if (user1.sMyInfoString ~= nil and curUser.sMyInfoString ~= nil) then
if (GetShare(user1.sMyInfoString) ~= GetShare(curUser.sMyInfoString)) then
local curtime = os.date()
--SendPmToOps(OpChatName, "*** Cloned user <"..curUser.sName.."> ("..curUser.sIP..") logged in. User is a clone of <"..user1.sName..">, but with different share. Probably on a LAN.")
--SendToVips("*** Cloned user <"..curUser.sName.."> ("..curUser.sIP..") logged in. User is a clone of <"..user1.sName..">, but with different share. Probably on a LAN.")
--arrDelay[curUser.sName] = os.clock()
else
SendPmToOps(OpChatName, "*** Cloned user <"..curUser.sName.."> ("..curUser.sIP..") logged in and timebanned in 60 seconds for 5 minutes. User is a clone of <"..user1.sName..">")
SendToVips("*** Cloned user <"..curUser.sName.."> ("..curUser.sIP..") logged in and timebanned in 60 seconds for 5 minutes. User is a clone of <"..user1.sName..">")
SendPmToNick(curUser.sName,BotName, "Double Login is not allowed. You are already connected to this hub with this nick: "..user1.sName)
SendPmToNick(curUser.sName,BotName, "You're being timebanned in 60 seconds.")
SendPmToNick(curUser.sName,BotName, "Your IP: "..user1.sIP)
arrDelay[curUser.sName] = os.clock()
end
end
end
end
end
end
The problem is that $GetINFO is deprecated and ignored by the hubsoft. We have to find another method - e. g. storing all online IPs in a table and compare newly connecting user's IP with it.
hmm still, nothing?, ooh well, we'll wait !!!
I'm waitin 4 this too ?(
damn this seems so hard that, even the other good scripters, ignore it, well mayb we should go back to lua4, much simpler !! :P
As I use this code in LawMaker I will upgrade & release 1.0update ASAP.
hmm and how long is ASAP, a week a month a year??, :D, juss kiddin take ur time !!
QuoteOriginally posted by Dessamator
hmm and how long is ASAP, a week a month a year??, :D, juss kiddin take ur time !!
u twit :D
Quote--------------------------------------------------------------------------------
Originally posted by Dessamator
hmm and how long is ASAP, a week a month a year??, , juss kiddin take ur time !!
--------------------------------------------------------------------------------
u twit
lol jiten, it was just a simple question,:D
i know :D
i'm also eager 4 this one...