PtokaX forum

Archive => Archived 5.0 boards => Help with scripts => Topic started by: BoyKind on 25 July, 2006, 11:05:31

Title: What's wrong with this ?
Post by: BoyKind on 25 July, 2006, 11:05:31
Hello ... can someone tell me what's wrong with this scrip ? It needs converted in 5.1 ? If yes, can you help me, or somethin' ? -- 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 = frmHub:GetOpChatName(),  -- Rename to opchatbot

Bot = frmHub:GetHubBotName(), -- 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
It gives me this: [11:01] Syntax C:\Volvo Hub\scripts\clone alert.lua:75: attempt to call a table value
- [11:01] Syntax C:\Volvo Hub\scripts\clone alert.lua:75: attempt to call a table value
- [11:01] Syntax C:\Volvo Hub\scripts\clone alert.lua:75: attempt to call a table value
- [11:01] Syntax C:\Volvo Hub\scripts\clone alert.lua:75: attempt to call a table value
- [11:01] Syntax C:\Volvo Hub\scripts\clone alert.lua:75: attempt to call a table value
- [11:01] Syntax C:\Volvo Hub\scripts\clone alert.lua:75: attempt to call a table value
- [11:01] Syntax C:\Volvo Hub\scripts\clone alert.lua:75: attempt to call a table value
- [11:01] Syntax C:\Volvo Hub\scripts\clone alert.lua:75: attempt to call a table value
- [11:01] Syntax C:\Volvo Hub\scripts\clone alert.lua:75: attempt to call a table value
- [11:01] Syntax C:\Volvo Hub\scripts\clone alert.lua:61: attempt to call a table value
- [11:01] Syntax C:\Volvo Hub\scripts\clone alert.lua:75: attempt to call a table value
- [11:01] Syntax C:\Volvo Hub\scripts\clone alert.lua:299: attempt to call a table value
Title: Re: What's wrong with this ?
Post by: BoyKind on 25 July, 2006, 12:25:21
Sry, I'm kinda n00b in scripting ... can you explain more clearly, please ?
Title: Re: What's wrong with this ?
Post by: bastya_elvtars on 25 July, 2006, 14:08:31
*sigh*
Here you go, test this, I'll keep editing this post if you find anomalies.
@Mutor: the optimizations indeed are killers. :-)

