868 B
868 B
event onBan
!!! note If serial/mac/ip/name indexes doesn't exist, then the parameters has not been specified when ban was added. If timestamp doesn't exist, then ban was permanent.
This event is triggered when new ban is being added.
Parameters
dictkwargs:strmac: MAC address of the banned player.strip: IP address of the banned player.strserial: serial of the banned player.strname: nickname of the banned player.inttimestamp: timestamp when the ban expires.
Usage
import g2o
from datetime import datetime
@g2o.event('onBan')
def onBan(**kwargs):
print(f'Player {kwargs['name']} has been banned.')
if ('timestamp' in kwargs):
banExpires = datetime.fromtimestamp(kwargs['timestamp'])
print(f'Ban expires at {banExpires}')