void SendProxy_EHandleToInt( const SendProp *pProp, const void *pStruct, const void *pVarData, DVariant *pOut, int iElement, int objectID) { CBaseHandle *pHandle = (CBaseHandle*)pVarData; if ( pHandle && pHandle->Get() ) { int iSerialNum = pHandle->GetSerialNumber() & (1 << NUM_NETWORKED_EHANDLE_SERIAL_NUMBER_BITS) - 1; pOut->m_Int = pHandle->GetEntryIndex() | (iSerialNum << MAX_EDICT_BITS); } else { pOut->m_Int = INVALID_NETWORKED_EHANDLE_VALUE; } }
LUA_API lua_CBaseCombatWeapon *lua_toweapon (lua_State *L, int idx) { CBaseHandle *hWeapon = dynamic_cast<CBaseHandle *>((CBaseHandle *)lua_touserdata(L, idx)); if (hWeapon == NULL) return NULL; return dynamic_cast<lua_CBaseCombatWeapon *>(hWeapon->Get()); }