#this line will send a packet from the server to all clients saying that a client logged out
self.SendAll(libpac.newPacket(libpac.PAC_AUTH_CLIENTLOGGEDOUT,99,username))
#this is how the clients read the packet
def Filter(self,packet):
........
#a client logged out, why wont this work?!
elif header == self.PAC_AUTH_CLIENTLOGGEDOUT:
print data + " has logged out"
........
#for some reason it doesnt work!, but it works with all my other packets :(
##libpac module
PAC_AUTH_CLIENTLOGGEDOUT = 70
def newPacket (header, ID = 99,data = "null" ):
#compressed_data = zlib.compress(data)
if header == 70:
print "sent"
compressed_header = chr(header)
compressed_id = chr(ID)
length1 = 0
length2 = 0
if len(data) > 255: #should be compressed_data if you want compression
length1 = chr(255)
length2 = chr(len(data) - 255)
else:
length1 = chr(len(data)) #compressed_data for compression
length2 = chr(0)
packet = compressed_header + compressed_id + length1 + length2 + data
return packet