First of all.. hi to every one..
This is my First Request :)
I already have a script running in the hub.. its by Mutor and nErBoS... a simple one and i have modded it a bit..
--Clone Alert 1.0
--by Mutor The Ugly
--PM Clone login to Opchat
BotName = "CloneBot"
OpChatName = "CloneBot"
function Main()
frmHub:EnableFullData(1)
frmHub:RegBot(BotName)
end
function DataArrival(curUser,sdata)
local _,_, user1 = strfind(sdata,"$GetINFO%s+(%S+)%s+")
if user1 ~= curUser.sName then
user1 = GetItemByName(user1)
if user1 ~= nil then
if user1.sIP == curUser.sIP then
SendPmToOps(OpChatName, "Cloned user = "..curUser.sName.." logged in and Disconnected, User is a clone of = "..user1.sName)
curUser:SendData(" Double Log-In not allowed here.. already a user connected in this Nick: "..user1.sName)
curUser:SendData(" Your IP: "..user1.sIP)
curUser:SendData(" Disconnecting you now!")
curUser:Disconnect()
end
end
end
end
So LUA Xperts... Here goes the request...
1) I want to have a excluded Nick's List.. that is the Uses on that Nick will be excluded (The list of Nicks can be maintained in a external file)
2) Disconnect the user after about 5 or 10 seconds.. so that he gets the message Properly..
3) Instead of Disconnecting.. Time Ban the duplicate Nick for 5 mins
:] :]
1) you need somekind of name or nick ban script
2) User will recieve message anyway
3) Well, its not what you asked for, but I think cloners next time will think twice before entering your hub:
BotName = "CloneBot"
OpChatName = "CloneBot"
function Main()
frmHub:EnableFullData(1)
frmHub:RegBot(BotName)
end
function DataArrival(curUser,sdata)
local _,_, user1 = strfind(sdata,"$GetINFO%s+(%S+)%s+")
if user1 ~= curUser.sName then
user1 = GetItemByName(user1)
if user1 ~= nil then
if user1.sIP == curUser.sIP then
SendPmToOps(OpChatName, "Cloned user = "..curUser.sName.." logged in and Disconnected, User is a clone of = "..user1.sName)
curUser:SendData(" Double Log-In not allowed here.. already a user connected in this Nick: "..user1.sName)
curUser:SendData(" Your IP: "..user1.sIP)
curUser:SendData(" Disconnecting you now!")
curUser:TempBan()
end
end
end
end
Im a newbie so you can still wait for big scripters to come by!!!
Hi,
1) If I have understood it right you want the script to ban a nick to be never used again, is that right ???
2) Like enema said the user will get the message in Main-Chat only for him.
3) If your TemBan in your ptokax is set to 5 minutes, then enema change is right.
Best regards, nErBoS
QuoteOriginally posted by nErBoS
Hi,
1) If I have understood it right you want the script to ban a nick to be never used again, is that right ???
2) Like enema said the user will get the message in Main-Chat only for him.
3) If your TemBan in your ptokax is set to 5 minutes, then enema change is right.
Best regards, nErBoS
no no no :(
1st There will be a list of users... when they log-in, they wont be checked for Double Log-in.. for example if 2 people share the same network they have the same ip.. so the script will allow only 1 person to connect.. so we have a list and check if those users connect allow them... hope u get the idea! ;)
2nd Well.. the user will get it! but i want to have a Delay before Disconnecing / Timebanning the user (** like a timer)
3rd curUser:TempBan()
I know this.. but PtokaX's Ban time is set to 20 mins.. but i want a seperate function!! not to change the comman ban time! (** use !timeban command from RC)
Hope u get the ideas!
nErBoS can do it i guess :D
Hi,
Try this...
BotName = "CloneBot"
OpChatName = "CloneBot"
sec = 1
min = 60*sec
iDelay = 5*sec -- Time of delay before ban the user
--## Put here the users imune to this script ##--
arrImune = {
["nErBoS"] = 1,
}
arrDelay = {}
function Main()
frmHub:EnableFullData(1)
frmHub:RegBot(BotName)
StartTimer()
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(5)
end
arrDelay[nick] = nil
end
end
end
function UserDisconnected(curUser)
arrDelay[curUser.sName] = nil
end
function DataArrival(curUser,sdata)
local _,_, user1 = strfind(sdata,"$GetINFO%s+(%S+)%s+")
if arrImune[curUser.sName] == nil and user1 ~= curUser.sName then
user1 = GetItemByName(user1)
if user1 ~= nil then
if user1.sIP == curUser.sIP then
SendPmToOps(OpChatName, "Cloned user = "..curUser.sName.." logged in and Disconnected, User is a clone of = "..user1.sName)
curUser:SendData(" Double Log-In not allowed here.. already a user connected in this Nick: "..user1.sName)
curUser:SendData(" Your IP: "..user1.sIP)
curUser:SendData(" You will be banned for 5 minutes.")
arrDelay[curUser.sName] = clock()
end
end
end
end
Best regards, nErBoS
I just realised, that first script posted, is a slight mod of the Clone Alert by Mutor ...
pls credits to were it should be ... :)
yep Herodes.. u are right.. i took the same script by Mutor and modded it a bit..
hehe sorry guys!! am quite new here...
(i have editted the post)
Hey nErBoS.. thanks for the reply!
nErBoS... some problems.. its not checking the uses on the Immune list and if i disable
if arrImune[curUser.sName] == nil and user1 ~= curUser.sName then
this If condition only its checking for the clones... do u have any idea?
Otherwise script is not working at all!!! :(
it Just allows the double Log-in!!
Can U put the Immune list on a external text file?
Waitin for ur reply... :) :)
hello
--## Put here the users imune to this script ##--
arrImune = {
["nErBoS"] = 1,
}
arrDelay = {}
better is this write in the txt and than with commands :D
!double or !deldouble
than i don't edit the lua for the doubleuser ;)
TheRevenge
Hi all i'm using the modified Mutor's scripts for double Login...
The problem it presents disconnecting users is
some ppl use a router with a NAT at home so they might be a small home LAN that has one IP address
BUT 20 ppl behind that ip...So when i get the message anout double login IP i check for the share size (it might be different) and then i deside what to do with that user
allowing/disallowing him to stay :)
--Clone Alert 1.0
--by Mutor The Ugly
--PM Clone login to Opchat
--
--
OpChatName = frmHub:GetOpChatName() --Use this line for inbuilt Px opchat
--OpChatName = "opschat" --Use this line for a scripted opchat
function Main()
frmHub:EnableFullData(1)
end
function DataArrival(curUser,sdata)
local _,_, user1 = strfind(sdata,"$GetINFO%s+(%S+)%s+")
if user1 ~= curUser.sName then
user1 = GetItemByName(user1)
if user1 ~= nil then
if user1.sIP == curUser.sIP then
SendPmToOps(OpChatName, "*** Cloned user = "..curUser.sName.." logged in, User is a clone of = "..user1.sName)
end
end
end
end
QuoteOriginally posted by BoJlk
...So when i get the message anout double login IP i check for the share size (it might be different) and then i deside what to do with that user
allowing/disallowing him to stay :)
Well, except for share, you can also check if the username is similar, like all these usernames are the same, except for a number or a letter at the end of the username.
Hi,
Made the commands, like TheRevenge as suggested, try out this one Xtreme...
--Clone Alert 1.0
--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 = "CloneBot"
OpChatName = "CloneBot"
sec = 1
min = 60*sec
iDelay = 5*sec -- Time of delay before ban the user
iBan = 5 -- Time of Ban in Minutes
arrImune = {}
fImune = "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)
end
arrDelay[nick] = nil
end
end
end
function UserDisconnected(curUser)
arrDelay[curUser.sName] = nil
end
function DataArrival(curUser,sdata)
if (strsub(data,1,8) == "$GetINFO") then
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 user1.sIP == curUser.sIP then
SendPmToOps(OpChatName, "Cloned user = "..curUser.sName.." logged in and Disconnected, User is a clone of = "..user1.sName)
curUser:SendData(" Double Log-In not allowed here.. already a user connected in this Nick: "..user1.sName)
curUser:SendData(" Your IP: "..user1.sIP)
curUser:SendData(" You will be banned for 5 minutes.")
arrDelay[curUser.sName] = clock()
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
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
Best regards, nErBoS
Hi,
About the other request...
--Clone Alert 1.0
--by Mutor The Ugly
--PM Clone login to Opchat
--Share Checker (made by nErBoS requested by BoJlk)
--
OpChatName = frmHub:GetOpChatName() --Use this line for inbuilt Px opchat
--OpChatName = "opschat" --Use this line for a scripted opchat
function Main()
frmHub:EnableFullData(1)
end
function DataArrival(curUser,sdata)
local _,_, user1 = strfind(sdata,"$GetINFO%s+(%S+)%s+")
if user1 ~= curUser.sName then
user1 = GetItemByName(user1)
if user1 ~= nil then
if user1.sIP == curUser.sIP then
if (user1.sMyInfoString ~= nil and curUser.sMyInfoString ~= nil and GetShare(user1.sMyInfoString) ~= GetShare(curUser.sMyInfoString)) then
SendPmToOps(OpChatName, "*** Cloned user = "..curUser.sName.." logged in, User is a clone of = "..user1.sName..", but they have different shares.")
else
SendPmToOps(OpChatName, "*** Cloned user = "..curUser.sName.." logged in, User is a clone of = "..user1.sName)
end
end
end
end
end
function GetShare(sMyinfo)
local s,e,share = strfind(sMyInfo, "%$(%d+)%$")
return tonumber(share)
end
Best regards, nErBoS
--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 = "Donnerg?ttin???"
OpChatName = frmHub:GetOpChatName() --Use this line for inbuilt Px opchat
--OpChatName = "OPChat" --Use this line for a scripted opchat
sec = 1
min = 60*sec
iDelay = 5*sec -- Time of delay before ban the user
iBan = 5 -- Time of Ban in Minutes
arrImune = {}
fImune = "Data/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)
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
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 user1.sIP == curUser.sIP then
SendPmToOps(OpChatName, "Geklonter User: "..curUser.sName.." ( IP: "..user1.sIP.." ) wollte sich eingeloggt und wurde Disconnected, User ist ein Klone von: "..user1.sName)
SendPmToNick(curUser.sName,BotName, "Double Log-In not allowed here.. already a user connected in this Hub with Nick: "..user1.sName)
SendPmToNick(curUser.sName,BotName, "Your IP: "..user1.sIP)
SendPmToNick(curUser.sName,BotName, "You are banned for 5 Minutes.")
arrDelay[curUser.sName] = clock()
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 , du mu?t einen Nick mit angeben!")
elseif (arrImune[strlower(nick)] ~= nil) then
curUser:SendPM(BotName, "Der User "..nick.." ist schon eingetragen!")
else
curUser:SendPM(BotName, "Der User "..nick.." ist nun eingetragen!")
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 , du mu?t einen Nick mit angeben!")
elseif (arrImune[strlower(nick)] == nil) then
curUser:SendPM(BotName, "Der User "..nick.." ist nicht eingetragen!")
else
curUser:SendPM(BotName, "Der User "..nick.." ist nun nicht mehr eingetragen!")
arrImune[strlower(nick)] = nil
if (uLaterPtokax == 1) then
OnExit()
end
end
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
------------------------------------------------------------------------
good script nErBoS
there a function data was error, then it is better
TheRevenge
Hi,
I didn't understand if you have corrected any error or you saying that the script has one. If has one could you put here what appears in your script editor of your ptokax.
Best regards, nErBoS
hi nErBoS..
thanks for ur script..
as i'm having my exams now, i dunt have much time to check it.. i will check and reply on this week end!!
thanks goes to TheRevenge too :)
..........
QuoteOriginally posted by nErBoS
Hi,
About the other request...--Clone Alert 1.0
--by Mutor The Ugly
--PM Clone login to Opchat
--Share Checker (made by nErBoS requested by BoJlk)
--
OpChatName = frmHub:GetOpChatName() --Use this line for inbuilt Px opchat
--OpChatName = "opschat" --Use this line for a scripted opchat
function Main()
frmHub:EnableFullData(1)
end
function DataArrival(curUser,sdata)
local _,_, user1 = strfind(sdata,"$GetINFO%s+(%S+)%s+")
if user1 ~= curUser.sName then
user1 = GetItemByName(user1)
if user1 ~= nil then
if user1.sIP == curUser.sIP then
if (user1.sMyInfoString ~= nil and curUser.sMyInfoString ~= nil and GetShare(user1.sMyInfoString) ~= GetShare(curUser.sMyInfoString)) then
SendPmToOps(OpChatName, "*** Cloned user = "..curUser.sName.." logged in, User is a clone of = "..user1.sName..", but they have different shares.")
else
SendPmToOps(OpChatName, "*** Cloned user = "..curUser.sName.." logged in, User is a clone of = "..user1.sName)
end
end
end
end
end
function GetShare(sMyinfo)
local s,e,share = strfind(sMyInfo, "%$(%d+)%$")
return tonumber(share)
end
Best regards, nErBoS
I get this error message =Syntax error: bad argument #1 to `strfind' (string expected, got nil)
stack traceback:
1: function `strfind' [C]
2: function `GetShare' at line 30 [file `C:\ptokax\scripts\CloneAlert.lua']
3: function `DataArrival' at line 19 [file `C:\ptokax\scripts\CloneAlert.lua']
Hi,
Try out this one...
--Clone Alert 1.0
--by Mutor The Ugly
--PM Clone login to Opchat
--Share Checker (made by nErBoS requested by BoJlk)
--
OpChatName = frmHub:GetOpChatName() --Use this line for inbuilt Px opchat
--OpChatName = "opschat" --Use this line for a scripted opchat
function Main()
frmHub:EnableFullData(1)
end
function DataArrival(curUser,sdata)
local _,_, user1 = strfind(sdata,"$GetINFO%s+(%S+)%s+")
if user1 ~= curUser.sName then
user1 = GetItemByName(user1)
if user1 ~= nil then
if user1.sIP == curUser.sIP then
if (user1.sMyInfoString ~= nil and curUser.sMyInfoString ~= nil) then
if (GetShare(user1.sMyInfoString) ~= GetShare(curUser.sMyInfoString)) then
SendPmToOps(OpChatName, "*** Cloned user = "..curUser.sName.." logged in, User is a clone of = "..user1.sName..", but they have different shares.")
else
SendPmToOps(OpChatName, "*** Cloned user = "..curUser.sName.." logged in, User is a clone of = "..user1.sName)
end
end
end
end
end
end
function GetShare(sMyinfo)
local s,e,share = strfind(sMyInfo, "%$(%d+)%$")
return tonumber(share)
end
Best regards, nErBoS
Hello Again...i've tried the CloneAlert *above
--Clone Alert 1.0
--by Mutor The Ugly
--PM Clone login to Opchat
--Share Checker (made by nErBoS requested by BoJlk)
--
OpChatName = frmHub:GetOpChatName() --Use this line for inbuilt Px opchat
--OpChatName = "[color=red]ChatOP[/color]" --Use this line for a scripted opchat
function Main()
frmHub:EnableFullData(1)
end
function DataArrival(curUser,sdata)
local _,_, user1 = strfind(sdata,"$GetINFO%s+(%S+)%s+")
if user1 ~= curUser.sName then
user1 = GetItemByName(user1)
if user1 ~= nil then
if user1.sIP == curUser.sIP then
if (user1.sMyInfoString ~= nil and curUser.sMyInfoString ~= nil) then
if (GetShare(user1.sMyInfoString) ~= GetShare(curUser.sMyInfoString)) then
SendPmToOps(OpChatName, "*** Cloned user = "..curUser.sName.." logged in, User is a clone of = "..user1.sName..", but they have different shares.")
else
SendPmToOps(OpChatName, "*** Cloned user = "..curUser.sName.." logged in, User is a clone of = "..user1.sName)
end
end
end
end
end
end
function GetShare(sMyinfo)
local s,e,share = strfind(sMyInfo, "%$(%d+)%$")
return tonumber(share)
end
I've added the OPChat's Name and Logged in myself
with different UserName...And got no Response from the CloneAlert (maybe it doesn't check the Loopback?)
Oh...Didn't noticed the "--" infront the command!
I've Changed the name of my
OpChat to
ChatOP in PK settings
And what do you mean?
Quote it may be better to use a table of users that may enter with same IP.
*** [edit]
And i've removed the "--" infront the
OpChatName = "ChatOP" --Use this line for a scripted opchat
and still no responce!
could it be because of the ProtaX soft? [v0.3.3.0 Build 15.25]