0xBF Subcommand 4

Here you can discuss packets, implementation and design, and software related to the packet sniffing and such. This is not the place to post packages for POL, but rather discuss the packet side of them.

Moderator: POL Developer

Post Reply
blckfire
Apprentice Poster
Posts: 54
Joined: Thu Feb 26, 2015 10:28 am

0xBF Subcommand 4

Post by blckfire »

I'm using POL96 so I don't have the CloseGump function.

I'm trying to build this packet to send it to the client so that it closes a gump before opening another one.

So, I am able to send the packet, but the client then stops after a few steps

Code: Select all

function CloseGump(mobile, pid, retval := 0)
	var packet := CreatePacket(0xBF, 13);
	packet.SetInt16(1, 0x4);
	packet.SetInt32(3, pid);
	packet.SetInt32(7, retval);
	packet.SendPacket(mobile);
	
	return 1;
endfunction
Do I need to do anything else? after I send this packet?
blckfire
Apprentice Poster
Posts: 54
Joined: Thu Feb 26, 2015 10:28 am

Re: 0xBF Subcommand 4

Post by blckfire »

It is now solved. I was making some mistakes with the offsetts.

Code: Select all

use uo;
use os;
use polsys;

function CloseGump(mobile, pid, retval := 0)
	var packet := CreatePacket(0xBF, -1);
	packet.SetInt16(3, 0x4);
	packet.SetInt32(5, pid);
	packet.SetInt32(9, retval);
	
	var result := packet.SendPacket(mobile);
	if(!result)
		SendSysMessage(mobile, "Error: "+result);
	endif
	
	GetProcess(pid).kill();
	
	return 1;
endfunction
I post the code to do this in case someone wants to use this.
Harley
Forum Regular
Posts: 360
Joined: Sat Mar 18, 2006 1:41 am
Location: Germany

Re: 0xBF Subcommand 4

Post by Harley »

Nice one! Are u using it like packethook?
blckfire
Apprentice Poster
Posts: 54
Joined: Thu Feb 26, 2015 10:28 am

Re: 0xBF Subcommand 4

Post by blckfire »

Nope. Just created a custom function to send the package out to the client and it works like a charm.

It basically allows you to emulate the CloseGump() function from later cores.

Eventually I'm going to upgrade the whole server to POL99 but for now I'll have to use this workaround.

As a side note:
Also, I decided to kill the script afterwards to make sure no crumbs are left behind.
Post Reply