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

Function sm_SetConVarNum

core/smn_console.cpp:361–390  ·  view source on GitHub ↗

This handles both SetConVarBool() and SetConVarInt() */

Source from the content-addressed store, hash-verified

359
360/* This handles both SetConVarBool() and SetConVarInt() */
361static cell_t sm_SetConVarNum(IPluginContext *pContext, const cell_t *params)
362{
363 Handle_t hndl = static_cast<Handle_t>(params[1]);
364 HandleError err;
365 ConVar *pConVar;
366
367 if ((err=g_ConVarManager.ReadConVarHandle(hndl, &pConVar))
368 != HandleError_None)
369 {
370 return pContext->ThrowNativeError("Invalid convar handle %x (error %d)", hndl, err);
371 }
372
373 pConVar->SetValue(params[2]);
374
375#if SOURCE_ENGINE < SE_ORANGEBOX
376 /* Should we replicate it? */
377 if (params[0] >= 3 && params[3] && IsFlagSet(pConVar, FCVAR_REPLICATED))
378 {
379 ReplicateConVar(pConVar);
380 }
381
382 /* Should we notify clients? */
383 if (params[0] >= 4 && params[4] && IsFlagSet(pConVar, FCVAR_NOTIFY))
384 {
385 NotifyConVar(pConVar);
386 }
387#endif
388
389 return 1;
390}
391
392static cell_t sm_GetConVarFloat(IPluginContext *pContext, const cell_t *params)
393{

Callers

nothing calls this directly

Calls 5

IsFlagSetFunction · 0.85
ReplicateConVarFunction · 0.85
NotifyConVarFunction · 0.85
ReadConVarHandleMethod · 0.80
SetValueMethod · 0.80

Tested by

no test coverage detected