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

Method CheckAccess

core/ConCmdManager.cpp:282–317  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

280}
281
282bool ConCmdManager::CheckAccess(int client, const char *cmd, AdminCmdInfo *pAdmin)
283{
284 if (adminsys->CheckClientCommandAccess(client, cmd, pAdmin->eflags))
285 {
286 return true;
287 }
288
289 CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
290 if (!pPlayer)
291 {
292 return false;
293 }
294
295 /* If we got here, the command failed... */
296 char buffer[128];
297 if (!logicore.CoreTranslate(buffer, sizeof(buffer), "%T", 2, NULL, "No Access", &client))
298 {
299 ke::SafeStrcpy(buffer, sizeof(buffer), "You do not have access to this command");
300 }
301
302 unsigned int replyto = g_ChatTriggers.GetReplyTo();
303 if (replyto == SM_REPLY_CONSOLE)
304 {
305 char fullbuffer[192];
306 ke::SafeSprintf(fullbuffer, sizeof(fullbuffer), "[SM] %s.\n", buffer);
307 pPlayer->PrintToConsole(fullbuffer);
308 }
309 else if (replyto == SM_REPLY_CHAT)
310 {
311 char fullbuffer[192];
312 ke::SafeSprintf(fullbuffer, sizeof(fullbuffer), "[SM] %s.", buffer);
313 g_HL2.TextMsg(client, HUD_PRINTTALK, fullbuffer);
314 }
315
316 return false;
317}
318
319bool ConCmdManager::AddAdminCommand(IPluginFunction *pFunction,
320 const char *name,

Callers 3

OnMenuSelect2Method · 0.45
OnMenuDrawItemMethod · 0.45
UpdateClientCategoryMethod · 0.45

Calls 5

GetPlayerByIndexMethod · 0.80
PrintToConsoleMethod · 0.80
TextMsgMethod · 0.80
GetReplyToMethod · 0.45

Tested by

no test coverage detected