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

Function sm_SetConVarString

core/smn_console.cpp:458–490  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

456}
457
458static cell_t sm_SetConVarString(IPluginContext *pContext, const cell_t *params)
459{
460 Handle_t hndl = static_cast<Handle_t>(params[1]);
461 HandleError err;
462 ConVar *pConVar;
463
464 if ((err=g_ConVarManager.ReadConVarHandle(hndl, &pConVar))
465 != HandleError_None)
466 {
467 return pContext->ThrowNativeError("Invalid convar handle %x (error %d)", hndl, err);
468 }
469
470 char *value;
471 pContext->LocalToString(params[2], &value);
472
473 pConVar->SetValue(value);
474
475#if SOURCE_ENGINE < SE_ORANGEBOX
476 /* Should we replicate it? */
477 if (params[0] >= 3 && params[3] && IsFlagSet(pConVar, FCVAR_REPLICATED))
478 {
479 ReplicateConVar(pConVar);
480 }
481
482 /* Should we notify clients? */
483 if (params[0] >= 4 && params[4] && IsFlagSet(pConVar, FCVAR_NOTIFY))
484 {
485 NotifyConVar(pConVar);
486 }
487#endif
488
489 return 1;
490}
491
492static cell_t sm_ResetConVar(IPluginContext *pContext, const cell_t *params)
493{

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