| 280 | } |
| 281 | |
| 282 | bool 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 | |
| 319 | bool ConCmdManager::AddAdminCommand(IPluginFunction *pFunction, |
| 320 | const char *name, |
no test coverage detected