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

Function SetStructInt

extensions/structs/natives.cpp:131–156  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

129
130//native SetStructInt(Handle:struct, const String:member[], value);
131static cell_t SetStructInt(IPluginContext *pContext, const cell_t *params)
132{
133 Handle_t hndl = static_cast<Handle_t>(params[1]);
134 HandleError err;
135 HandleSecurity sec;
136
137 sec.pOwner = NULL;
138 sec.pIdentity = myself->GetIdentity();
139
140 StructHandle *pHandle;
141 if ((err = handlesys->ReadHandle(hndl, g_StructHandle, &sec, (void **)&pHandle))
142 != HandleError_None)
143 {
144 return pContext->ThrowNativeError("Invalid struct handle %x (error %d)", hndl, err);
145 }
146
147 char *member;
148 pContext->LocalToString(params[2], &member);
149
150 if (!pHandle->SetInt(member, params[3]))
151 {
152 return pContext->ThrowNativeError("Invalid member, or incorrect data type");
153 }
154
155 return 1;
156}
157
158//native GetStructFloat(Handle:struct, const String:member[], &Float:value);
159static cell_t GetStructFloat(IPluginContext *pContext, const cell_t *params)

Callers

nothing calls this directly

Calls 3

SetIntMethod · 0.80
GetIdentityMethod · 0.45
ReadHandleMethod · 0.45

Tested by

no test coverage detected