AMXX-BG.INFO orpheu.inc Raw include

orpheu.inc

Original include source with line numbers.

Back Download .inc
1
2 #if defined _orpheu_included
3 #endinput
4 #endif
5 #define _orpheu_included
6
7 #include <orpheu_const>
8
9 /**
10 * Retrieves a function based on a function name
11 * The name must be the same as the one in the file where the function is defined
12 *
13 * @param libFunctionName The name of the function as it is in the file where the function is defined
14 * @param className The name of the class if the function belongs to one
15 *
16 * @return A handler to the function
17 */
18 native OrpheuFunction:OrpheuGetFunction(const libFunctionName[],const className[]="")
19
20 /**
21 * Hooks a function
22 *
23 * @param function A handler to the function
24 * @param hookFunctionName The function name in the plugin that shall be called upon interception of the original function
25 * @param phase The phase of the hook. It can have two values. Pre means "right before the original function is called". Post means "right after the original function is called"
26 *
27 * @return A handler to the hook
28 */
29 native OrpheuHook:OrpheuRegisterHook(OrpheuFunction:function,const hookFunctionName[],OrpheuHookPhase:phase = OrpheuHookPre)
30
31 /**
32 * Unregisters a hook (stops it)
33 *
34 * @param hook A handler to the hook
35 */
36 native OrpheuUnregisterHook(OrpheuHook:hook)
37
38 /**
39 * Calls a function without triggering its hooks
40 *
41 * @param function A handler to the function
42 * @param any The arguments of the function
43 */
44 native OrpheuCall(OrpheuFunction:function,any:...)
45
46 /**
47 * Calls a function and triggers its hooks
48 *
49 * @param function A handler to the function
50 * @param any The arguments of the function
51 */
52 native OrpheuCallSuper(OrpheuFunction:function,any:...)
53
54 /**
55 * Gets the return value of a function (To be used in hooks Post)
56 *
57 * @param any In case the value is multi cell (string or vector), an holder to receive them by ref
58 * @return In case the value is uni cell, the value itself
59 */
60 native any:OrpheuGetReturn(any:...)
61
62 /**
63 * Sets the return value of a function
64 *
65 * @param any Depending on the type of the return of the function, a value to be used as the return as the original hooked function
66 */
67 native OrpheuSetReturn(any:...)
68
69 /**
70 * Sets the value of an argument
71 *
72 * @param num The number of the argument. The first argument would be the number "1"
73 * @param any Depending on the type of the argument, a value to be replace it to change the behaviour of the hooked function
74 */
75 native OrpheuSetParam(num,any:...)
76
77 /**
78 * Creates a struct
79 *
80 * @param structType The type of the struct
81 *
82 * @return A handler to the struct
83 */
84 native OrpheuStruct:OrpheuCreateStruct(OrpheuStructType:structType)
85
86 /**
87 * Retrieves the value of a member of a struct given the argument number the struct is and the member name
88 *
89 * @param num The number of the argument. The first argument would be the number "1"
90 * @param memberName The name of the member of the struct we want to deal with
91 * @param any If the member is multi cell,
92 *
93 * @return In case the value is uni cell, the value itself
94 */
95 native OrpheuGetParamStructMember(num,const memberName[],any:...)
96
97 /**
98 * Sets the value of member of a struct given the argument number the struct is and the member name
99 *
100 * @param num The number of the argument. The first argument would be the number "1"
101 * @param memberName The name of the member of the struct we want to deal with
102 * @param any The new value
103 */
104 native OrpheuSetParamStructMember(num,const memberName[],any:...)
105
106 /**
107 * Gets a struct handler for a struct received as an argument
108 * Beware that if the original struct gets destroyed or changed these effects will reflect on your use of it.
109 *
110 * @param num The number of the argument. The first argument would be the number "1"
111 *
112 * @return A handler to the struct
113 */
114 native OrpheuStruct:OrpheuGetStructFromParam(num)
115
116 /**
117 * Creates a struct equal to one received as an argument
118 *
119 * @param num The number of the argument. The first argument would be the number "1"
120 *
121 * @return A handler to the struct
122 */
123 native OrpheuStruct:OrpheuCloneStructFromParam(num)
124
125 /**
126 * Sets the value of a member of a struct given a struct handler and the member name
127 *
128 * @param struct A handler to the struct
129 * @param memberName The name of the member of the struct we want to deal with
130 * @param any The new value
131 */
132 native OrpheuSetStructMember(OrpheuStruct:struct,const memberName[],any:...)
133
134 /**
135 * Retrieves the value of a member of a struct given a struct handler and the member name
136 *
137 * @param struct A handler to the struct
138 * @param memberName The name of the member of the struct we want to deal with
139 * @param any In case the value is multi cell (string or vector), an holder to receive them by ref
140 *
141 * @return In case the value is uni cell, the value itself
142 */
143 native OrpheuGetStructMember(OrpheuStruct:struct,const memberName[],any:...)
144
145 /**
146 * Retrieves a handler to a struct that hold the addresses of the engine functions
147 * By retrieving addresses from the struct is possible to hook them.
148 * A easier way to achieve the same thing is by using the stock OrpheuGetEngineFunction
149
150 * @return A handler to a struct that holds the engine functions
151 */
152 native OrpheuStruct:OrpheuGetEngineFunctionsStruct()
153
154 /**
155 * Retrieves a handler to a struct that hold the addresses of the dll functions
156 * By retrieving addresses from the struct is possible to hook them.
157 * A easier way to achieve the same thing is by using the stock OrpheuGetDllFunction
158
159 * @return A handler to a struct that holds the dll functions
160 */
161 native OrpheuStruct:OrpheuGetDLLFunctionsStruct()
162
163 /**
164 * Retrieves a handler to a function given a classname, the function name and the classname
165 * This function is a virtual function (a function defined in abase class and implemented
166 * differently by each extender class)
167 * For example: every class that extends CBaseEntity has a Spawn function. That function is defined in CBaseEntity
168 * and implemented differently by each class derived from CBaseEntity
169 *
170 * @param entityClassName A class related to the object that holds the function wanted to be hooked. Example: "player"
171 * @param libFunctionName The library function name as it is in the file created to define the function
172 * @param libClassName The library function name as it is in the file created to define the function
173 * @return A handler to the function
174 */
175 native OrpheuFunction:OrpheuGetFunctionFromClass(const entityClassName[],const libFunctionName[],const libClassName[])
176
177 /**
178 * Retrieves a handler to a function given the ID of an entity, the function name and the classname
179 * This function is a virtual function (a function defined in abase class and implemented
180 * differently by each extender class)
181 * For example: every class that extends CBaseEntity has a Spawn function. That function is defined in CBaseEntity
182 * and implemented differently by each class derived from CBaseEntity
183 *
184 * @param id The id of the entity
185 * @param libFunctionName The library function name as it is in the file created to define the function
186 * @param libClassName The library function name as it is in the file created to define the function
187 * @return A handler to the function
188 */
189 native OrpheuFunction:OrpheuGetFunctionFromEntity(id,const libFunctionName[],const libClassName[])
190
191 /**
192 * Retrieves a handler to a function given an object, the function name and the classname
193 * This function is a virtual function (a function defined in abase class and implemented
194 * differently by each extender class)
195 * For example: every class that extends CBaseEntity has a Spawn function. That function is defined in CBaseEntity
196 * and implemented differently by each class derived from CBaseEntity
197 *
198 * @param object An object. More precisely, the address of a C++ object. This should be used for classes that are not entities
199 * @param libFunctionName The library function name as it is in the file created to define the function
200 * @param libClassName The library function name as it is in the file created to define the function
201 * @return A handler to the function
202 */
203 native OrpheuFunction:OrpheuGetFunctionFromObject(object,const libFunctionName[],const libClassName[])
204
205 /**
206 * Retrieves a handler to a function given the id of a monster of monstermod, the function name and the classname
207 * This function is a virtual function (a function defined in abase class and implemented
208 * differently by each extender class)
209 * For example: every class that extends CBaseEntity has a Spawn function. That function is defined in CBaseEntity
210 * and implemented differently by each class derived from CBaseEntity
211 *
212 * This function goes against the spirit of orpheu of hardcoding the less possible but without it would be much
213 * more complex to use virtual functions
214 *
215 * @param id The id of a monster from monstermod
216 * @param libFunctionName The library function name as it is in the file created to define the function
217 * @param libClassName The library function name as it is in the file created to define the function
218 * @return A handler to the function
219 */
220 native OrpheuFunction:OrpheuGetFunctionFromMonster(id, const libFunctionName[], const libClassName[])
221