| 407 | } |
| 408 | |
| 409 | static 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 | |
| 441 | static cell_t sm_GetConVarString(IPluginContext *pContext, const cell_t *params) |
| 442 | { |
nothing calls this directly
no test coverage detected