Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "ScriptPCH.h"
- #include "Chat.h"
- #include "AccountMgr.h"
- class buff_commandscript : public CommandScript
- {
- public:
- buff_commandscript() : CommandScript("buff_commandscript") { }
- ChatCommand* GetCommands() const
- {
- static ChatCommand IngameCommandTable[] =
- {
- { "killallplayers", SEC_ADMINISTRATOR, false, &HandleKillAllCommand, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
- };
- return IngameCommandTable;
- }
- static bool HandleKillAllCommand(ChatHandler * handler, const char * args)
- {
- SessionMap m_sessions = sWorld->GetAllSessions();
- for (SessionMap::iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
- {
- if (!itr->second || !itr->second->GetPlayer() || !itr->second->GetPlayer()->IsInWorld())
- continue;
- if(AccountMgr::IsPlayerAccount(itr->second->GetSecurity())) // Only killing players, not GMs
- itr->second->GetPlayer()->KillPlayer();
- }
- handler->PSendSysMessage("All players have been killed");
- return true;
- }
- };
- void AddSC_Ingame_commandscript()
- {
- new buff_commandscript();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement