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

Function smn_KvSetVector

core/smn_keyvalues.cpp:285–312  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

283}
284
285static cell_t smn_KvSetVector(IPluginContext *pCtx, const cell_t *params)
286{
287 Handle_t hndl = static_cast<Handle_t>(params[1]);
288 HandleError herr;
289 HandleSecurity sec;
290 KeyValueStack *pStk;
291
292 sec.pOwner = NULL;
293 sec.pIdentity = g_pCoreIdent;
294
295 if ((herr=handlesys->ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
296 != HandleError_None)
297 {
298 return pCtx->ThrowNativeError("Invalid key value handle %x (error %d)", hndl, herr);
299 }
300
301 char *key;
302 char buffer[64];
303 cell_t *vector;
304 pCtx->LocalToStringNULL(params[2], &key);
305 pCtx->LocalToPhysAddr(params[3], &vector);
306
307 ke::SafeSprintf(buffer, sizeof(buffer), "%f %f %f", sp_ctof(vector[0]), sp_ctof(vector[1]), sp_ctof(vector[2]));
308
309 pStk->pCurRoot.front()->SetString(key, buffer);
310
311 return 1;
312}
313
314static cell_t smn_KvGetString(IPluginContext *pCtx, const cell_t *params)
315{

Callers

nothing calls this directly

Calls 2

ReadHandleMethod · 0.45
SetStringMethod · 0.45

Tested by

no test coverage detected