Server:Packet.reset Server function

From Gothic 2 Online: Wiki
Jump to navigation Jump to search

This function was added in version: 0.0.3.0

Remove value(s) from packet.

Syntax

void Packet.reset()

Example

addEventHandler("onInit",function()
{
	packet <- Packet(); // creating packet
	
	packet.writeInt32(32); // writing packet value
	
	packet.reset(); // removing every value from packet
	
	try
	{
		packet.readInt32(); // trying to read packet value (Int32)
	}
	catch (error)
	{
		print(error); // this will print "Cannot read data from Packet!" because, we have removed every packet value via packet.reset() method.
	}
});

Related functions