Harley wrote:Skinny, thank you for your decision!
I'll try and tell here.
You said that Nando helped with packets.
Tell me please some tricks with it, 'cause I don't really understand how to make packethooks.
With best regards!
Hi.
Well, a traditional way that the health bar close is when the npc/player die.
So, I analyzed the packets logs with Razor enabling packet logging:

Then, I realized that the POL (server side) sends the
"0xAF" packet, which is the death animation, and it is this packet that makes the health bar close. So when someone leaves the line of sight (more than 18 tiles), the POL (server side) sends the
"0x1D" packet to the client delete the object.
Commenting on the code:
Code: Select all
(...)
exported function deletehook(who, byref packet)
// packet.GetInt32(1) is the serial player that POL sent to delete the object.
var chr := SystemFindObjectBySerial(packet.GetInt32(1)); //Get the Object reference
if(!chr)
return 0; //Send 0x1D packet (Delete Object) to player.
endif
if(chr.acctname AND (Distance(who, chr) > 18)) //if object is a player and the distance between player and another player is more than 18 tiles
var packet1 := CreatePacket(0xAF, 13); //Create the Display Death Action
packet1.SetInt32(1, chr.serial); //the serial player that out the line of sight
packet1.SetInt32(5, 0);
packet1.SetInt32(9, 0);
packet1.SendPacket(who); //Send to player that was asked to delete the object
//Well, if out the line of sight for a player, also out the line of sight to the another player.
var packet2 := CreatePacket(0xAF, 13); //Create the Display Death Action
packet2.SetInt32(1, who.serial); //the serial player that out the line of sight
packet2.SetInt32(5, 0);
packet2.SetInt32(9, 0);
packet2.SendPacket(chr); //Send to player that was asked to delete the object
return 1; //And do not send 0x1D packet to player.
endif
return 0; //Send 0x1D packet (Delete Object) to player.
endfunction