MCPcopy Create free account
hub / github.com/alliedmodders/sourcemod / UnHookEntityOutput

Function UnHookEntityOutput

extensions/sdktools/outputnatives.cpp:175–223  ·  view source on GitHub ↗

UnHookEntityOutput(const char[] classname, const char[] output, EntityOutput callback);

Source from the content-addressed store, hash-verified

173
174// UnHookEntityOutput(const char[] classname, const char[] output, EntityOutput callback);
175cell_t UnHookEntityOutput(IPluginContext *pContext, const cell_t *params)
176{
177 if (!g_OutputManager.IsEnabled())
178 {
179 return pContext->ThrowNativeError("Entity Outputs are disabled - See error logs for details");
180 }
181
182 char *classname;
183 pContext->LocalToString(params[1], &classname);
184
185 char *outputname;
186 pContext->LocalToString(params[2], &outputname);
187
188 OutputNameStruct *pOutputName = g_OutputManager.FindOutputPointer((const char *)classname, outputname, false);
189
190 if (!pOutputName)
191 {
192 return 0;
193 }
194
195 //Check for an existing identical hook
196 SourceHook::List<omg_hooks *>::iterator _iter;
197
198 omg_hooks *hook;
199
200 IPluginFunction *pFunction;
201 pFunction = pContext->GetFunctionById(params[3]);
202
203 for (_iter=pOutputName->hooks.begin(); _iter!=pOutputName->hooks.end(); _iter++)
204 {
205 hook = (omg_hooks *)*_iter;
206 if (hook->pf == pFunction && hook->entity_ref == -1)
207 {
208 // remove this hook.
209 if (hook->in_use)
210 {
211 hook->delete_me = true;
212 return 1;
213 }
214
215 pOutputName->hooks.erase(_iter);
216 g_OutputManager.CleanUpHook(hook);
217
218 return 1;
219 }
220 }
221
222 return 0;
223}
224
225// UnHookSingleEntityOutput(int entity, const char[] output, EntityOutput callback);
226cell_t UnHookSingleEntityOutput(IPluginContext *pContext, const cell_t *params)

Callers

nothing calls this directly

Calls 6

FindOutputPointerMethod · 0.80
CleanUpHookMethod · 0.80
IsEnabledMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected