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

Function GetStructEnt

extensions/structs/natives.cpp:353–379  ·  view source on GitHub ↗

native GetStructEnt(Handle:struct, const String:member[], &ent);

Source from the content-addressed store, hash-verified

351
352//native GetStructEnt(Handle:struct, const String:member[], &ent);
353static cell_t GetStructEnt(IPluginContext *pContext, const cell_t *params)
354{
355 Handle_t hndl = static_cast<Handle_t>(params[1]);
356 HandleError err;
357 HandleSecurity sec;
358
359 sec.pOwner = NULL;
360 sec.pIdentity = myself->GetIdentity();
361
362 StructHandle *pHandle;
363 if ((err = g_pHandleSys->ReadHandle(hndl, g_StructHandle, &sec, (void **)&pHandle))
364 != HandleError_None)
365 {
366 return pContext->ThrowNativeError("Invalid struct handle %x (error %d)", hndl, err);
367 }
368
369 char *member;
370 pContext->LocalToString(params[2], &member);
371
372 CBaseHandle *value;
373 if (!pHandle->GetEHandle(member, &value))
374 {
375 return pContext->ThrowNativeError("Invalid member, or incorrect data type");
376 }
377
378 return CheckBaseHandle(*value);
379}
380
381//native SetStructEnt(Handle:struct, const String:member[], ent);
382static cell_t SetStructEnt(IPluginContext *pContext, const cell_t *params)

Callers

nothing calls this directly

Calls 4

GetEHandleMethod · 0.80
CheckBaseHandleFunction · 0.70
GetIdentityMethod · 0.45
ReadHandleMethod · 0.45

Tested by

no test coverage detected