PtokaX forum

Archive => Archived 5.0 boards => Request for scripts => Topic started by: witch on 10 September, 2005, 19:00:16

Title: Clone Kill
Post by: witch on 10 September, 2005, 19:00:16
Hola !
Reqest for converting to lua 5 please.
_____________________________________________

MysBot = "Clone_Kill"

function Main()
frmHub:EnableFullData(1)
frmHub:UnregBot(MysBot)
end

function DataArrival(curUser,sdata)

local _,_, test = strfind(sdata,"$GetINFO%s+(%S+)%s+")
if test ~= curUser.sName then
   Test = GetItemByName(test)
      
      
if Test ~= nil then
   if Test.sIP == curUser.sIP    then
      SendToOps(MysBot,"The Name/ip "..curUser.sName.." / "..curUser.sIP.." was trying too connect but he/she already has an connection with Name/Ip "..Test.sName.." / "..Test.sIP)
      curUser:SendPM(MysBot,"Do not ENTER this hub with a second connection..You are already connected with Name/Ip "..Test.sName.." / "..Test.sIP)
      curUser:Disconnect()      
      end
   end
end
end
_____________________________________________

thx in advince  :))
Title:
Post by: bastya_elvtars on 10 September, 2005, 19:16:32
Already converted, with more features. See (http://board.univ-angers.fr/images/style/top_suche.gif)  for more information.
Title:
Post by: witch on 10 September, 2005, 19:21:08
QuoteOriginally posted by bastya_elvtars
Already converted, with more features. See (http://board.univ-angers.fr/images/style/top_suche.gif)  for more information.
well i did use it, like always...but can't find anything uless it's got defferent name sorry. i would apriciate if u could gimme the link.

thx
Title:
Post by: kunal on 10 September, 2005, 19:27:38
is this (http://board.univ-angers.fr/thread.php?threadid=4127&boardid=26&sid=51d17f3f1b8e83d1a71fbe885842dda8) what u r looking for
Title:
Post by: witch on 10 September, 2005, 19:39:35
QuoteOriginally posted by kunal
is this (http://board.univ-angers.fr/thread.php?threadid=4127&boardid=26&sid=51d17f3f1b8e83d1a71fbe885842dda8) what u r looking for
thx dude  ;)
Title: ur welcome
Post by: kunal on 10 September, 2005, 19:43:31
btw i just searched for clone and i got this result.dunno y u couldnt find it.
Title:
Post by: witch on 10 September, 2005, 19:51:11
QuoteOriginally posted by kunal
btw i just searched for clone and i got this result.dunno y u couldnt find it.
damn i searched on PtokaX Lua 5 forum and no results, if u search on all forums than yeah lot's of matches. but how u know if topic ralated to lua 4 or lua 5 till u open topic?

...

but thx 4 help  :))
Title:
Post by: witch on 10 September, 2005, 20:05:32
i've tryed 3 defferent clone scripts, none of them workin...PLEASE SCRIPTERS convert this little 1...

thx in advince  :))
Title:
Post by: bastya_elvtars on 10 September, 2005, 20:12:14
Check the 4th page of the thread kunal posted.
Title:
Post by: kunal on 10 September, 2005, 20:24:30
not the 4 th page.check the third page.the 4th page has just got a smiley by jiten
Title:
Post by: bastya_elvtars on 10 September, 2005, 20:26:18
QuoteOriginally posted by kunal
not the 4 th page.check the third page.the 4th page has just got a smiley by jiten

Eh, yes, true, sorry. Now this topic should be moved to the HOWTO section. :D
Title:
Post by: witch on 10 September, 2005, 20:49:50
hehe ok, i get that ;)

so i tryed finial edition of Clone Alert 1.6 posted by Dessamator on that thread. And damn script shows no syntacs errors but some how ppl could log in twice from same IP, so that's means something is really wrong hehe. I made all settings with name of op-chat and bot name on script.....please tell me where i made misstake?

thx  :))
Title:
Post by: bastya_elvtars on 10 September, 2005, 21:30:29
QuoteOriginally posted by witch
hehe ok, i get that ;)

