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

Method OnClientCommandKeyValues

core/PlayerManager.cpp:1201–1240  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1199static bool s_LastCCKVAllowed = true;
1200
1201void PlayerManager::OnClientCommandKeyValues(edict_t *pEntity, KeyValues *pCommand)
1202{
1203 int client = IndexOfEdict(pEntity);
1204
1205 cell_t res = Pl_Continue;
1206 CPlayer *pPlayer = &m_Players[client];
1207
1208 if (!pPlayer->IsInGame())
1209 {
1210 RETURN_META(MRES_IGNORED);
1211 }
1212
1213 KeyValueStack *pStk = new KeyValueStack;
1214 pStk->pBase = pCommand;
1215 pStk->pCurRoot.push(pStk->pBase);
1216 pStk->m_bDeleteOnDestroy = false;
1217
1218 Handle_t hndl = handlesys->CreateHandle(g_KeyValueType, pStk, g_pCoreIdent, g_pCoreIdent, NULL);
1219
1220 m_bInCCKVHook = true;
1221 m_clcommandkv->PushCell(client);
1222 m_clcommandkv->PushCell(hndl);
1223 m_clcommandkv->Execute(&res);
1224 m_bInCCKVHook = false;
1225
1226 HandleSecurity sec(g_pCoreIdent, g_pCoreIdent);
1227
1228 // Deletes pStk
1229 handlesys->FreeHandle(hndl, &sec);
1230
1231 if (res >= Pl_Handled)
1232 {
1233 s_LastCCKVAllowed = false;
1234 RETURN_META(MRES_SUPERCEDE);
1235 }
1236
1237 s_LastCCKVAllowed = true;
1238
1239 RETURN_META(MRES_IGNORED);
1240}
1241
1242void PlayerManager::OnClientCommandKeyValues_Post(edict_t *pEntity, KeyValues *pCommand)
1243{

Callers

nothing calls this directly

Calls 7

IndexOfEdictFunction · 0.85
IsInGameMethod · 0.80
PushCellMethod · 0.80
FreeHandleMethod · 0.80
pushMethod · 0.45
CreateHandleMethod · 0.45
ExecuteMethod · 0.45

Tested by

no test coverage detected