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

Method HookCreateMessage

core/MenuStyle_Valve.cpp:80–113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78}
79
80void ValveMenuStyle::HookCreateMessage(edict_t *pEdict,
81 DIALOG_TYPE type,
82 KeyValues *kv,
83 IServerPluginCallbacks *plugin)
84{
85 if (type != DIALOG_MENU)
86 {
87 return;
88 }
89
90 int client = IndexOfEdict(pEdict);
91 if (client < 1 || client > 256)
92 {
93 return;
94 }
95
96 CValveMenuPlayer *player = &m_players[client];
97
98 /* We don't care if the player is in a menu because, for all intents and purposes,
99 * the menu is completely private. Instead, we just figure out the level we'll need
100 * in order to override it.
101 */
102 player->curPrioLevel = kv->GetInt("level", player->curPrioLevel);
103
104 /* Oh no! What happens if we got a menu that overwrites ours?! */
105 if (player->bInMenu)
106 {
107 /* Okay, let the external menu survive for now. It may live another
108 * day to avenge its grandfather, killed in the great Menu Interruption
109 * battle.
110 */
111 _CancelClientMenu(client, MenuCancel_Interrupted, true);
112 }
113}
114
115IMenuPanel *ValveMenuStyle::CreatePanel()
116{

Callers

nothing calls this directly

Calls 2

IndexOfEdictFunction · 0.85
GetIntMethod · 0.45

Tested by

no test coverage detected