Add [get|set]_pdata_[bool|byte|short|vector|ehandle] and set_pdata_ent (bug 5770, r=joropito)
Former-commit-id: da3d13a9c027f764d0506273fca2ac71a75719c7
This commit is contained in:
parent
21a00e00a2
commit
c0fcf06c96
|
@ -42,6 +42,8 @@ inline edict_t* INDEXENT2( int iEdictNum )
|
|||
#endif
|
||||
|
||||
#define CHECK_ENTITY(x) if (x != 0 && (FNullEnt(INDEXENT2(x)) || x < 0 || x > gpGlobals->maxEntities)) { MF_LogError(amx, AMX_ERR_NATIVE, "Invalid entity"); return 0; }
|
||||
#define CHECK_OFFSET(x) if (x < 0) { MF_LogError(amx, AMX_ERR_NATIVE, "Invalid offset"); return 0; }
|
||||
|
||||
extern AMX_NATIVE_INFO engfunc_natives[];
|
||||
extern AMX_NATIVE_INFO dllfunc_natives[];
|
||||
extern AMX_NATIVE_INFO forward_natives[];
|
||||
|
|
|
@ -31,12 +31,13 @@ static cell AMX_NATIVE_CALL set_pdata_int(AMX *amx, cell *params)
|
|||
{
|
||||
int index=params[1];
|
||||
CHECK_ENTITY(index);
|
||||
|
||||
int iOffset=params[2];
|
||||
if (iOffset <0)
|
||||
return 1;
|
||||
#ifdef __linux__
|
||||
CHECK_OFFSET(iOffset);
|
||||
|
||||
#if defined( __linux__ )
|
||||
iOffset += params[4];
|
||||
#elif defined __APPLE__
|
||||
#elif defined( __APPLE__ )
|
||||
// Use Linux offset in older plugins
|
||||
if (params[0] / sizeof(cell) == 4)
|
||||
iOffset += params[4];
|
||||
|
@ -51,12 +52,13 @@ static cell AMX_NATIVE_CALL get_pdata_int(AMX *amx, cell *params)
|
|||
{
|
||||
int index=params[1];
|
||||
CHECK_ENTITY(index);
|
||||
|
||||
int iOffset=params[2];
|
||||
if (iOffset <0)
|
||||
return 0;
|
||||
#ifdef __linux__
|
||||
CHECK_OFFSET(iOffset);
|
||||
|
||||
#if defined( __linux__ )
|
||||
iOffset += params[3];
|
||||
#elif defined __APPLE__
|
||||
#elif defined( __APPLE__ )
|
||||
// Use Linux offset in older plugins
|
||||
if (params[0] / sizeof(cell) == 3)
|
||||
iOffset += params[3];
|
||||
|
@ -71,12 +73,13 @@ static cell AMX_NATIVE_CALL set_pdata_float(AMX *amx, cell *params)
|
|||
{
|
||||
int index=params[1];
|
||||
CHECK_ENTITY(index);
|
||||
|
||||
int iOffset=params[2];
|
||||
if (iOffset <0)
|
||||
return 1;
|
||||
#ifdef __linux__
|
||||
CHECK_OFFSET(iOffset);
|
||||
|
||||
#if defined( __linux__ )
|
||||
iOffset += params[4];
|
||||
#elif defined __APPLE__
|
||||
#elif defined( __APPLE__ )
|
||||
// Use Linux offset in older plugins
|
||||
if (params[0] / sizeof(cell) == 4)
|
||||
iOffset += params[4];
|
||||
|
@ -92,12 +95,13 @@ static cell AMX_NATIVE_CALL get_pdata_float(AMX *amx, cell *params)
|
|||
{
|
||||
int index=params[1];
|
||||
CHECK_ENTITY(index);
|
||||
|
||||
int iOffset=params[2];
|
||||
if (iOffset <0)
|
||||
return 1;
|
||||
#ifdef __linux__
|
||||
CHECK_OFFSET(iOffset);
|
||||
|
||||
#if defined( __linux__ )
|
||||
iOffset += params[3];
|
||||
#elif defined __APPLE__
|
||||
#elif defined( __APPLE__ )
|
||||
// Use Linux offset in older plugins
|
||||
if (params[0] / sizeof(cell) == 3)
|
||||
iOffset += params[3];
|
||||
|
@ -114,11 +118,11 @@ static cell AMX_NATIVE_CALL get_pdata_string(AMX *amx, cell *params)
|
|||
CHECK_ENTITY(index);
|
||||
|
||||
int iOffset=params[2];
|
||||
if (iOffset <0)
|
||||
return 1;
|
||||
#ifdef __linux__
|
||||
CHECK_OFFSET(iOffset);
|
||||
|
||||
#if defined( __linux__ )
|
||||
iOffset += params[6];
|
||||
#elif defined __APPLE__
|
||||
#elif defined( __APPLE__ )
|
||||
// Use Linux offset in older plugins
|
||||
if (params[0] / sizeof(cell) == 6 || params[7] == CELL_MIN)
|
||||
iOffset += params[6];
|
||||
|
@ -152,11 +156,11 @@ static cell AMX_NATIVE_CALL set_pdata_string(AMX *amx, cell *params)
|
|||
CHECK_ENTITY(index);
|
||||
|
||||
int iOffset=params[2];
|
||||
if (iOffset <0)
|
||||
return 1;
|
||||
#ifdef __linux__
|
||||
CHECK_OFFSET(iOffset);
|
||||
|
||||
#if defined( __linux__ )
|
||||
iOffset += params[5];
|
||||
#elif defined __APPLE__
|
||||
#elif defined( __APPLE__ )
|
||||
// Use Linux offset in older plugins
|
||||
if (params[0] / sizeof(cell) == 5 || params[6] == CELL_MIN)
|
||||
iOffset += params[5];
|
||||
|
@ -197,13 +201,14 @@ static cell AMX_NATIVE_CALL set_pdata_string(AMX *amx, cell *params)
|
|||
static cell AMX_NATIVE_CALL get_pdata_ent(AMX *amx, cell *params)
|
||||
{
|
||||
int index=params[1];
|
||||
int iOffset=params[2];
|
||||
|
||||
CHECK_ENTITY(index);
|
||||
|
||||
#ifdef __linux__
|
||||
int iOffset=params[2];
|
||||
CHECK_OFFSET(iOffset);
|
||||
|
||||
#if defined( __linux__ )
|
||||
iOffset += params[3];
|
||||
#elif defined __APPLE__
|
||||
#elif defined( __APPLE__ )
|
||||
// Use Linux offset in older plugins
|
||||
if (params[0] / sizeof(cell) == 3)
|
||||
iOffset += params[3];
|
||||
|
@ -234,6 +239,307 @@ static cell AMX_NATIVE_CALL get_pdata_ent(AMX *amx, cell *params)
|
|||
return ent;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL set_pdata_ent( AMX *amx, cell *params )
|
||||
{
|
||||
int index = params[1];
|
||||
CHECK_ENTITY( index );
|
||||
|
||||
int offset = params[2];
|
||||
CHECK_OFFSET( offset );
|
||||
|
||||
int entity = params[3];
|
||||
CHECK_ENTITY( entity );
|
||||
|
||||
#if defined( __linux__ )
|
||||
offset += params[4];
|
||||
#elif defined( __APPLE__ )
|
||||
// Use Linux offset in older plugins
|
||||
if( params[0] / sizeof( cell ) == 4 )
|
||||
offset += params[4];
|
||||
else
|
||||
offset += params[5];
|
||||
#endif
|
||||
|
||||
*( edict_t** )( ( char* )( INDEXENT2( index )->pvPrivateData ) + offset ) = INDEXENT2( entity );
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL get_pdata_bool( AMX *amx, cell *params )
|
||||
{
|
||||
int index = params[1];
|
||||
CHECK_ENTITY( index );
|
||||
|
||||
int offset = params[2];
|
||||
CHECK_OFFSET( offset );
|
||||
|
||||
#if defined( __linux__ )
|
||||
offset += params[3];
|
||||
#elif defined( __APPLE__ )
|
||||
// Use Linux offset in older plugins
|
||||
if( params[0] / sizeof( cell ) == 3 )
|
||||
offset += params[3];
|
||||
else
|
||||
offset += params[4];
|
||||
#endif
|
||||
|
||||
return *( bool* )( ( char* )INDEXENT2( index )->pvPrivateData + offset ) ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL set_pdata_bool( AMX *amx, cell *params )
|
||||
{
|
||||
int index = params[1];
|
||||
CHECK_ENTITY( index );
|
||||
|
||||
int offset = params[2];
|
||||
CHECK_OFFSET( offset );
|
||||
|
||||
bool value = params[3] ? true : false;
|
||||
|
||||
#if defined( __linux__ )
|
||||
offset += params[4];
|
||||
#elif defined( __APPLE__ )
|
||||
// Use Linux offset in older plugins
|
||||
if( params[0] / sizeof( cell ) == 4 )
|
||||
offset += params[4];
|
||||
else
|
||||
offset += params[5];
|
||||
#endif
|
||||
|
||||
*( bool* )( ( char* )INDEXENT2( index )->pvPrivateData + offset ) = value;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL get_pdata_byte( AMX *amx, cell *params )
|
||||
{
|
||||
int index = params[1];
|
||||
CHECK_ENTITY( index );
|
||||
|
||||
int offset = params[2];
|
||||
CHECK_OFFSET( offset );
|
||||
|
||||
#if defined( __linux__ )
|
||||
offset += params[3];
|
||||
#elif defined( __APPLE__ )
|
||||
// Use Linux offset in older plugins
|
||||
if( params[0] / sizeof( cell ) == 3 )
|
||||
offset += params[3];
|
||||
else
|
||||
offset += params[4];
|
||||
#endif
|
||||
|
||||
return static_cast< cell >( *( ( byte* )INDEXENT2( index )->pvPrivateData + offset ) );
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL set_pdata_byte( AMX *amx, cell *params )
|
||||
{
|
||||
int index = params[1];
|
||||
CHECK_ENTITY( index );
|
||||
|
||||
int offset = params[2];
|
||||
CHECK_OFFSET( offset );
|
||||
|
||||
byte value = static_cast< byte >( params[3] );
|
||||
|
||||
#if defined( __linux__ )
|
||||
offset += params[4];
|
||||
#elif defined( __APPLE__ )
|
||||
// Use Linux offset in older plugins
|
||||
if( params[0] / sizeof( cell ) == 4 )
|
||||
offset += params[4];
|
||||
else
|
||||
offset += params[5];
|
||||
#endif
|
||||
|
||||
*( ( byte* )INDEXENT2( index )->pvPrivateData + offset ) = value;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL get_pdata_short( AMX *amx, cell *params )
|
||||
{
|
||||
int index = params[1];
|
||||
CHECK_ENTITY( index );
|
||||
|
||||
int offset = params[2];
|
||||
CHECK_OFFSET( offset );
|
||||
|
||||
#if defined( __linux__ )
|
||||
offset += params[3];
|
||||
#elif defined( __APPLE__ )
|
||||
// Use Linux offset in older plugins
|
||||
if( params[0] / sizeof( cell ) == 3 )
|
||||
offset += params[3];
|
||||
else
|
||||
offset += params[4];
|
||||
#endif
|
||||
|
||||
return static_cast< cell >( *( short* )( ( char* )INDEXENT2( index )->pvPrivateData + offset ) );
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL set_pdata_short( AMX *amx, cell *params )
|
||||
{
|
||||
int index = params[1];
|
||||
CHECK_ENTITY( index );
|
||||
|
||||
int offset = params[2];
|
||||
CHECK_OFFSET( offset );
|
||||
|
||||
short value = static_cast< short >( params[3] );
|
||||
|
||||
#if defined( __linux__ )
|
||||
offset += params[4];
|
||||
#elif defined( __APPLE__ )
|
||||
// Use Linux offset in older plugins
|
||||
if( params[0] / sizeof( cell ) == 4 )
|
||||
offset += params[4];
|
||||
else
|
||||
offset += params[5];
|
||||
#endif
|
||||
|
||||
*( short* )( ( char* )INDEXENT2( index )->pvPrivateData + offset ) = value;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL get_pdata_vector( AMX *amx, cell *params )
|
||||
{
|
||||
int index = params[1];
|
||||
CHECK_ENTITY( index );
|
||||
|
||||
int offset = params[2];
|
||||
CHECK_OFFSET( offset );
|
||||
|
||||
#if defined( __linux__ )
|
||||
offset += params[4];
|
||||
#elif defined( __APPLE__ )
|
||||
// Use Linux offset in older plugins
|
||||
if( params[0] / sizeof( cell ) == 4 )
|
||||
offset += params[4];
|
||||
else
|
||||
offset += params[5];
|
||||
#endif
|
||||
|
||||
cell *cpvec = MF_GetAmxAddr( amx, params[3] );
|
||||
|
||||
Vector vec = *( Vector* )( ( char* )INDEXENT2( index )->pvPrivateData + offset );
|
||||
|
||||
cpvec[0] = amx_ftoc( vec.x );
|
||||
cpvec[1] = amx_ftoc( vec.y );
|
||||
cpvec[2] = amx_ftoc( vec.z );
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL set_pdata_vector( AMX *amx, cell *params )
|
||||
{
|
||||
int index = params[1];
|
||||
CHECK_ENTITY( index );
|
||||
|
||||
int offset = params[2];
|
||||
CHECK_OFFSET( offset );
|
||||
|
||||
#if defined( __linux__ )
|
||||
offset += params[4];
|
||||
#elif defined( __APPLE__ )
|
||||
// Use Linux offset in older plugins
|
||||
if( params[0] / sizeof( cell ) == 4 )
|
||||
offset += params[4];
|
||||
else
|
||||
offset += params[5];
|
||||
#endif
|
||||
|
||||
cell *pcvec = MF_GetAmxAddr( amx, params[3] );
|
||||
|
||||
Vector vec( amx_ctof( pcvec[0] ), amx_ctof( pcvec[1] ), amx_ctof( pcvec[2] ) );
|
||||
|
||||
*( Vector* )( ( char* )INDEXENT2( index )->pvPrivateData + offset ) = vec;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL get_pdata_ehandle( AMX *amx, cell *params )
|
||||
{
|
||||
int index = params[1];
|
||||
CHECK_ENTITY( index );
|
||||
|
||||
int offset = params[2];
|
||||
CHECK_OFFSET( offset );
|
||||
|
||||
#if defined( __linux__ )
|
||||
offset += params[3];
|
||||
#elif defined( __APPLE__ )
|
||||
// Use Linux offset in older plugins
|
||||
if( params[0] / sizeof( cell ) == 3 )
|
||||
offset += params[3];
|
||||
else
|
||||
offset += params[4];
|
||||
#endif
|
||||
|
||||
edict_t *pEdict = *( edict_t** )( ( char* )( INDEXENT2( index )->pvPrivateData ) + offset );
|
||||
|
||||
if( pEdict == NULL )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
edict_t *pWorld = INDEXENT( 0 );
|
||||
int ent = pEdict - pWorld;
|
||||
|
||||
if( ent < 0 || ent > gpGlobals->maxEntities )
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
|
||||
if( pEdict->free || pEdict->pvPrivateData == NULL )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
int serialnumber = *( int* )( ( char* )INDEXENT2( index )->pvPrivateData + offset + 4 );
|
||||
|
||||
if( pEdict->serialnumber != serialnumber )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ent;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL set_pdata_ehandle( AMX *amx, cell *params )
|
||||
{
|
||||
int index = params[1];
|
||||
CHECK_ENTITY( index );
|
||||
|
||||
int offset = params[2];
|
||||
CHECK_OFFSET( offset );
|
||||
|
||||
int entity = params[3];
|
||||
CHECK_ENTITY( entity );
|
||||
|
||||
#if defined( __linux__ )
|
||||
offset += params[4];
|
||||
#elif defined( __APPLE__ )
|
||||
// Use Linux offset in older plugins
|
||||
if( params[0] / sizeof( cell ) == 4 )
|
||||
offset += params[4];
|
||||
else
|
||||
offset += params[5];
|
||||
#endif
|
||||
|
||||
edict_t *pEntity = INDEXENT2( entity );
|
||||
|
||||
*( edict_t** )( ( char* )( INDEXENT2( index )->pvPrivateData ) + offset ) = pEntity;
|
||||
|
||||
if( pEntity )
|
||||
{
|
||||
*( int* )( ( char* )INDEXENT2( index )->pvPrivateData + offset + 4 ) = pEntity->serialnumber;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
AMX_NATIVE_INFO pdata_natives[] =
|
||||
{
|
||||
{ "get_pdata_int", get_pdata_int },
|
||||
|
@ -243,5 +549,16 @@ AMX_NATIVE_INFO pdata_natives[] =
|
|||
{ "set_pdata_string", set_pdata_string },
|
||||
{ "get_pdata_string", get_pdata_string },
|
||||
{ "get_pdata_ent", get_pdata_ent },
|
||||
{ "set_pdata_ent", set_pdata_ent },
|
||||
{ "get_pdata_bool", get_pdata_bool },
|
||||
{ "set_pdata_bool", set_pdata_bool },
|
||||
{ "get_pdata_byte", get_pdata_byte },
|
||||
{ "set_pdata_byte", set_pdata_byte },
|
||||
{ "get_pdata_short", get_pdata_short },
|
||||
{ "set_pdata_short", set_pdata_short },
|
||||
{ "get_pdata_vector", get_pdata_vector },
|
||||
{ "set_pdata_vector", set_pdata_vector },
|
||||
{ "get_pdata_ehandle", get_pdata_ehandle },
|
||||
{ "set_pdata_ehandle", set_pdata_ehandle },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
|
|
@ -98,23 +98,82 @@ native pev_serial(entindex);
|
|||
*/
|
||||
native global_get(_value, any:...);
|
||||
|
||||
/* Returns an integer from private data. _linuxdiff is added into the _Offset if it's used on a linux server. */
|
||||
/**
|
||||
* Returns a integer from an entity's private data.
|
||||
*
|
||||
* _linuxdiff value is what to add to the _Offset for linux servers.
|
||||
* _macdiff value is what to add to the _Offset for os x servers.
|
||||
*
|
||||
* A log error is thrown on invalid _index and _Offset.
|
||||
*
|
||||
* @param _index Entity index.
|
||||
* @param _Offset Offset to search.
|
||||
* @param _linuxdiff Linux difference.
|
||||
* @param _macdiff Mac OS X difference.
|
||||
* @return An integer value is returned.
|
||||
*/
|
||||
native get_pdata_int( _index, _Offset, _linuxdiff = 5, _macdiff = 5 );
|
||||
|
||||
/* Sets an integer from private data. _linuxdiff is added into the _Offset if it's used on a linux server. */
|
||||
/**
|
||||
* Sets an integer to an entity's private data.
|
||||
*
|
||||
* _linuxdiff value is what to add to the _Offset for linux servers.
|
||||
* _macdiff value is what to add to the _Offset for os x servers.
|
||||
*
|
||||
* A log error is thrown on invalid _index and _Offset.
|
||||
*
|
||||
* @param _index Entity index.
|
||||
* @param _Offset Offset to search.
|
||||
* @param _Value Value to set.
|
||||
* @param _linuxdiff Linux difference.
|
||||
* @param _macdiff Mac OS X difference.
|
||||
* @return 1 on success.
|
||||
*/
|
||||
native set_pdata_int( _index, _Offset, _Value, _linuxdiff = 5, _macdiff = 5 );
|
||||
|
||||
/* Returns a float from private data. _linuxdiff is added into the _Offset if it's used on a linux server. */
|
||||
/**
|
||||
* Returns a float from an entity's private data.
|
||||
*
|
||||
* _linuxdiff value is what to add to the _Offset for linux servers.
|
||||
* _macdiff value is what to add to the _Offset for os x servers.
|
||||
*
|
||||
* A log error is thrown on invalid _index and _Offset.
|
||||
*
|
||||
* @param _index Entity index.
|
||||
* @param _Offset Offset to search.
|
||||
* @param _linuxdiff Linux difference.
|
||||
* @param _macdiff Mac OS X difference.
|
||||
* @return An float value is returned.
|
||||
*/
|
||||
native Float:get_pdata_float( _index, _Offset, _linuxdiff = 5, _macdiff = 5 );
|
||||
|
||||
/* Sets a float from private data. _linuxdiff is added into the _Offset if it's used on a linux server. */
|
||||
/**
|
||||
* Sets a float to an entity's private data.
|
||||
*
|
||||
* _linuxdiff value is what to add to the _Offset for linux servers.
|
||||
* _macdiff value is what to add to the _Offset for os x servers.
|
||||
*
|
||||
* A log error is thrown on invalid _index and _Offset.
|
||||
*
|
||||
* @param _index Entity index.
|
||||
* @param _Offset Offset to search.
|
||||
* @param _Value Value to set.
|
||||
* @param _linuxdiff Linux difference.
|
||||
* @param _macdiff Mac OS X difference.
|
||||
* @return 1 on success.
|
||||
*/
|
||||
native set_pdata_float( _index, _Offset, Float:_Value, _linuxdiff = 5, _macdiff = 5 );
|
||||
|
||||
/**
|
||||
* Tries to retrieve an edict (entity encapsulation) pointer from an entity's private data.
|
||||
* Tries to retrieve an edict pointer from an entity's private data.
|
||||
*
|
||||
* This function is byte-addressable. Unlike get_pdata_int() which searches in byte increments of 4,
|
||||
* get_pdata_end searches in increments of 1.
|
||||
* get_pdata_ent searches in increments of 1.
|
||||
*
|
||||
* _linuxdiff value is what to add to the _offset for linux servers.
|
||||
* _macdiff value is what to add to the _offset for os x servers.
|
||||
*
|
||||
* A log error is thrown on invalid _index and _Offset.
|
||||
*
|
||||
* @param _index Entity index.
|
||||
* @param _offset Offset to search.
|
||||
|
@ -126,6 +185,225 @@ native set_pdata_float(_index,_Offset,Float:_Value,_linuxdiff=5,_macdiff=5);
|
|||
*/
|
||||
native get_pdata_ent( _index, _offset, _linuxdiff = 20, _macdiff = 20 );
|
||||
|
||||
/**
|
||||
* Sets an edict pointer to an entity's private data.
|
||||
*
|
||||
* This function is byte-addressable. Unlike set_pdata_int() which searches in byte increments of 4,
|
||||
* set_pdata_ent searches in increments of 1.
|
||||
*
|
||||
* _linuxdiff value is what to add to the _offset for linux servers.
|
||||
* _macdiff value is what to add to the _offset for os x servers.
|
||||
*
|
||||
* A log error is thrown on invalid _index and _offset.
|
||||
*
|
||||
* @param _index Entity index.
|
||||
* @param _offset Offset to search.
|
||||
* @param _value Value to set.
|
||||
* @param _linuxdiff Linux difference.
|
||||
* @param _macdiff Mac OS X difference.
|
||||
* @return 1 on success.
|
||||
*/
|
||||
native set_pdata_ent( _index, _offset, _value, _linuxdiff = 20, _macdiff = 20 );
|
||||
|
||||
/**
|
||||
* Returns a boolean from an entity's private data.
|
||||
*
|
||||
* This function is byte-addressable. Unlike get_pdata_int() which searches in byte increments of 4,
|
||||
* get_pdata_bool searches in increments of 1.
|
||||
*
|
||||
* _linuxdiff value is what to add to the _offset for linux servers.
|
||||
* _macdiff value is what to add to the _offset for os x servers.
|
||||
*
|
||||
* A log error is thrown on invalid _index and _offset.
|
||||
*
|
||||
* @param _index Entity index.
|
||||
* @param _offset Offset to search.
|
||||
* @param _linuxdiff Linux difference.
|
||||
* @param _macdiff Mac OS X difference.
|
||||
* @return An boolean value is returned.
|
||||
*/
|
||||
native bool:get_pdata_bool( _index, _offset, _linuxdiff = 20, _macdiff = 20 );
|
||||
|
||||
/**
|
||||
* Sets a boolean to an entity's private data.
|
||||
*
|
||||
* This function is byte-addressable. Unlike set_pdata_int() which searches in byte increments of 4,
|
||||
* set_pdata_bool searches in increments of 1.
|
||||
*
|
||||
* _linuxdiff value is what to add to the _offset for linux servers.
|
||||
* _macdiff value is what to add to the _offset for os x servers.
|
||||
*
|
||||
* A log error is thrown on invalid _index and _offset.
|
||||
*
|
||||
* @param _index Entity index.
|
||||
* @param _offset Offset to search.
|
||||
* @param _value Value to set.
|
||||
* @param _linuxdiff Linux difference.
|
||||
* @param _macdiff Mac OS X difference.
|
||||
* @return 1 on success.
|
||||
*/
|
||||
native set_pdata_bool( _index, _offset, bool:_value, _linuxdiff = 20, _macdiff = 20 );
|
||||
|
||||
/**
|
||||
* Returns a byte value from an entity's private data.
|
||||
*
|
||||
* This function is byte-addressable. Unlike get_pdata_int() which searches in byte increments of 4,
|
||||
* get_pdata_byte searches in increments of 1.
|
||||
*
|
||||
* _linuxdiff value is what to add to the _offset for linux servers.
|
||||
* _macdiff value is what to add to the _offset for os x servers.
|
||||
*
|
||||
* A log error is thrown on invalid _index and _offset.
|
||||
*
|
||||
* @param _index Entity index.
|
||||
* @param _offset Offset to search.
|
||||
* @param _linuxdiff Linux difference.
|
||||
* @param _macdiff Mac OS X difference.
|
||||
* @return A byte value is returned.
|
||||
*/
|
||||
native get_pdata_byte( _index, _offset, _linuxdiff = 20, _macdiff = 20 );
|
||||
|
||||
/**
|
||||
* Sets a byte value to an entity's private data.
|
||||
*
|
||||
* This function is byte-addressable. Unlike set_pdata_int() which searches in byte increments of 4,
|
||||
* set_pdata_byte searches in increments of 1.
|
||||
*
|
||||
* _linuxdiff value is what to add to the _offset for linux servers.
|
||||
* _macdiff value is what to add to the _offset for os x servers.
|
||||
*
|
||||
* A log error is thrown on invalid _index and _offset.
|
||||
*
|
||||
* @param _index Entity index.
|
||||
* @param _offset Offset to search.
|
||||
* @param _value Value to set.
|
||||
* @param _linuxdiff Linux difference.
|
||||
* @param _macdiff Mac OS X difference.
|
||||
* @return 1 on success.
|
||||
*/
|
||||
native set_pdata_byte( _index, _offset, _value, _linuxdiff = 20, _macdiff = 20 );
|
||||
|
||||
/**
|
||||
* Returns a short value from an entity's private data.
|
||||
*
|
||||
* This function is byte-addressable. Unlike get_pdata_int() which searches in byte increments of 4,
|
||||
* get_pdata_short searches in increments of 1.
|
||||
*
|
||||
* _linuxdiff value is what to add to the _offset for linux servers.
|
||||
* _macdiff value is what to add to the _offset for os x servers.
|
||||
*
|
||||
* A log error is thrown on invalid _index and _offset.
|
||||
*
|
||||
* @param _index Entity index.
|
||||
* @param _offset Offset to search.
|
||||
* @param _linuxdiff Linux difference.
|
||||
* @param _macdiff Mac OS X difference.
|
||||
* @return A short value is returned.
|
||||
*/
|
||||
native get_pdata_short( _index, _offset, _linuxdiff = 20, _macdiff = 20 );
|
||||
|
||||
/**
|
||||
* Sets a short value to an entity's private data.
|
||||
*
|
||||
* This function is byte-addressable. Unlike set_pdata_int() which searches in byte increments of 4,
|
||||
* set_pdata_short searches in increments of 1.
|
||||
*
|
||||
* _linuxdiff value is what to add to the _offset for linux servers.
|
||||
* _macdiff value is what to add to the _offset for os x servers.
|
||||
*
|
||||
* A log error is thrown on invalid _index and _offset.
|
||||
*
|
||||
* @param _index Entity index.
|
||||
* @param _offset Offset to search.
|
||||
* @param _value Value to set.
|
||||
* @param _linuxdiff Linux difference.
|
||||
* @param _macdiff Mac OS X difference.
|
||||
* @return 1 on success.
|
||||
*/
|
||||
native set_pdata_short( _index, _offset, _value, _linuxdiff = 20, _macdiff = 20 );
|
||||
|
||||
/**
|
||||
* Returns a vector from an entity's private data.
|
||||
*
|
||||
* This function is byte-addressable. Unlike get_pdata_int() which searches in byte increments of 4,
|
||||
* get_pdata_vector searches in increments of 1.
|
||||
*
|
||||
* _linuxdiff value is what to add to the _offset for linux servers.
|
||||
* _macdiff value is what to add to the _offset for os x servers.
|
||||
*
|
||||
* A log error is thrown on invalid _index and _offset.
|
||||
*
|
||||
* @param _index Entity index.
|
||||
* @param _offset Offset to search.
|
||||
* @param _output Vector returned by reference.
|
||||
* @param _linuxdiff Linux difference.
|
||||
* @param _macdiff Mac OS X difference.
|
||||
* @return 1 on success.
|
||||
*/
|
||||
native get_pdata_vector( _index, _offset, Float:_output[3], _linuxdiff = 20, _macdiff = 20 );
|
||||
|
||||
/**
|
||||
* Sets a vector to an entity's private data.
|
||||
*
|
||||
* This function is byte-addressable. Unlike set_pdata_int() which searches in byte increments of 4,
|
||||
* set_pdata_vector searches in increments of 1.
|
||||
*
|
||||
* _linuxdiff value is what to add to the _offset for linux servers.
|
||||
* _macdiff value is what to add to the _offset for os x servers.
|
||||
*
|
||||
* A log error is thrown on invalid _index and _Offset.
|
||||
*
|
||||
* @param _index Entity index.
|
||||
* @param _offset Offset to search.
|
||||
* @param _origin Value to set.
|
||||
* @param _linuxdiff Linux difference.
|
||||
* @param _macdiff Mac OS X difference.
|
||||
* @return 1 on success.
|
||||
*/
|
||||
native set_pdata_vector( _index, _offset, Float:_origin[3], _linuxdiff = 20, _macdiff = 20 );
|
||||
|
||||
/**
|
||||
* Tries to retrieve an edict (entity encapsulation) pointer from an entity's private data.
|
||||
*
|
||||
* This function is byte-addressable. Unlike get_pdata_int() which searches in byte increments of 4,
|
||||
* get_pdata_ehandle searches in increments of 1.
|
||||
*
|
||||
* _linuxdiff value is what to add to the _offset for linux servers.
|
||||
* _macdiff value is what to add to the _offset for os x servers.
|
||||
*
|
||||
* A log error is thrown on invalid _index and _offset.
|
||||
*
|
||||
* @param _index Entity index.
|
||||
* @param _offset Offset to search.
|
||||
* @param _linuxdiff Linux difference.
|
||||
* @param _macdiff Mac OS X difference.
|
||||
* @return -2 if an invalid entity was found.
|
||||
* -1 if an empty entity was found.
|
||||
* 0 if serialnumber is not matching.
|
||||
* Otherwise, an entity index is returned.
|
||||
*/
|
||||
native get_pdata_ehandle( _index, _offset, _linuxdiff = 20, _macdiff = 20 );
|
||||
|
||||
/**
|
||||
* Sets an edict (entity encapsulation) pointer to an entity's private data.
|
||||
*
|
||||
* This function is byte-addressable. Unlike set_pdata_int() which searches in byte increments of 4,
|
||||
* set_pdata_ehandle searches in increments of 1.
|
||||
*
|
||||
* _linuxdiff value is what to add to the _offset for linux servers.
|
||||
* _macdiff value is what to add to the _offset for os x servers.
|
||||
*
|
||||
* A log error is thrown on invalid _index and _Offset.
|
||||
*
|
||||
* @param _index Entity index.
|
||||
* @param _offset Offset to search.
|
||||
* @param _value Value to set.
|
||||
* @param _linuxdiff Linux difference.
|
||||
* @param _macdiff Mac OS X difference.
|
||||
* @return 1 on success.
|
||||
*/
|
||||
native set_pdata_ehandle( _index, _offset, _value, _linuxdiff = 20, _macdiff = 20 );
|
||||
|
||||
/* Registers a forward.
|
||||
* Returns an id you can pass to unregister_forward
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue
Block a user