Clonebot 1.1 - Page 2
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

Clonebot 1.1

Started by bastya_elvtars, 03 April, 2005, 19:53:10

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jiten

Nice to know.
Let us know how did it go, as I haven't tested Herodes' version.

Cheers

ConejoDelMal

#26
well...working good, memory usage droped to almost 400kb
------------------------------------------------------------
Current stats:
------------------------------------------------------------
Version: PtokaX DC Hub 0.3.3.0 build 16.09 [debug] built on Mar 28 2005 22:54:36
Uptime: 0 days, 0 hours, 5 minutes
Users (Max/Actual Peak (Max Peak)/Logged) : 400 / 126 (167) / 126
Chat messages: 52 x
Unknown commands: 0 x
PM commands: 3 x
Key commands: 1104 x
Supports commands: 673 x
MyINFO commands: 1238 x
ValidateNick commands: 1082 x
GetINFO commands: 325 x
Password commands: 64 x
Version commands: 968 x
UserIP commands: 0 x
GetNickList commands: 971 x
Search commands: 345 x
SR commands: 703 x
CTM commands: 1808 x
RevCTM commands: 881 x
BotINFO commands: 0 x
------------------------------------------------------------
CPU usage (All processes 60 seconds average): 63.8%
CPU time: 0:01:37
Mem usage (Old style): 3794 kB
Mem usage (Peak): 12.99 MB (18.41 MB)
VM size (Peak): 12.48 MB (14.29 MB)
------------------------------------------------------------
SendRests (Peak): 0 (0)
RecvRests (Peak): 0 (1)
SendBytes: 2.23 MB
RecvBytes: 86.37 kB

But i cant imunize nobody...cmd's arent working...or i'm already too tired...

*edited*
Cmd's really dont work, did some more testing, and tried bastya's way... no way i can imunize a user...
And even if the share isnt the same, it bans the "clone"..
Rede-DC Comunidade Portuguesa de DC

Dessamator

QuoteOriginally posted by [AT]conejodelmal
well...working good, memory usage droped to almost 400kb
------------------------------------------------------------
Current stats:
------------------------------------------------------------
Version: PtokaX DC Hub 0.3.3.0 build 16.09 [debug] built on Mar 28 2005 22:54:36
Uptime: 0 days, 0 hours, 5 minutes
Users (Max/Actual Peak (Max Peak)/Logged) : 400 / 126 (167) / 126
Chat messages: 52 x
Unknown commands: 0 x
PM commands: 3 x
Key commands: 1104 x
Supports commands: 673 x
MyINFO commands: 1238 x
ValidateNick commands: 1082 x
GetINFO commands: 325 x
Password commands: 64 x
Version commands: 968 x
UserIP commands: 0 x
GetNickList commands: 971 x
Search commands: 345 x
SR commands: 703 x
CTM commands: 1808 x
RevCTM commands: 881 x
BotINFO commands: 0 x
------------------------------------------------------------
CPU usage (All processes 60 seconds average): 63.8%
CPU time: 0:01:37
Mem usage (Old style): 3794 kB
Mem usage (Peak): 12.99 MB (18.41 MB)
VM size (Peak): 12.48 MB (14.29 MB)
------------------------------------------------------------
SendRests (Peak): 0 (0)
RecvRests (Peak): 0 (1)
SendBytes: 2.23 MB
RecvBytes: 86.37 kB

But i cant imunize nobody...cmd's arent working...or i'm already too tired...

*edited*
Cmd's really dont work, did some more testing, and tried bastya's way... no way i can imunize a user...
And even if the share isnt the same, it bans the "clone"..

yap ur tired c the commands here ::
QuoteHere are the commands for the CloneBot:
   +clone     allows to have a clone
   -clone     removes from the clone list
   ?clone       shows the users allowed to have a clone
   ?clonehelp     allows to have a clone

u can change them if u know how to, but i think its not necessary !!!
Ignorance is Bliss.

ConejoDelMal