-- 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 = frmHub:GetOpChatName()  -- Rename to opchatbot
Bot = frmHub:GetHubBotName() -- 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()
  local f = io.open("logs/cloneimmune.txt", "w+")
  local m = "tImmune = { "
  for a, b in pairs(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 pairs(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 = ""
    for nick, _ in pairs(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:"..
    "\r\n\t+clone \t allows to have a clone"..
    "\r\n\t-clone \t removes from the clone list"..
    "\r\n\t?clone\t\t shows the users allowed to have a clone"..
    "\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
Title: Re: What's wrong with this ?
Post by: BoyKind on 25 July, 2006, 14:28:26
still no ... it doesn't work ... when I type +clone <nick> it gives me
Quote[16:22] Syntax C:\Volvo Hub\scripts\clone alert.lua:29: attempt to index local 'f' (a nil value)
Title: Re: What's wrong with this ?
Post by: BoyKind on 25 July, 2006, 14:30:54
Can you just forget that script and make me one that does not accept users that try to connect to my hub with multiple nicks but the same IP ? And only reg users can connect with multiple nicks but the same IP ? Could it be possible ?
Title: Re: What's wrong with this ?
Post by: Markitos on 25 July, 2006, 15:11:04
Quote from: BoyKind on 25 July, 2006, 14:30:54
Can you just forget that script and make me one that does not accept users that try to connect to my hub with multiple nicks but the same IP ? And only reg users can connect with multiple nicks but the same IP ? Could it be possible ?
I think Clone Alert does but i'll try something different. Will post my progress tonight.
Title: Re: What's wrong with this ?
Post by: bastya_elvtars on 25 July, 2006, 18:07:40
Quote from: BoyKind on 25 July, 2006, 14:28:26
still no ... it doesn't work ... when I type +clone <nick> it gives me
Quote[16:22] Syntax C:\Volvo Hub\scripts\clone alert.lua:29: attempt to index local 'f' (a nil value)

Create a folder called logs in the scripts folder. I missed that, sorry.
Title: Re: What's wrong with this ?
Post by: bastya_elvtars on 25 July, 2006, 18:10:22
BTW here is CloneAlert 1.1 fixed for Lua5.1

-- Clone Alert 1.1
-- 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

OpChatName = "opschat" --Rename to opchatbot - or frmHub:GetOpChatName() for bultin
Bot = "[Sentry]" --Rename to you main Px bot - frmHub:GetHubBotName() for builtin
PMOps = "1" --Should Ops be notified 1=yes 0=no (STRONGLY recommended to leave enabled!)



function NewUserConnected(curUser,sdata)
for _,Nick in pairs(frmHub:GetOnlineUsers()) do
if curUser.sIP==Nick.sIP and not (curUser.bOperator and Nick.bOperator) then
if curUser.iShare==Nick.iShare then
curUser:SendPM(Bot,"This hub does not allow the use of clones. Hit the bricks, ya leecher!")
curUser:Disconnect()
Nick:SendPM(Bot,"This hub does not allow the use of clones. Hit the bricks, ya leecher!")
Nick:Disconnect()
if PMOps == "1" then
SendPmToOps(OpChatName, "*** Cloned user = "..curUser.sName.." logged in, Nick is a clone of = "..Nick.sName)
SendPmToOps(OpChatName, "***"..curUser.sName.." and "..Nick.sName.." have been disconnected")
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
Title: Re: What's wrong with this ?
Post by: BoyKind on 25 July, 2006, 18:27:46
it works \:D/ thx bastya_elvtars ... all it needed was that folder ;) ... now I have another request ... there are two commands over there .. ?clone and ?clonehelp ... can you modify them in !clone and !clonehelp ? please...
Title: Re: What's wrong with this ?
Post by: Psycho_Chihuahua on 25 July, 2006, 19:14:08
you can do that on your own...all you need to do is change the ? into a ! inside the script.
Title: Re: What's wrong with this ?
Post by: BoyKind on 25 July, 2006, 20:11:58
Nope, it doesn't work ... dunno' why ... I tried to do that, but then the script won't work no more ... can you tell me where exactly 2 modify ?
Title: Re: What's wrong with this ?
Post by: BoyKind on 25 July, 2006, 20:20:29
Nevermind :) find out 4 myself :) -- 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 = frmHub:GetOpChatName()  -- Rename to opchatbot
Bot = frmHub:GetHubBotName() -- 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()
  local f = io.open("logs/cloneimmune.txt", "w+")
  local m = "tImmune = { "
  for a, b in pairs(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 pairs(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 = ""
    for nick, _ in pairs(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:"..
    "\r\n\t+clone \t allows to have a clone"..
    "\r\n\t-clone \t removes from the clone list"..
    "\r\n\t!clone\t\t shows the users allowed to have a clone"..
    "\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
Title: Re: What's wrong with this ?
Post by: Markitos on 25 July, 2006, 20:35:01
Good you figured it out; that were my 1st steps =)
Title: Re: What's wrong with this ?
Post by: Djdirect on 25 February, 2007, 06:55:03
hi all
I use this script but after several test, the script doesn't see any double ip
-- 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 = "?Op-Chat?" -- frmHub:GetOpChatName() - Rename to opchatbot
Bot = "?Postman?" -- frmHub:GetHubBotName() - 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=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!)


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 pairs(tImmune) do m = m..(string.format("[%q]=",a)..b..","); end
m = m.." }"
f:write( m ); f:flush(); f:close();
end


function NewUserConnected(curUser,sdata)
    if (curUser.bOperator) then
      curUser:SendData("$UserCommand 1 3 ? Clone Alerte\\Ajoutez un user dans la liste des immunis?s$<%[mynick]> +clone %[line:Pseudo]&#124;|")
      curUser:SendData("$UserCommand 1 3 ? Clone Alerte\\Ajoutez cet user dans la liste des immunis?s$<%[mynick]> +clone %[nick]&#124;|")
      curUser:SendData("$UserCommand 1 3 ? Clone Alerte\\Effacer un user de la liste des immunis?s$<%[mynick]> -clone %[line:Pseudo]&#124;|")
      curUser:SendData("$UserCommand 1 3 ? Clone Alerte\\Effacer cet user de la liste des immunis?s$<%[mynick]> -clone %[nick]&#124;|")
      curUser:SendData("$UserCommand 1 3 ? Clone Alerte\\Montrez les users autoris?s ? avoir un clone$<%[mynick]> ?clone&#124;|")
      curUser:SendData("$UserCommand 1 3 ? Clone Alerte\\Voir les commandes de Clone Alerte$<%[mynick]> ?clonehelp&#124;|")
    end
for _,Nick in pairs(frmHub:GetOnlineUsers()) do
if curUser.sIP==Nick.sIP then
local det=function (User)
curUser:SendPM(Bot,"La double Ip n'est pas permis. Vous ?tes d?j? connect?s ? ce hub sous ce pseudo: "..Nick.sName)
if kick~=0 then
User:SendPM(Bot,"Vous ?tes temporairement banni. Votre IP: "..User.sIP)
User:TimeBan(kick)
if PmOps == "1" then
SendPmToOps(OpChatName, "*** Clone User Alerte: <"..curUser.sName.."> ("..curUser.sIP..") c'est connect? et a ?t? temporairement banni pour  "..kick.." minutes. L'user est un clone de <"..Nick.sName..">")
end
else
User:SendPM(Bot,"Vous ?tes d?connect?s.")
User:Disconnect()
if PmOps == "1" then
SendPmToOps(OpChatName, "*** Clone User Alerte: <"..curUser.sName.."> ("..curUser.sIP..") c'est connect? et a ?t? d?connect?. L'user est un clone de <"..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 NewUserConnected 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

OpConnected = NewUserConnected


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, "*** Erreur: Taper +clone pseudo") end
if tImmune[name] then user:SendData("nope") end


local nick = GetItemByName(name)
if not nick then user:SendData(Bot, "*** Erreur: L'user n'est pas en ligne.") end


tImmune[name] = 1
OnExit()
user:SendData(Bot, name.." est maintenant immunis? ,il ne sera plus control? par Clone Alerte!")
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, "*** Errer: Taper -clone pseudo") end
if not tImmune[name] then user:SendData(Bot,"L'user "..victim.sName.." n'est plus immunis?!")  end


