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

Function ReplicateConVar

core/smn_console.cpp:202–224  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

200
201#if SOURCE_ENGINE < SE_ORANGEBOX
202static void ReplicateConVar(ConVar *pConVar)
203{
204 int maxClients = g_Players.GetMaxClients();
205
206 char data[256];
207 bf_write buffer(data, sizeof(data));
208
209 buffer.WriteUBitLong(NET_SETCONVAR, NETMSG_BITS);
210 buffer.WriteByte(1);
211 buffer.WriteString(pConVar->GetName());
212 buffer.WriteString(pConVar->GetString());
213
214 for (int i = 1; i <= maxClients; i++)
215 {
216 CPlayer *pPlayer = g_Players.GetPlayerByIndex(i);
217
218 if (pPlayer && pPlayer->IsInGame() && !pPlayer->IsFakeClient())
219 {
220 if (INetChannel *netchan = static_cast<INetChannel *>(engine->GetPlayerNetInfo(i)))
221 netchan->SendData(buffer);
222 }
223 }
224}
225
226static void NotifyConVar(ConVar *pConVar)
227{

Callers 4

sm_SetConVarNumFunction · 0.85
sm_SetConVarFloatFunction · 0.85
sm_SetConVarStringFunction · 0.85
sm_ResetConVarFunction · 0.85

Calls 6

GetMaxClientsMethod · 0.80
GetPlayerByIndexMethod · 0.80
IsInGameMethod · 0.80
IsFakeClientMethod · 0.80
GetNameMethod · 0.45
GetStringMethod · 0.45

Tested by

no test coverage detected