so i tryed finial edition of Clone Alert 1.6 posted by Dessamator on that thread. And damn script shows no syntacs errors but some how ppl could log in twice from same IP, so that's means something is really wrong hehe. I made all settings with name of op-chat and bot name on script.....please tell me where i made misstake?

thx  :))

What PtokaX version are you using, what other scripts are you running etc.? Also post the script please.
Title:
Post by: witch on 10 September, 2005, 22:01:07
QuoteOriginally posted by bastya_elvtars

What PtokaX version are you using, what other scripts are you running etc.? Also post the script please.
ptokax 0.3.3.21.nt.dbg powered by RCv10.01e, Artbot 2.0 L5.lua, releaseBot.lua, zRightClicker.lua



-- 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 == true 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 == true 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)  and not(Nick.bOperator)  then

if curUser.iShareSize==Nick.iShareSize then

det(curUser)

if kick_other_too==1 then

det(Nick)

end

else

if PmOps == true then

SendPmToOps(OpChatName, "*** User "..curUser.sName.." logged in, with same IP as "..Nick.sName.." but with different share, please check.")

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

       


thx in advince  :))
Title:
Post by: bastya_elvtars on 10 September, 2005, 22:05:27
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 = true -- true:enables / false:disables , operator notifincation (STRONGLY recommended to leave enabled!)
Title:
Post by: witch on 10 September, 2005, 22:36:00
sure i changed settings on this part, above was posted original version from forum posted by Dessamator. Here is my part
OpChatName = "![pz]?Op-Chat?"  -- Rename to opchatbot
Bot = "![pz]?Robocop?" -- Rename to you main Px bot
kick=10 -- 0 to only disconnect, otherwise enter a number, and user will be kicked for that amount of minutes.
kick_other_too=1 -- 1 to disconnect/kick the already logged in user, 0 to not
PmOps = true -- true:enables / false:disables , operator notifincation (STRONGLY recommended to leave enabled!)


plz correct me, thx :)
Title:
Post by: bastya_elvtars on 10 September, 2005, 23:14:40
There should be no ? in botnames.

http://ptxwiki.psycho-chihuahua.net/doku.php/scriptinghelp/ptokaxapi#regbot_botname
Title:
Post by: witch on 10 September, 2005, 23:35:30
QuoteOriginally posted by bastya_elvtars
There should be no ? in botnames.

http://ptxwiki.psycho-chihuahua.net/doku.php/scriptinghelp/ptokaxapi#regbot_botname
well actualy it's not  "?" it's shows "?" cose of forum convert it from robocop dot. in script it's looks like that
(http://djwitch.250free.com/scriptscreen1.jpg)
Title:
Post by: kunal on 11 September, 2005, 07:02:39
QuoteSendToOps(MysBot,"The Name/ip "..curUser.sName.." / "..curUser.sIP.." was trying too connect but he/she already has an connection with Name/Ip "..Test.sName.." / "..Test.sIP)
curUser:SendPM(MysBot,"Do not ENTER this hub with a second connection..You are already connected with Name/Ip "..Test.sName.." / "..Test.sIP)

isnt this option inbuilt in the new ptokax.
Title:
Post by: bastya_elvtars on 11 September, 2005, 11:22:01
QuoteOriginally posted by kunal
QuoteSendToOps(MysBot,"The Name/ip "..curUser.sName.." / "..curUser.sIP.." was trying too connect but he/she already has an connection with Name/Ip "..Test.sName.." / "..Test.sIP)
curUser:SendPM(MysBot,"Do not ENTER this hub with a second connection..You are already connected with Name/Ip "..Test.sName.." / "..Test.sIP)

isnt this option inbuilt in the new ptokax.

The New Connections From Same IP option is against connection floods (aka too fast reconnects). I will test the clone checker script, however it should work. His script will not work, cause $GetINFO is no longer used.

Also note that if one of the clones is operator, then no checking will be performed.
Title:
Post by: witch on 11 September, 2005, 11:45:35
yes i also thout that new ptokax got inbuld clone function, but it's dosn't work on that way....

also i checked script with bouth clones users profiles, still no result.

thx  8)