This handles both SetConVarBool() and SetConVarInt() */
| 359 | |
| 360 | /* This handles both SetConVarBool() and SetConVarInt() */ |
| 361 | static 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 | |
| 392 | static cell_t sm_GetConVarFloat(IPluginContext *pContext, const cell_t *params) |
| 393 | { |
nothing calls this directly
no test coverage detected