[Half-Life AMXX] / include / fakemeta.inc Repository:
ViewVC logotype

Annotation of /include/fakemeta.inc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (view) (download)

1 : ian 1 /* FakeMeta functions
2 :     *
3 :     * by the AMX Mod X Development Team
4 :     *
5 :     * This file is provided as is (no warranties).
6 :     */
7 :    
8 :     #if defined _fakemeta_included
9 :     #endinput
10 :     #endif
11 :     #define _fakemeta_included
12 :    
13 :     #include <fakemeta_const>
14 :    
15 :     #if AMXX_VERSION_NUM >= 175
16 :     #pragma reqlib fakemeta
17 :     #if !defined AMXMODX_NOAUTOLOAD
18 :     #pragma loadlib fakemeta
19 :     #endif
20 :     #else
21 :     #pragma library fakemeta
22 :     #endif
23 :    
24 :     /* Returns entvar data from an entity Use the pev_* enum to specify which form of data you want returned.
25 :     *
26 :     * If retrieving strings, you may optionally get a pointer into the global string table. Depending on
27 :     * your situation, there are two ways to do this.
28 :     * 1: This simply gets the pointer.
29 :     * new ptr = pev(entid, pev_classname)
30 :     * 2: The pointer will be stored in ptr AND the actual string is retrieved.
31 :     * new ptr, classname[32]
32 :     * pev(entid, pev_classname, ptr, classname, 31)
33 :     */
34 :     native pev(_index,_value,{Float,Sql,Result,_}:...);
35 :    
36 :     /* Sets entvar data for an entity. Use the pev_* enum */
37 :     native set_pev(_index,_value,{Float,Sql,Result,_}:...);
38 :    
39 :     /* returns 0 if ent is invalid, >0 if valid
40 :     * (1 == valid, 2 == valid+pvPrivateData valid)
41 :     */
42 :     native pev_valid(entindex);
43 :    
44 :     /* Returns any global variable inside globalvars_t structure. Use the glb_* enum.
45 :     *
46 :     * When returning data from glb_pStringBase (the global string table), you may give a pointer into that table
47 :     * in order to get different strings.
48 :     * Example:
49 :     * new model[128]
50 :     * new ptr = pev(id, pev_viewmodel)
51 :     * global_get(glb_pStringBase, ptr, model, 127)
52 :     */
53 :     native global_get(_value, {Float,Sql,Result,_}:...);
54 :    
55 :     /* Returns an integer from private data. _linuxdiff is added into the _Offset if it's used on a linux server. */
56 :     native get_pdata_int(_index,_Offset,_linuxdiff=5);
57 :    
58 :     /* Sets an integer from private data. _linuxdiff is added into the _Offset if it's used on a linux server. */
59 :     native set_pdata_int(_index,_Offset,_Value,_linuxdiff=5);
60 :    
61 :     /* Returns a float from private data. _linuxdiff is added into the _Offset if it's used on a linux server. */
62 :     native Float:get_pdata_float(_index,_Offset,_linuxdiff=5);
63 :    
64 :     /* Sets a float from private data. _linuxdiff is added into the _Offset if it's used on a linux server. */
65 :     native set_pdata_float(_index,_Offset,Float:_Value,_linuxdiff=5);
66 :    
67 :    
68 :     /* Registers a forward.
69 :     * Returns an id you can pass to unregister_forward
70 :     */
71 :     native register_forward(_forwardType,const _function[],_post=0);
72 :    
73 :     /* Unregisters a forward.
74 :     * The registerId must be from register_forward, and
75 :     * post/forwardtype must match what you registered the forward as.
76 :     */
77 :     native unregister_forward(_forwardType, registerId, post=0);
78 :    
79 :     /* Returns data for metamod */
80 :     native forward_return(type,{Float,Sql,Result,_}:...);
81 :    
82 :     /* Returns the original return value of an engine function.
83 :     * This is only valid in forwards that were registered as post.
84 :     *
85 :     * get_orig_retval() - no params, retrieves integer return value
86 :     * get_orig_retval(&Float:value) - retrieves float return value by reference
87 :     * get_orig_retval(value[], len) - retrives string return value
88 :     */
89 :     native get_orig_retval({Float,_}:...);
90 :    
91 :     native engfunc(type,{Float,Sql,Result,AlertType,_}:...);
92 :     native dllfunc(type,{Float,Sql,Result,_}:...);
93 :    
94 :     //only use this with functions that pass a Trace
95 :     // get: zero extra params - return int, one extra param = byref float or vector
96 :     // set: use anything
97 :     native get_tr(TraceResult:tr_member, {Float,_}:...);
98 :     native set_tr(TraceResult:tr_member, {Float,_}:...);
99 :    
100 :     //Upgraded version takes in a TraceResult handle, optionally passed in as the last parameter to the
101 :     //TraceResult forward. Use 0 to specify the global traceresult handle set from calling
102 :     // some of the Engfucs.
103 :     native get_tr2(tr_handle, TraceResult:tr_member, {Float,_}:...);
104 :     native set_tr2(tr_handle, TraceResult:tr_member, {Float,_}:...);
105 :    
106 :     //Same as above, use either a kvd_handle or 0 for global reserved kvd data
107 :     //kvd_handle is passed by the kvd hook, last param
108 :     native get_kvd(kvd_handle, KeyValueData:member, {Float,_}:...);
109 :    
110 :     //Using set_kvd with the handle from the hook for anything under KV_fHandled
111 :     // is considered an undefined operation (it could crash). You should fire a new
112 :     // keyvalues structure rather than changing the internal engine strings.
113 :     native set_kvd(kvd_handle, KeyValueData:member, {Float,_}:...);
114 :    
115 :     // These functions are used with the clientdata data structure (FM_UpdateClientData)
116 :     // Get: 0 extra params - Return integer; 1 extra param - by ref float or vector; 2 extra params - string and length
117 :     // Set: Use anything
118 :     // Use 0 for cd_handle to specify the global clientdata handle
119 :     native get_cd(cd_handle, ClientData:member, {Float,_}:...);
120 :     native set_cd(cd_handle, ClientData:member, {Float,_}:...);
121 :    
122 :     // These functions are used with the entity_state data structure (FM_AddToFullPack)
123 :     // Get: 0 extra params - Return integer; 1 extra param - by ref float or vector or array
124 :     // Set: Use anything
125 :     // Use 0 for es_handle to specify the global entity_state handle
126 :     native get_es(es_handle, EntityState:member, {Float,_}:...);
127 :     native set_es(es_handle, EntityState:member, {Float,_}:...);
128 :    
129 :     // These functions are used with the usercmd data structure (FM_CmdStart)
130 :     // Get: 0 extra params - Return integer; 1 extra param - by ref float or vector
131 :     // Set: Use anything
132 :     // Use 0 for uc_handle to specify the global usercmd handle
133 :     native get_uc(uc_handle, UserCmd:member, {Float,_}:...);
134 :     native set_uc(uc_handle, UserCmd:member, {Float,_}:...);
135 :    
136 :     //NOTE that for the string offsets below, on AMD64, a byref (char **) offset is NOT the same as an int offset
137 :     //In fact it's QWORD aligned rather than DWORD aligned, so the offset will be exactly half.
138 :     //Gets a string from a private offset. If byref is false, the string is treated as static rather than dynamic.
139 :     native get_pdata_string(entity, offset, dest[], maxlength, byref=1, linux=-5);
140 :    
141 :     //Sets a string in a private offset.
142 :     //realloc = -1 - nonbyref copy (static
143 :     //realloc = 0 - copy byref, no realloc *(char **)
144 :     //realloc = 1 - reallocate new string with free+malloc
145 :     //realloc = 2 - reallocate new string with delete[]+new[]
146 :     native set_pdata_string(entity, offset, const source[], realloc=2, linux=-5);
147 :    
148 :     // Copies the given infoBuffer pointer into out[]
149 :     // An infoBuffer pointer is returned by EngFunc_GetInfoKeyBuffer
150 :     native copy_infokey_buffer(infoBuffer, out[], maxlen);

Contact
ViewVC Help
Powered by ViewVC 1.0.4