well, thx for the reply, dont know what happened yesterday, but it really didnt work.. today it's working (or i'm working :P)
anyway, still got some problems, when i try to imunize a clone, i get an error:
 Syntax ...abalho\LusoLeader Hub 16.09 dbg\scripts\NoClones.lua:29: bad argument #1 to `sub' (string expected, got nil)

And when i restart the hub, or the scripts, the table doesnt save, so i have to imunize all users again
Rede-DC Comunidade Portuguesa de DC

Dessamator

yap ur right, [AT]conejodelmal ,
theres something wrong with the file handling
::::::::

  
function OnExit()
	collectgarbage()
	local f = io.open("logs/cloneimmune.txt", "w+")
	local m = "tImmune = { "
	for nick , _ in tImmune do m = m..string.format("%q, ", string.sub( a, "\"", "\"" )); end
	m = m.." }"
	f:write( m ); f:close();
end


to be exact here ::
for nick , _ in tImmune do m = m..string.format("%q, ", string.sub( a, "\"", "\"" )); end


ps. the tables arent being saved,
Ignorance is Bliss.

Herodes

QuoteOriginally posted by [AT]conejodelmal
well, thx for the reply, dont know what happened yesterday, but it really didnt work.. today it's working (or i'm working :P)
anyway, still got some problems, when i try to imunize a clone, i get an error:
 Syntax ...abalho\LusoLeader Hub 16.09 dbg\scripts\NoClones.lua:29: bad argument #1 to `sub' (string expected, got nil)

And when i restart the hub, or the scripts, the table doesnt save, so i have to imunize all users again
my script is now updated .. fixing that immune saving error ...and adding the way bastya_elvtars is doing his loading ;)

jiten

Well, now there's another problem:
Syntax ...en\16.09.tst\scripts\clonealert.lua:25: bad argument #2 to `sub' (number expected, got string)
Cheers

Herodes

QuoteOriginally posted by jiten
Well, now there's another problem:
Syntax ...en\16.09.tst\scripts\clonealert.lua:25: bad argument #2 to `sub' (number expected, got string)
Cheers
yep sorted that one too.. my post has been edited once more ...

ConejoDelMal

#33
Getting error when I imunize:
Syntax ...abalho\LusoLeader Hub 16.09 dbg\scripts\NoClones.lua:90: attempt to index global `victim' (a nil value)

Getting error when I remove from Imune List:
Syntax ...abalho\LusoLeader Hub 16.09 dbg\scripts\NoClones.lua:104: attempt to index global `victim' (a nil value)

Not saving the tables...
And even if the share isnt the same, it bans the clone
Rede-DC Comunidade Portuguesa de DC

Herodes

QuoteOriginally posted by [AT]conejodelmal
Getting error when I imunize:
Syntax ...abalho\LusoLeader Hub 16.09 dbg\scripts\NoClones.lua:90: attempt to index global `victim' (a nil value)

Getting error when I remove from Imune List:
Syntax ...abalho\LusoLeader Hub 16.09 dbg\scripts\NoClones.lua:104: attempt to index global `victim' (a nil value)

Not saving the tables...
And even if the share isnt the same, it bans the clone
tx for the bug-rain,... post edited yet once more ..

ConejoDelMal

well...found a couple more things which dont work/fit :P

when share isnt the same, it allows user to get in, but it sends the wrong message to Op's:
Private message from OpChat: *** Cloned user <[AT]conejodelmal> (10.6.0.16) logged in and timebanned for 5 minutes. User is a clone of <-=Anti-Fakers=->

when i add a clone (no errors now), and i restart the scripts, it saves only numbers:
   Before restart of scripts
   The following users can have clones in this hub:
     ? (Offline)  1
     ? (Offline)  2
     ? (Offline)  3
     ? (Online)  [AT]conejodelmal

   After restart of scripts:
   The following users can have clones in this hub:
     ? (Offline)  1
     ? (Offline)  2
     ? (Offline)  3
     ? (Offline)  4
