There are many situations within a game, that you might want the objects to pass information to other objects. One option is to get a handle to the object and get the instance of the class to which it is a member. But there are times where you want to pass information to a generic object without wanting to have direct access to the object's members. To do this, you can pass messages to other objects using the following method:
// Send this message to the player object
g_pLTServer->SendToObject(pMsg->Read(), m_hObject, hObj, 0);
As you may notice, you need to create a message in the same manner that you create a message for any other purpose. You also need an HOBJECT handle to the object which is sending the message, and one to the object to which you wish to send the message.
You will also notice above that the OBJ_MID_PICKUP is getting pushed onto the message.
OBJ_MID_PICKUP = 0
This is a value that we have defined in game code which gets referenced by the target object to determine if it has a way to deal with the incomming message. This is done below.
uint32 CPlayerSrvr::ObjectMessageFn(HOBJECT hSender, ILTMessage_Read *pMsg)
uint32 messageID = pMsg->Readuint32();
uint8 nPickupType = pMsg->Readuint8();
float fPickupValue = pMsg->Readfloat();
g_pLTServer->CPrint("PlayerSrvr -> OBJ_MID_PICKUP %d %f", nPickupType, fPickupValue);
return BaseClass::ObjectMessageFn(hSender, pMsg);
credits for once are to me and the lithtech jupiter enterprise package. Found this while learning about clientFX (because shits about to get real)