| 456 | } |
| 457 | |
| 458 | static 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 | |
| 492 | static cell_t sm_ResetConVar(IPluginContext *pContext, const cell_t *params) |
| 493 | { |
nothing calls this directly
no test coverage detected