local nick = GetItemByName( name )
if not nick then user:SendData(Bot, "*** Erreur: L'user n'est pas en ligne.") end


tImmune[name] = nil
OnExit()
user:SendData(Bot,"Now "..name.." n'est dor?navant plus immunis?,il sera a nouveau control?!")
return 1


end,


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


local m = ""
collectgarbage()
for nick, _ in pairs(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, "Il n'y a pas aucun user autoris? a avoir un clone", Bot, how ) end
m = "\r\nLes users suivants peuvent avoir des clones dans ce hub:"..m
return SendBack( user, m , Bot, how )
end,
--- Show cloneBot help


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


local m = "\r\n\r\nVoici les commandes de Clone Alerte:"
m = m.."\r\n\t+clone <pseudo> \t autorise <pseudo> a avoir un clone"
m = m.."\r\n\t-clone <pseudo> \t efface <pseudo> de la liste immunis?"
m = m.."\r\n\t?clone\t\t voir la liste des users autoris?s a avoir un clone"
m = m.."\r\n\t?clonehelp \t voir les commandes de Clone Alerte"
return SendBack( user, m, Bot, how )


end, }


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

Title: Re: What's wrong with this ?
Post by: bastya_elvtars on 25 February, 2007, 13:34:44
Try the latest version (http://forum.ptokax.org/index.php?topic=6769.0)
Title: Re: What's wrong with this ?
Post by: Djdirect on 25 February, 2007, 15:39:54
thank's   no have right click menu  :-\
Title: Re: What's wrong with this ?
Post by: bastya_elvtars on 25 February, 2007, 15:41:35
Ohm, should it?
I'll make one then soon.