How would I check if someone has been kicked using Player:Kick() or banned using Player:Ban()?

Is there an event I can hook my function on to or how would I go about doing this?

Not by default, but you can add one yourself by overriding debug.GetRegistry().Player.Kick/Ban.

Can I have an example of how I would do that?


local PLAYER = FindMetaTable( "Player" )

local fBan = PLAYER.Ban
local fKick = PLAYER.Kick

function PLAYER:Ban( iMin, bKick )
   if ( not hook.Run( "PlayerBanned", self, iMin, bKick )) then
      fBan( self, iMin, bKick )
   end
end

function PLAYER:Kick( sReason)
   if ( not hook.Run( "PlayerKicked", self, sReason )) then
      fKick( self, sReason )
   end
end

Of course, the better method would be just to modify the code that calls Ban/Kick.