ValveSoftware / source-sdk-2013

The 2013 edition of the Source SDK
https://developer.valvesoftware.com/wiki/SDK2013_GettingStarted
Other
3.7k stars 1.99k forks source link

Usercmd question #445

Open Mine228 opened 6 years ago

Mine228 commented 6 years ago

So I would like to ask if it is possible to send a CHandle information to the server through usercmd. So far I haven't seen any Write commands that would be specifically designed for sending CHandles so is it even possible?

azuisleet commented 6 years ago

A CHandle is simply the entry index and serial number as you would see on an ehandle. It can be serialized simply as a long: https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/mp/src/game/server/gameinterface.cpp#L3386

as additional data in WriteUsercmd and ReadUsercmd.

If you had a CHandle on the server, you would refresh it with CBaseHandle::Init. If the entity only exists on the client, then it won't resolve to anything on the server.