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

Function sm_SetConVarFloat

core/smn_console.cpp:409–439  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

407}
408
409static cell_t sm_SetConVarFloat(IPluginContext *pContext, const cell_t *params)
410{
411 Handle_t hndl = static_cast<Handle_t>(params[1]);
412 HandleError err;
413 ConVar *pConVar;
414
415 if ((err=g_ConVarManager.ReadConVarHandle(hndl, &pConVar))
416 != HandleError_None)
417 {
418 return pContext->ThrowNativeError("Invalid convar handle %x (error %d)", hndl, err);
419 }
420
421 float value = sp_ctof(params[2]);
422 pConVar->SetValue(value);
423
424#if SOURCE_ENGINE < SE_ORANGEBOX
425 /* Should we replicate it? */
426 if (params[0] >= 3 && params[3] && IsFlagSet(pConVar, FCVAR_REPLICATED))
427 {
428 ReplicateConVar(pConVar);
429 }
430
431 /* Should we notify clients? */
432 if (params[0] >= 4 && params[4] && IsFlagSet(pConVar, FCVAR_NOTIFY))
433 {
434 NotifyConVar(pConVar);
435 }
436#endif
437
438 return 1;
439}
440
441static cell_t sm_GetConVarString(IPluginContext *pContext, const cell_t *params)
442{

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