Capturing kick reason from clientside kicks


29 December 2022 - PtokaX (20th anniversary edition) released...
11 April 2017 - PtokaX released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX for Windows 10 IoT released...
3 September 2015 - PtokaX released...
16 August 2015 - PtokaX released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX released...
13 April 2014 - PtokaX released...
23 March 2014 - PtokaX testing version build 454 is available.
04 March 2014 - sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

Capturing kick reason from clientside kicks

Started by Mardeg, 05 November, 2006, 16:43:22

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


From Changelog -
QuoteFixed: 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:
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.")
			return 1
		return 1

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


You could always do :
--- 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 :)


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.

SMF spam blocked by CleanTalk