Rede-DC Comunidade Portuguesa de DC

Herodes

thats the virtues of on-the-fly degugging... :(

re-re-re-edited post ...

ConejoDelMal

#37
well...message is correct now, but still saves numbers after restarting...
sorry to be such a pain :P

*edited*
And the clone with different share gets the message:
[16:39:30] Private message from ?bot?: Double Login is not allowed. You are already connected to this hub with this nick: [AT]conejodelmal
Rede-DC Comunidade Portuguesa de DC

Dessamator

QuoteOriginally posted by [AT]conejodelmal
well...message is correct now, but still saves numbers after restarting...
sorry to be such a pain :P

*edited*
And the clone with different share gets the message:
[16:39:30] Private message from •bot•: <•bot•> Double Login is not allowed. You are already connected to this hub with this nick: [AT]conejodelmal

well, just replace the previous onexit function with this ::
   
function OnExit()
collectgarbage()
local f = io.open("logs/cloneimmune.txt", "w+")
local m = "tImmune = { "
for a, b in tImmune do m = m..(string.format("[%q]=",a)..b..","); end
m = m.." }"
f:write( m ); f:close();
end
Ignorance is Bliss.

ConejoDelMal

great work u guys, script is almost perfect, just 2 or 3 details:

 Private message from ?bot?: Double Login is not allowed. You are already connected to this hub with this nick: [AT]conejodelmal

this message shouldnt be sent to both users if share size isnt the same, just the notification to the Op's

and:
if not name then user:SendData(Bot, "*** Error: Type !delclone nick") end

should be changed to:
if not name then user:SendData(Bot, "*** Error: Type -clone nick") end

the same with other cmd's syntax error messages
Rede-DC Comunidade Portuguesa de DC

Dessamator

#40
QuoteOriginally posted by [AT]conejodelmal
great work u guys, script is almost perfect, just 2 or 3 details:

 Private message from •bot•: <•bot•> Double Login is not allowed. You are already connected to this hub with this nick: [AT]conejodelmal

this message shouldnt be sent to both users if share size isnt the same, just the notification to the Op's


replace the previous newuserconnected with this :::

function NewUserConnected(curUser,sdata) 
	for _,Nick in frmHub:GetOnlineUsers() do
		if not(tImmune[curUser.sName]== 1 or tImmune[Nick.sName]== 1) and not (curUser.bOperator or Nick.bOperator) and curUser.sIP==Nick.sIP then
			if curUser.iShareSize==Nick.iShareSize then
				curUser:SendPM(Bot,"Double Login is not allowed. You are already connected to this hub with this nick: "..Nick.sName)
				curUser:SendPM(Bot,"You're being timebanned. Your IP: "..curUser.sIP)
				curUser:TimeBan(5)
				Nick:SendPM(Bot,"Double Login is not allowed. You are already connected to this hub with this nick: "..curUser.sName)
				if PmOps == "1" then
					SendPmToOps(OpChatName, "*** Cloned user <"..curUser.sName.."> ("..curUser.sIP..") logged in and timebanned for 5 minutes. User is a clone of <"..Nick.sName..">")
				else
				SendPmToOps(OpChatName, "*** User "..curUser.sName.." logged in, with same IP as "..Nick.sName.." but with different share, please check.")
				end
			end
		end
	end
end




it should work, hopefully !!!

and:
if not name then user:SendData(Bot, "*** Error: Type !delclone nick") end

should be changed to:
if not name then user:SendData(Bot, "*** Error: Type -clone nick") end

the same with other cmd's syntax error messages          


well, thats just a simple thing to correct, even u can do that, and that depends on the script u could change the commands triggers , so its not that big of a prob !!
Ignorance is Bliss.

ConejoDelMal

#41
Not sending message to users anymore, but not sending Op notification either  :P

and about the cmd's syntax messages, i was only warning so that others dont get problems...i already corrected it for myself :)
Rede-DC Comunidade Portuguesa de DC

Dessamator

QuoteOriginally posted by [AT]conejodelmal
Not sending message to users anymore, but not sending Op notification either  :P

and about the cmd's syntax messages, i was only warning so that others dont get problems...i already corrected it for myself :)

u obviously did something wrong, anyways, heres the full script :::

 
-- Clone Alert 1.5
-- 1.0b by Mutor The Ugly
-- PM Clone login to Opchat
-- Applied to latest PtokaX by bastya_elvtars
-- Also added share checking, if different, only notifies ops.
--thx NightLitch
-- Added: Clone check immunity (add, remove and list immune users) by jiten
--- -- touched by Herodes
-- heavily optimised
-- moved to 1.5

OpChatName = "OpChat"  -- Rename to opchatbot
Bot = "•bot•" -- Rename to you main Px bot
PmOps = true -- true:enables / false:disables , operator notifincation (STRONGLY recommended to leave enabled!)

function Main()
tImmune = {}
	if loadfile("logs/cloneimmune.txt") then dofile("logs/cloneimmune.txt"); end
end

function OnExit()
collectgarbage()
local f = io.open("logs/cloneimmune.txt", "w+")
local m = "tImmune = { "
for a, b in tImmune do m = m..(string.format("[%q]=",a)..b..","); end
m = m.." }"
f:write( m ); f:close();
end

function NewUserConnected(curUser,sdata) 
	for _,Nick in frmHub:GetOnlineUsers() do
		if not(tImmune[curUser.sName]== 1 or tImmune[Nick.sName]== 1) and not (curUser.bOperator or Nick.bOperator) and curUser.sIP==Nick.sIP then
			if curUser.iShareSize==Nick.iShareSize then
				curUser:SendPM(Bot,"Double Login is not allowed. You are already connected to this hub with this nick: "..Nick.sName)
				curUser:SendPM(Bot,"You're being timebanned. Your IP: "..curUser.sIP)
				curUser:TimeBan(5)
				Nick:SendPM(Bot,"Double Login is not allowed. You are already connected to this hub with this nick: "..curUser.sName)
				if PmOps == "1" then
					SendPmToOps(OpChatName, "*** Cloned user <"..curUser.sName.."> ("..curUser.sIP..") logged in and timebanned for 5 minutes. User is a clone of <"..Nick.sName..">")
				else
				SendPmToOps(OpChatName, "*** User "..curUser.sName.." logged in, with same IP as "..Nick.sName.." but with different share, please check.")
				end
			end
		end
	end
end 

function ChatArrival (user,data)
	if (user.bOperator) then
		local data = string.sub( data, 1, -2 )
		local s,e,cmd = string.find( data, "%b<>%s+([%-%+%?]%S+)" )
		if cmd then
			return Parse( user, cmd, data, false )
		end
	end
end



function ToArrival ( user, data )
	if ( user.bOperator ) then
		local data = string.sub( data , 1, -2 )
	local s,e, cmd = string.find( data , "%$%b<>%s+([%-%+%?]%S+)" )
if cmd then
return Parse ( user, cmd , data , true )
end
end
end

function Parse( user, cmd, data, how )

local function SendBack( user, msg , from, how )
if how then user:SendPM( from or Bot , msg );return 1; end;
user:SendData( from or Bot, msg );return 1;
end

local t = {
--- Add to cloneList
["+clone"] = function ( user , data , how )
local s,e, name = string.find( data, "%b<>%s+%S+%s+(%S+)" )

if not name then user:SendData(Bot, "*** Error: Type !addclone nick") end
if tImmune[name] then user:SendData("nope") end

local nick = GetItemByName(name)
if not nick then user:SendData(Bot, "*** Error: User is not online.") end

tImmune[name] = 1
OnExit()
user:SendData(Bot, name.." is now immune to clone checks!")
return 1

end ,

--- Remove from cloneList
["-clone"] = function ( user , data , how )
local s,e, name = string.find(data, "%b<>%s+%S+%s+(%S+)")

if not name then user:SendData(Bot, "*** Error: Type !delclone nick") end
if not tImmune[name] then user:SendData(Bot,"The user "..victim.sName.." is not immune!")  end

local nick = GetItemByName( name )
if not nick then user:SendData(Bot, "*** Error: That user is not online.") end

tImmune[name] = nil
OnExit()
user:SendData(Bot,"Now "..name.." is not no longer immune to clone checks!")
return 1

end,

--- Show cloneList
["?clone"] = function ( user , data, how )

local m = ""
collectgarbage()
for nick, _ in tImmune do
local s = "Offline"
	if GetItemByName(nick) then s = "Online" end
		m = m.."\r\n\t  • ("..s..")  "..nick
	end
		if m == "" then return SendBack( user, "There are no users that can have a clone", Bot, how ) end
			m = "\r\nThe following users can have clones in this hub:"..m
		return SendBack( user, m , Bot, how )
end,
--- Show cloneBot help

["?clonehelp"] = function ( user, data , how )

local m = "\r\n\r\nHere are the commands for the CloneBot:"
m = m.."\r\n\t+clone  \t allows  to have a clone"
m = m.."\r\n\t-clone  \t removes  from the clone list"
m = m.."\r\n\t?clone\t\t shows the users allowed to have a clone"
m = m.."\r\n\t?clonehelp \t allows  to have a clone"
return SendBack( user, m, Bot, how )

end, }

if t[cmd] then return t[cmd]( user, data, how ) end
end


ps  the warning to the user ::

 
 [17:34] Private message from •bot•: <•bot•> Double Login is not allowed. You are already connected to this hub with this nick: vipgg
[17:34] Private message from •bot•: <•bot•> You're being timebanned. Your IP: 127.0.0.1
Ignorance is Bliss.

jiten

QuoteOriginally posted by [AT]conejodelmal
And the clone with different share gets the message:
[16:39:30] Private message from ?bot?: Double Login is not allowed. You are already connected to this hub with this nick: [AT]conejodelmal
This happened because "Bot" wasn't registered.
U had to put an extra line in Function Main() with this and that would be solved:
frmHub:RegBot(Bot)
Cheers

Dessamator

QuoteOriginally posted by jiten
QuoteOriginally posted by [AT]conejodelmal
And the clone with different share gets the message:
[16:39:30] Private message from •bot•: <•bot•> Double Login is not allowed. You are already connected to this hub with this nick: [AT]conejodelmal
This happened because "Bot" wasn't registered.
U had to put an extra line in Function Main() with this and that would be solved:
frmHub:RegBot(Bot)
Cheers

lol, i thought that was obvious, silly me,  :D
Ignorance is Bliss.

ConejoDelMal

I feel so misunderstood .... :P

I'll explain...
When a user gets in with different share and same Ip, does no longer gets a pm saying it is not allowed (solved by Dessamator) but i want the Op's to get it, and they arent

When a user gets in with same Ip and Share size, the users gets timebanned, but the Op's dont get any notification about it.

So, in the end, everything is working good, just not the Pm2Ops in both cases
Rede-DC Comunidade Portuguesa de DC

jiten

Try this:
function NewUserConnected(curUser,sdata) 
	for _,Nick in frmHub:GetOnlineUsers() do
		if not(tImmune[curUser.sName]== 1 or tImmune[Nick.sName]== 1) and not (curUser.bOperator or Nick.bOperator) and curUser.sIP==Nick.sIP then
			if curUser.iShareSize==Nick.iShareSize then
				curUser:SendPM(Bot,"Double Login is not allowed. You are already connected to this hub with this nick: "..Nick.sName)
				curUser:SendPM(Bot,"You're being timebanned. Your IP: "..curUser.sIP)
				curUser:TimeBan(5)
				Nick:SendPM(Bot,"Double Login is not allowed. You are already connected to this hub with this nick: "..curUser.sName)
--				Nick:TimeBan(5) -- If u want both to be timebanned
				if PmOps == "1" then
					SendPmToOps(OpChatName, "*** Cloned user <"..curUser.sName.."> ("..curUser.sIP..") logged in and timebanned for 5 minutes. User is a clone of <"..Nick.sName..">")
				else
				end
			else
				SendPmToOps(OpChatName, "*** User "..curUser.sName.." logged in, with same IP as "..Nick.sName.." but with different share, please check.")
			end
		end
	end
end

and change this:
PmOps = true
to
PmOps = false
Cheers

ConejoDelMal

#47
now it is a perfect script! Tested and recommended!
the final corrected version of it:
-- Clone Alert 1.5
-- 1.0b by Mutor The Ugly
-- PM Clone login to Opchat
-- Applied to latest PtokaX by bastya_elvtars
-- Also added share checking, if different, only notifies ops.
--thx NightLitch
-- Added: Clone check immunity (add, remove and list immune users) by jiten
--- -- touched by Herodes
-- heavily optimised
-- moved to 1.5

OpChatName = "OpChat"  -- Rename to opchatbot
Bot = "botname" -- Rename to you main Px bot
PmOps = false -- true:enables / false:disables , operator notifincation (STRONGLY recommended to leave enabled!)

function Main()
tImmune = {}
	if loadfile("logs/cloneimmune.txt") then dofile("logs/cloneimmune.txt"); end
end

function OnExit()
collectgarbage()
local f = io.open("logs/cloneimmune.txt", "w+")
local m = "tImmune = { "
for a, b in tImmune do m = m..(string.format("[%q]=",a)..b..","); end
m = m.." }"
f:write( m ); f:close();
end

function NewUserConnected(curUser,sdata) 
	for _,Nick in frmHub:GetOnlineUsers() do
		if not(tImmune[curUser.sName]== 1 or tImmune[Nick.sName]== 1) and not (curUser.bOperator or Nick.bOperator) and curUser.sIP==Nick.sIP then
			if curUser.iShareSize==Nick.iShareSize then
				curUser:SendPM(Bot,"Double Login is not allowed. You are already connected to this hub with this nick: "..Nick.sName)
				curUser:SendPM(Bot,"You're being timebanned. Your IP: "..curUser.sIP)
				curUser:TimeBan(5)
				Nick:SendPM(Bot,"Double Login is not allowed. You are already connected to this hub with this nick: "..curUser.sName)
--				Nick:TimeBan(5) -- If u want both to be timebanned
				if PmOps == "1" then
					SendPmToOps(OpChatName, "*** Cloned user <"..curUser.sName.."> ("..curUser.sIP..") logged in and timebanned for 5 minutes. User is a clone of <"..Nick.sName..">")
				else
				end
			else
				SendPmToOps(OpChatName, "*** User "..curUser.sName.." logged in, with same IP as "..Nick.sName.." but with different share, please check.")
			end
		end
	end
end 


function ChatArrival (user,data)
	if (user.bOperator) then
		local data = string.sub( data, 1, -2 )
		local s,e,cmd = string.find( data, "%b<>%s+([%-%+%?]%S+)" )
		if cmd then
			return Parse( user, cmd, data, false )
		end
	end
end



function ToArrival ( user, data )
	if ( user.bOperator ) then
		local data = string.sub( data , 1, -2 )
	local s,e, cmd = string.find( data , "%$%b<>%s+([%-%+%?]%S+)" )
if cmd then
return Parse ( user, cmd , data , true )
end
end
end

function Parse( user, cmd, data, how )

local function SendBack( user, msg , from, how )
if how then user:SendPM( from or Bot , msg );return 1; end;
user:SendData( from or Bot, msg );return 1;
end

local t = {
--- Add to cloneList
["+clone"] = function ( user , data , how )
local s,e, name = string.find( data, "%b<>%s+%S+%s+(%S+)" )

if not name then user:SendData(Bot, "*** Error: Type +clone nick") end
if tImmune[name] then user:SendData("nope") end

local nick = GetItemByName(name)
if not nick then user:SendData(Bot, "*** Error: User is not online.") end

tImmune[name] = 1
OnExit()
user:SendData(Bot, name.." is now immune to clone checks!")
return 1

end ,

--- Remove from cloneList
["-clone"] = function ( user , data , how )
local s,e, name = string.find(data, "%b<>%s+%S+%s+(%S+)")

if not name then user:SendData(Bot, "*** Error: Type -clone nick") end
if not tImmune[name] then user:SendData(Bot,"The user "..victim.sName.." is not immune!")  end

local nick = GetItemByName( name )
if not nick then user:SendData(Bot, "*** Error: That user is not online.") end

tImmune[name] = nil
OnExit()
user:SendData(Bot,"Now "..name.." is not no longer immune to clone checks!")
return 1

end,

--- Show cloneList
["?clone"] = function ( user , data, how )

local m = ""
collectgarbage()
for nick, _ in tImmune do
local s = "Offline"
	if GetItemByName(nick) then s = "Online" end
		m = m.."\r\n\t  • ("..s..")  "..nick
	end
		if m == "" then return SendBack( user, "There are no users that can have a clone", Bot, how ) end
			m = "\r\nThe following users can have clones in this hub:"..m
		return SendBack( user, m , Bot, how )
end,
--- Show cloneBot help

["?clonehelp"] = function ( user, data , how )

local m = "\r\n\r\nHere are the commands for the CloneBot:"
m = m.."\r\n\t+clone  \t allows  to have a clone"
m = m.."\r\n\t-clone  \t removes  from the clone list"
m = m.."\r\n\t?clone\t\t shows the users allowed to have a clone"
m = m.."\r\n\t?clonehelp \t allows  to have a clone"
return SendBack( user, m, Bot, how )

end, }

if t[cmd] then return t[cmd]( user, data, how ) end
end

Thx a lot to all that helped!
Rede-DC Comunidade Portuguesa de DC

Dessamator

at last it(the anti clone) is  finished, a masterpiece(after dusting off the bugs)
:D
Ignorance is Bliss.

bastya_elvtars

QuoteOriginally posted by Dessamator
at last it(the anti clone) is  finished

Nope. :D

-- Clone Alert 1.6
-- 1.0b by Mutor The Ugly
-- PM Clone login to Opchat
-- Applied to latest PtokaX by bastya_elvtars
-- Also added share checking, if different, only notifies ops.
--thx NightLitch
-- Added: Clone check immunity (add, remove and list immune users) by jiten
--- -- touched by Herodes
-- heavily optimised
-- moved to 1.5
-- now it's 1.6, after bastya_elvtars did some more optimization to the detector. :P


OpChatName = "OpChat"  -- Rename to opchatbot
Bot = "botname" -- Rename to you main Px bot
kick=0 -- 0 to only disconnect, otherwise enter a number, and user will be kicked for that amount of minutes.
kick_other_too=0 -- 1 to disconnect/kick the already logged in user, 0 to not
PmOps = false -- true:enables / false:disables , operator notifincation (STRONGLY recommended to leave enabled!)


function Main()
tImmune = {}
	if loadfile("logs/cloneimmune.txt") then dofile("logs/cloneimmune.txt"); end
end


function OnExit()
collectgarbage()
local f = io.open("logs/cloneimmune.txt", "w+")
local m = "tImmune = { "
for a, b in tImmune do m = m..(string.format("[%q]=",a)..b..","); end
m = m.." }"
f:write( m ); f:flush(); f:close();
end


function NewUserConnected(curUser,sdata) 
	for _,Nick in frmHub:GetOnlineUsers() do
		if curUser.sIP==Nick.sIP then
			local det=function (User)
				curUser:SendPM(Bot,"Double Login is not allowed. You are already connected to this hub with this nick: "..Nick.sName)
				if kick~=0 then
					User:SendPM(Bot,"You're being timebanned. Your IP: "..User.sIP)
					User:TimeBan(kick)
					if PmOps == "1" then
						SendPmToOps(OpChatName, "*** Cloned user <"..curUser.sName.."> ("..curUser.sIP..") logged in and timebanned for "..kick.." minutes. User is a clone of <"..Nick.sName..">")
					end
				else
					User:SendPM(Bot,"You're being disconnected.")
					user:Disconnect()
					if PmOps == "1" then
						SendPmToOps(OpChatName, "*** Cloned user <"..curUser.sName.."> ("..curUser.sIP..") logged in and disconnected. User is a clone of <"..Nick.sName..">")
					end
				end
			end
			if not(tImmune[curUser.sName]== 1 or tImmune[Nick.sName]== 1) then -- and not (curUser.bOperator or Nick.bOperator)  <--- in NewUserConected it's always false
				if curUser.iShareSize==Nick.iShareSize then
					det(curUser)
					if kick_other_too==1 then
						det(Nick)
					end
				end
			end
		end
	end
end 




function ChatArrival (user,data)
	if (user.bOperator) then
		local data = string.sub( data, 1, -2 )
		local s,e,cmd = string.find( data, "%b<>%s+([%-%+%?]%S+)" )
		if cmd then
			return Parse( user, cmd, data, false )
		end
	end
end






function ToArrival ( user, data )
	if ( user.bOperator ) then
		local data = string.sub( data , 1, -2 )
	local s,e, cmd = string.find( data , "%$%b<>%s+([%-%+%?]%S+)" )
if cmd then
return Parse ( user, cmd , data , true )
end
end
end


function Parse( user, cmd, data, how )


local function SendBack( user, msg , from, how )
if how then user:SendPM( from or Bot , msg );return 1; end;
user:SendData( from or Bot, msg );return 1;
end


local t = {
--- Add to cloneList
["+clone"] = function ( user , data , how )
local s,e, name = string.find( data, "%b<>%s+%S+%s+(%S+)" )


if not name then user:SendData(Bot, "*** Error: Type +clone nick") end
if tImmune[name] then user:SendData("nope") end


local nick = GetItemByName(name)
if not nick then user:SendData(Bot, "*** Error: User is not online.") end


tImmune[name] = 1
OnExit()
user:SendData(Bot, name.." is now immune to clone checks!")
return 1


end ,


--- Remove from cloneList
["-clone"] = function ( user , data , how )
local s,e, name = string.find(data, "%b<>%s+%S+%s+(%S+)")


if not name then user:SendData(Bot, "*** Error: Type -clone nick") end
if not tImmune[name] then user:SendData(Bot,"The user "..victim.sName.." is not immune!")  end


local nick = GetItemByName( name )
if not nick then user:SendData(Bot, "*** Error: That user is not online.") end


tImmune[name] = nil
OnExit()
user:SendData(Bot,"Now "..name.." is not no longer immune to clone checks!")
return 1


end,


--- Show cloneList
["?clone"] = function ( user , data, how )


local m = ""
collectgarbage()
for nick, _ in tImmune do
local s = "Offline"
	if GetItemByName(nick) then s = "Online" end
		m = m.."\r\n\t  • ("..s..")  "..nick
	end
		if m == "" then return SendBack( user, "There are no users that can have a clone", Bot, how ) end
			m = "\r\nThe following users can have clones in this hub:"..m
		return SendBack( user, m , Bot, how )
end,
--- Show cloneBot help


["?clonehelp"] = function ( user, data , how )


local m = "\r\n\r\nHere are the commands for the CloneBot:"
m = m.."\r\n\t+clone  \t allows  to have a clone"
m = m.."\r\n\t-clone  \t removes  from the clone list"
m = m.."\r\n\t?clone\t\t shows the users allowed to have a clone"
m = m.."\r\n\t?clonehelp \t allows  to have a clone"
return SendBack( user, m, Bot, how )


end, }


if t[cmd] then return t[cmd]( user, data, how ) end
end
Everything could have been anything else and it would have just as much meaning.

SMF spam blocked by CleanTalk