Packet reference
Posted: Fri Aug 24, 2007 1:42 pm
Hello,
I have problem with editing packets in packet hook, i am trying to change some packets for clients > 6.0.1.6, so i created few packet hooks, this is one of it:
but if i want to use this syntax "packet := oldstyle;" packet would not change at all and core seems to be working with original packet sent by client.
If i do almost the same this way:
then its working a little ( I can only drop items on ground, not in containers becouse of the last byte ). I want to create new packet becouse i need to set different size ( new clients are sending 15 bytes, and core needs 14 bytes packet ) and packet.SetSize() is not working on fixed length packets.
So i am curious why assigning new packet object to packet variable isnt working even if packet variable is sent with byref? Or at least is there some another way to pass new packet from script to polcore?
I have problem with editing packets in packet hook, i am trying to change some packets for clients > 6.0.1.6, so i created few packet hooks, this is one of it:
Code: Select all
exported function DropRequest( who, byref packet )
if(!GetObjProperty( who, NEW_CLIENT ) )
return 0;
endif
var oldstyle := CreatePacket( 0x08, 14 );
oldstyle.SetInt32( 1, packet.GetInt32(1) );
oldstyle.SetInt16( 5, packet.GetInt16(5) );
oldstyle.SetInt16( 7, packet.GetInt16(7) );
oldstyle.SetInt8 ( 9, packet.GetInt8 (9) );
// packet.GetInt8( 10 ) - Grid location
oldstyle.SetInt32( 10, packet.GetInt32( 11 ) );
packet := oldstyle;
return 0;
endfunctionIf i do almost the same this way:
Code: Select all
exported function DropRequest( who, byref packet )
if(!GetObjProperty( who, NEW_CLIENT ) )
return 0;
endif
var containerID := packet.GetInt32( 11 );
packet.SetInt32( 10, cointainerID );
return 0;
endfunctionSo i am curious why assigning new packet object to packet variable isnt working even if packet variable is sent with byref? Or at least is there some another way to pass new packet from script to polcore?