Wait a minute... the SendPropInt function has a nBits parameter... and no
default values for parameters...
SendProp SendPropInt(
char *pVarName,
int offset,
int sizeofVar,
int nBits,
int flags,
SendVarProxyFn varProxy
)
There's a #define or overload I'm missing somewhere, isn't there?
> Date: Tue, 2 Jun 2009 14:51:45 +0900
> From: [email protected]
> To: [email protected]
> Subject: Re: [hlcoders] What's the offset for on SendPropInt in making send
> tables?
>
> Are you referring to the number that goes after the initial comma?
> That value refers to the number of bits it will use to transfer the
> data. Always try to use the fewest bits possible as it optimizes network
> communication.
> So for example.. if your variable "m_iMental" rangers between 0 and 100.
> You should use a bit size of 7 (as that will allow you to use values
> from 0 - 127 )
> Also, you need to use the flag SPROP_UNSIGNED.
> So your declaration will look like this
>
> SendPropInt (SENDINFO(m_iMental), 7, SPROP_UNSIGNED ),
>
>
>
> Brent Lewis wrote:
> > I want to add an int network variable and figured this was probably the
> > place to do it. The problem is, I'm not quite sure what the "offset"
> > parameter of SendPropInt is, and what value I should use. I know what
> > offset means traditionally, but by this example it seems that may not be
> > the meaning.
> >
> > IMPLEMENT_SERVERCLASS_ST( CBasePlayer, DT_BasePlayer )
> >
> > SendPropDataTable(SENDINFO_DT(pl),
> > &REFERENCE_SEND_TABLE(DT_PlayerState), SendProxy_DataTableToDataTable),
> >
> > SendPropEHandle(SENDINFO(m_hVehicle)),
> > SendPropEHandle(SENDINFO(m_hUseEntity)),
> > SendPropInt (SENDINFO(m_iHealth), 10 ),
> > SendPropInt (SENDINFO(m_iMental), ???????)
> > SendPropInt (SENDINFO(m_lifeState), 3, SPROP_UNSIGNED ),
> > SendPropInt (SENDINFO(m_iBonusProgress), 15 ),
> > SendPropInt (SENDINFO(m_iBonusChallenge), 4 ),
> > SendPropFloat (SENDINFO(m_flMaxspeed), 12, SPROP_ROUNDDOWN,
> > 0.0f, 2048.0f ), // CL
> > SendPropInt (SENDINFO(m_fFlags), PLAYER_FLAG_BITS,
> > SPROP_UNSIGNED|SPROP_CHANGES_OFTEN,
> > SendProxy_CropFlagsToPlayerFlagBitsLength ),
> > SendPropInt (SENDINFO(m_iObserverMode), 3, SPROP_UNSIGNED ),
> > SendPropEHandle (SENDINFO(m_hObserverTarget) ),
> > SendPropInt (SENDINFO(m_iFOV), 8, SPROP_UNSIGNED ),
> > SendPropInt (SENDINFO(m_iFOVStart), 8, SPROP_UNSIGNED ),
> > SendPropFloat (SENDINFO(m_flFOVTime) ),
> > SendPropInt (SENDINFO(m_iDefaultFOV), 8, SPROP_UNSIGNED ),
> > SendPropEHandle (SENDINFO(m_hZoomOwner) ),
> > SendPropArray ( SendPropEHandle( SENDINFO_ARRAY( m_hViewModel )
> > ), m_hViewModel ),
> > SendPropString (SENDINFO(m_szLastPlaceName) ),
> > SendPropInt ( SENDINFO( m_ubEFNoInterpParity ),
> > NOINTERP_PARITY_MAX_BITS, SPROP_UNSIGNED ),
> >
> > // Data that only gets sent to the local player.
> > SendPropDataTable( "localdata", 0,
> > &REFERENCE_SEND_TABLE(DT_LocalPlayerExclusive),
> > SendProxy_SendLocalDataTable ),
> >
> > END_SEND_TABLE()
> > _______________________________________________
> > To unsubscribe, edit your list preferences, or view the list archives,
> > please visit:
> > http://list.valvesoftware.com/mailman/listinfo/hlcoders
> >
> >
> >
>
> _______________________________________________
> To unsubscribe, edit your list preferences, or view the list archives, please
> visit:
> http://list.valvesoftware.com/mailman/listinfo/hlcoders
>
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders