Author Topic: Kick part  (Read 2010 times)

0 Members and 1 Guest are viewing this topic.

Offline DJ Bert

  • Triple Ace
  • **
  • Posts: 211
  • Karma: +6/-1
  • Guardian Scripter
Kick part
« on: 21 April, 2006, 22:17:04 »
Hi peeps

I have a kick part, how do i ad to string.find when a user is kicked with client so that the kick is added in temporary kicked.log?

Code: [Select]
if (cmd == "!kick") then
local _,_,To,From,Msg = string.find(data, "$to:%s+(%S+)%s+from:%s+(%S+)%s+%S+%s+(.+)|")
if (GetItemByName(extra) == nil) then
curUser:SendData(Bot, extra..""..line161.."")
else
local BadUser = GetItemByName(extra)
if BadUser.iProfile ~= 0 then
if (kicked[BadUser.sName] == nil) then
kicked[BadUser.sName] = 1
else
kicked[BadUser.sName] = kicked[BadUser.sName] + 1
end
if (kicked[BadUser.sName] == MaxKicks) then
SendToOps(Bot, extra..""..line162..""..curUser.sName..""..line160..""..rest..".")
SendToOps(Bot, ""..line159..""..extra.."'s "..MaxKicks.." kick, so is now banned.")
BadUser:SendPM(Bot, ""..line163..""..curUser.sName..""..line160..""..rest..".")
BadUser:SendPM(Bot, ""..line164..""..MaxKicks..""..line165.."")
BadUser:Ban()
kicked[BadUser.sName] = nil
SaveToFile("Guardian/data/kicked.log", kicked, "kicked")
                                else
BadUser:SendPM(Bot, ""..line163..""..curUser.sName..""..line160..""..rest..".")
BadUser:SendPM(Bot, ""..line166..""..kicked[BadUser.sName].."" ..line167..""..MaxKicks..""..line168.."")
SendToOps(Bot, extra..""..line162..""..curUser.sName..""..line160..""..rest..".")
BadUser:TempBan()
SaveToFile("Guardian/data/kicked.log", kicked, "kicked")
                        end
else
BadUser:SendPM(Bot, curUser.sName..""..line169.."")
curUser:SendData(Bot, BadUser.sName..""..line170.."")
end
end
return 1
end -- kick


PtokaX forum

Kick part
« on: 21 April, 2006, 22:17:04 »

Offline jiten

  • Scripter
  • Forum Legend
  • ******
  • Posts: 1 577
  • Karma: +71/-5
Re: Kick part
« Reply #1 on: 22 April, 2006, 12:05:28 »
Here is something that may help you:

Code: [Select]
KickArrival = function(user,data)
local s,e,sVictim = string.find(data,"^$Kick%s(%S+)|$")
if sVictim then
-- Your code
end
end

ChatArrival = function(user,data)
if string.find(data,"^%b<>%s+is%skicking%s%S+%sbecause:%s.*|$") then
-- Your code
end
end

ToArrival = function(user,data)
local s,e,to = string.find(data,"^$To:%s(%S+)%s+From:")
if to and GetItemByName(to) then
local s,e,msg = string.find(data,to.."%s+%S+%s-%$%b<>%s+(.*)|$")
if msg and string.find(msg,"^You%sare%sbeing%skicked%sbecause:%s.*$") then
-- Your code
end
end
end

Offline DJ Bert

  • Triple Ace
  • **
  • Posts: 211
  • Karma: +6/-1
  • Guardian Scripter
Re: Kick part
« Reply #2 on: 22 April, 2006, 16:32:34 »
Thnx jiten, gonna try

PtokaX forum

Re: Kick part
« Reply #2 on: 22 April, 2006, 16:32:34 »