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

Function SetStructString

extensions/structs/natives.cpp:322–350  ·  view source on GitHub ↗

native SetStructString(Handle:struct, const String:member[], String:value[]);

Source from the content-addressed store, hash-verified

320
321//native SetStructString(Handle:struct, const String:member[], String:value[]);
322static cell_t SetStructString(IPluginContext *pContext, const cell_t *params)
323{
324 Handle_t hndl = static_cast<Handle_t>(params[1]);
325 HandleError err;
326 HandleSecurity sec;
327
328 sec.pOwner = NULL;
329 sec.pIdentity = myself->GetIdentity();
330
331 StructHandle *pHandle;
332 if ((err = g_pHandleSys->ReadHandle(hndl, g_StructHandle, &sec, (void **)&pHandle))
333 != HandleError_None)
334 {
335 return pContext->ThrowNativeError("Invalid struct handle %x (error %d)", hndl, err);
336 }
337
338 char *member;
339 pContext->LocalToString(params[2], &member);
340
341 char *string;
342 pContext->LocalToString(params[3], &string);
343
344 if (!pHandle->SetString(member, string))
345 {
346 return pContext->ThrowNativeError("Invalid member, or incorrect data type");
347 }
348
349 return 1;
350}
351
352//native GetStructEnt(Handle:struct, const String:member[], &ent);
353static cell_t GetStructEnt(IPluginContext *pContext, const cell_t *params)

Callers

nothing calls this directly

Calls 3

GetIdentityMethod · 0.45
ReadHandleMethod · 0.45
SetStringMethod · 0.45

Tested by

no test coverage detected