Fakemeta
Содержание
- 1 fakemeta.inc
- 1.1 pev
- 1.2 set_pev
- 1.3 set_pev_string
- 1.4 pev_valid
- 1.5 pev_serial
- 1.6 global_get
- 1.7 get_pdata_int
- 1.8 set_pdata_int
- 1.9 get_pdata_float
- 1.10 set_pdata_float
- 1.11 get_pdata_ent
- 1.12 register_forward
- 1.13 unregister_forward
- 1.14 forward_return
- 1.15 get_orig_retval
- 1.16 engfunc
- 1.17 dllfunc
- 1.18 get_tr
- 1.19 set_tr
- 1.20 get_tr2
- 1.21 set_tr2
- 1.22 create_tr2
- 1.23 free_tr2
- 1.24 get_kvd
- 1.25 set_kvd
- 1.26 get_cd
- 1.27 set_cd
- 1.28 get_es
- 1.29 set_es
- 1.30 get_uc
- 1.31 set_uc
- 1.32 get_pdata_string
- 1.33 set_pdata_string
- 1.34 copy_infokey_buffer
- 1.35 lookup_sequence
- 1.36 set_controller
- 2 fakemeta_stocks.inc
- 3 fakemeta_util.inc
fakemeta.inc
pev
Возвращает данные указанного объекта. Используйте перечисленные pev_* значения в fakemeta_const.inc, чтобы указать, какие данные получить.
native pev(_index,_value,any:...);
_index | ID объекта |
_value | Pev данные, которые нужно получить (смотри константы Fakemeta). |
Примечание: This function uses "read_data" style data syntax. It returns integer values, by-references float data, and sets a buffer for string data.
If retrieving strings, you may optionally get a pointer into the global string table. Depending on your situation, there are two ways to do this.
- This simply gets the pointer.
new ptr = pev(entid, pev_classname)
- The pointer will be stored in ptr AND the actual string is retrieved.
new ptr, classname[32] pev(entid, pev_classname, ptr, classname, 31)
set_pev
Задает данные указанного объекта/энтити-объекта. Используйте перечисленные pev_* значения в fakemeta_const.inc, чтобы указать, какие данные получить.
native set_pev(_index,_value,any:...);
_index | ID объекта |
_value | Pev данные, которые нужно задать (смотри константы Fakemeta). |
Примечание: Setting string data will automatically allocate a new string (via AllocString) If you have a string already allocated with your own call to AllocString, use set_pev_string_ptr instead.
set_pev_string
Use this native to set a pev field to a string that is already allocated (via a function such as EngFunc_AllocString).
native set_pev_string(_index, _value, _string);
_index | The entity index to set the value on. |
_value | The pev field to set - MUST be a string field. |
_string | The string handle, retrieved from places like AllocString. |
Примечание: If you specify _value as anything other than string fields, an error will be thrown.
Примечание: Pass 0 as the _string field to set it to an empty string.
pev_valid
Проверяет объект на валидность. Возвращает 0 в случае не валидности энтити, 1 в случае валидности, 2 в случае валидности and it has private data (safe to use pdata natives on).
native pev_valid(entindex);
entindex | Идентификатор энтити |
pev_serial
Returns the serial number for each entity. The serial number is a unique identity generated when an entity is created.
native pev_serial(entindex);
entindex | Идентификатор энтити |
global_get
Returns any global variable inside globalvars_t structure. Use the glb_* enum. When returning data from glb_pStringBase (the global string table), you may give a pointer into that table in order to get different strings.
native global_get(_value, any:...);
Пример:
new model[128]; new ptr = pev(id, pev_viewmodel); global_get(glb_pStringBase, ptr, model, 127);
get_pdata_int
Returns an integer from private data. _linuxdiff is added into the _Offset if it's used on a linux server.
native get_pdata_int(_index,_Offset,_linuxdiff=5);
set_pdata_int
Sets an integer from private data. _linuxdiff is added into the _Offset if it's used on a linux server.
native set_pdata_int(_index,_Offset,_Value,_linuxdiff=5);
get_pdata_float
Returns a float from private data. _linuxdiff is added into the _Offset if it's used on a linux server.
native Float:get_pdata_float(_index,_Offset,_linuxdiff=5);
set_pdata_float
Sets a float from private data. _linuxdiff is added into the _Offset if it's used on a linux server.
native set_pdata_float(_index,_Offset,Float:_Value,_linuxdiff=5);
get_pdata_ent
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,
Возвращает -2 если энтити не найдена. -1 если найдена пустой энтити-объект. Otherwise, an entity index is returned.
native get_pdata_ent(_index, _offset, _linuxdiff=20);
_index | Entity index |
_offset | Offset to search |
_linuxdiff | Linux difference |
register_forward
Registers a forward. Returns an id you can pass to unregister_forward.
native register_forward(_forwardType,const _function[],_post=0);
unregister_forward
Unregisters a forward. The registerId must be from register_forward, and post/forwardtype must match what you registered the forward as.
native unregister_forward(_forwardType, registerId, post=0);
forward_return
Returns data for metamod
native forward_return(type,any:...);
get_orig_retval
Returns the original return value of an engine function. This is only valid in forwards that were registered as post.
native get_orig_retval({Float,_}:...);
get_orig_retval() - no params, retrieves integer return value get_orig_retval(&Float:value) - retrieves float return value by reference get_orig_retval(value[], len) - retrives string return value
engfunc
native engfunc(type,any:...);
dllfunc
native dllfunc(type,any:...);
get_tr
only use this with functions that pass a Trace
native get_tr(TraceResult:tr_member, {Float,_}:...);
set_tr
native set_tr(TraceResult:tr_member, {Float,_}:...);
get_tr2
Upgraded version takes in a TraceResult handle, optionally passed in as the last parameter to the TraceResult forward. Use 0 to specify the global traceresult handle set from calling some of the Engfucs.
native get_tr2(tr_handle, {TraceResult,_}:tr_member, {Float,_}:...);
set_tr2
native set_tr2(tr_handle, {TraceResult,_}:tr_member, {Float,_}:...);
create_tr2
Creates a traceresult handle. This value should never be altered. The handle can be used in get/set_tr2 and various traceresult engine functions. Return A new TraceResult handle.
native create_tr2();
Примечание: You must call free_tr2() on every handle made with create_tr2().
free_tr2
Frees a traceresult handle created with free_tr2(). Do not call this more than once per handle, or on handles not created through create_tr2().
native free_tr2(tr_handle);
tr_handle | TraceResult handle created via create_tr2(). |
get_kvd
Same as above, use either a kvd_handle or 0 for global reserved kvd data kvd_handle is passed by the kvd hook, last param
native get_kvd(kvd_handle, KeyValueData:member, {Float,_}:...);
set_kvd
Using set_kvd with the handle from the hook for anything under KV_fHandled is considered an undefined operation (it could crash). You should fire a new keyvalues structure rather than changing the internal engine strings.
native set_kvd(kvd_handle, KeyValueData:member, {Float,_}:...);
get_cd
These functions are used with the clientdata data structure (FM_UpdateClientData) Get: 0 extra params - Return integer; 1 extra param - by ref float or vector; 2 extra params - string and length. Use 0 for cd_handle to specify the global clientdata handle
native get_cd(cd_handle, ClientData:member, {Float,_}:...);
set_cd
Set: Use anything. Use 0 for cd_handle to specify the global clientdata handle
native set_cd(cd_handle, ClientData:member, {Float,_}:...);
get_es
These functions are used with the entity_state data structure (FM_AddToFullPack). Get: 0 extra params - Return integer; 1 extra param - by ref float or vector or array. Use 0 for es_handle to specify the global entity_state handle
native get_es(es_handle, EntityState:member, {Float,_}:...);
set_es
Set: Use anything. Use 0 for es_handle to specify the global entity_state handle.
native set_es(es_handle, EntityState:member, {Float,_}:...);
get_uc
These functions are used with the usercmd data structure (FM_CmdStart) Get: 0 extra params - Return integer; 1 extra param - by ref float or vector Use 0 for uc_handle to specify the global usercmd handle
native get_uc(uc_handle, UserCmd:member, {Float,_}:...);
set_uc
Set: Use anything. Use 0 for uc_handle to specify the global usercmd handle.
native set_uc(uc_handle, UserCmd:member, {Float,_}:...);
get_pdata_string
In fact it's QWORD aligned rather than DWORD aligned, so the offset will be exactly half. Gets a string from a private offset. If byref is false, the string is treated as static rather than dynamic. linux value is what to add to the offset for linux servers. This cannot use a default value due to older version using an awkward default value.
native get_pdata_string(entity, offset, dest[], maxlength, byref=1, linux);
Примечание: that for the string offsets below, on AMD64, a byref (char **) offset is NOT the same as an int offset
set_pdata_string
Sets a string in a private offset. realloc = -1 - nonbyref copy (static realloc = 0 - copy byref, no realloc *(char **) realloc = 1 - reallocate new string with free+malloc realloc = 2 - reallocate new string with delete[]+new[] linux value is what to add to the offset for linux servers. this cannot use a default value due to older version using an awkward default value.
native set_pdata_string(entity, offset, const source[], realloc=2, linux);
copy_infokey_buffer
Copies the given infoBuffer pointer into out[] An infoBuffer pointer is returned by EngFunc_GetInfoKeyBuffer
native copy_infokey_buffer(infoBuffer, out[], maxlen);
lookup_sequence
Looks up the sequence for the entity. Return -1 on failed lookup, the sequence number on successful lookup.
native lookup_sequence(entity, const name[], &Float:framerate = 0.0, &bool:loops = false, &Float:groundspeed = 0.0);
entity | The entity id to lookup. |
name | The sequence name to lookup, case insensitive. ("JUMP" would match "jump") |
framerate | The framerate of the sequence, if found. |
loops | Whether or not the sequence loops. |
groundspeed | The groundspeed setting of the sequence. |
set_controller
Sets a bone controller with the specified value. Return The percentage that the controller is extended (0.0 through 1.0)
native Float:set_controller(entity, controller, Float:value);
entity | The entity id to set the value on. |
controller | Which controller to set (0 through 3). |
value | The value to set it to. |