Author Topic: Capturing kick reason from clientside kicks  (Read 3355 times)

0 Members and 1 Guest are viewing this topic.

Offline Mardeg

  • Forum Ace
  • *****
  • Posts: 75
  • Karma: +7/-1
    • The most bloated human-readable email hider in the world!
Capturing kick reason from clientside kicks
« on: 05 November, 2006, 16:43:22 »
From Changelog - 0.3.5.2:
Quote
Fixed: Missing kick message when op kick user from inbuild client kick.
Anyone done this successfully with the latest PtokaX?
My code from previous versions just looked like this:
Code: [Select]
function KickArrival(user, Data)
_, _, kcom, knick = string.find(data,"(%S+)%s+(%S+)")
if GetItemByName(knick) then
local arg = GetItemByName(knick)
if (not arg.bRegistered) then arg:TimeBan(20)
elseif GetProfileName(arg.iProfile) == Reg then
SendPmToNick(arg.sName, user.sName, "Client-based kick. Reason upcapturable")
elseif arg.iProfile <= user.iProfile then
SendPmToNick(user.sName,arg.sName, "Looks like that backfired on you. Only kick users with lower levels than yourself next time.")
user:Disconnect()
return 1
end
arg:Disconnect()
return 1
end

possibly as easy as changing one line? (no-one volunteered for testing):
_, _, kcom, knick, kreason = string.find(data,"(%S+)%s+(%S+)%s+(%.*)")

PtokaX forum

Capturing kick reason from clientside kicks
« on: 05 November, 2006, 16:43:22 »

Herodes

  • Guest
Re: Capturing kick reason from clientside kicks
« Reply #1 on: 05 November, 2006, 17:00:53 »
You could always do :
Code: [Select]
--- Incoming string: $Kick SomeNick for being a very bad boy....|
--- the regular expression:
local nick, reason = (data:sub(1 , -2)):match("^%$Kick%s(%S+)%s(.*)$")
--- simplified...
local nick,reason = string.match( string.sub(data, 1, -2), "^%$Kick%s(%S+)%s(.*)$" )
I hope this gives you some hints :)

Offline bastya_elvtars

  • Forum God
  • ****
  • Posts: 3 753
  • Karma: +173/-7
  • The rock n' roll doctor
    • The FreshStuff3 Site
Re: Capturing kick reason from clientside kicks
« Reply #2 on: 06 November, 2006, 16:39:05 »
Umm, the order of the clientkick is fixed. You can probably use a coroutine.
Everything could have been anything else and it would have just as much meaning.

PtokaX forum

Re: Capturing kick reason from clientside kicks
« Reply #2 on: 06 November, 2006, 16:39:05 »