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

Function SetStructFloat

extensions/structs/natives.cpp:189–214  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

187
188//native SetStructFloat(Handle:struct, const String:member[], Float:value);
189static cell_t SetStructFloat(IPluginContext *pContext, const cell_t *params)
190{
191 Handle_t hndl = static_cast<Handle_t>(params[1]);
192 HandleError err;
193 HandleSecurity sec;
194
195 sec.pOwner = NULL;
196 sec.pIdentity = myself->GetIdentity();
197
198 StructHandle *pHandle;
199 if ((err = g_pHandleSys->ReadHandle(hndl, g_StructHandle, &sec, (void **)&pHandle))
200 != HandleError_None)
201 {
202 return pContext->ThrowNativeError("Invalid struct handle %x (error %d)", hndl, err);
203 }
204
205 char *member;
206 pContext->LocalToString(params[2], &member);
207
208 if (!pHandle->SetFloat(member, sp_ctof(params[3])))
209 {
210 return pContext->ThrowNativeError("Invalid member, or incorrect data type");
211 }
212
213 return 1;
214}
215
216//native GetStructVector(Handle:struct, const String:member[], Float:vec[3]);
217static cell_t GetStructVector(IPluginContext *pContext, const cell_t *params)

Callers

nothing calls this directly

Calls 3

GetIdentityMethod · 0.45
ReadHandleMethod · 0.45
SetFloatMethod · 0.45

Tested by

no test coverage detected