Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "ScriptPCH.h"
- #include "Chat.h"
- #include "Player.h"
- class ffa_commandscript : public CommandScript
- {
- public:
- ffa_commandscript() : CommandScript("ffa_commandscript") { }
- ChatCommand* GetCommands() const
- {
- static ChatCommand ffaCommandTable[] =
- {
- { "on", SEC_PLAYER, false, &HandleFFAOnCommand, "", NULL },
- { "off", SEC_PLAYER, false, &HandleFFAOnCommand, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
- };
- static ChatCommand commandTable[] =
- {
- { "ffa", SEC_PLAYER, true, NULL, "", ffaCommandTable },
- { NULL, 0, false, NULL, "", NULL }
- };
- return commandTable;
- }
- static bool HandleFFAOnCommand(ChatHandler * handler, const char * args)
- {
- Player* player = handler->GetSession()->GetPlayer();
- if (HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP))
- {
- handler -> SendSysMessage("You are already FFA PVP Flagged!");
- handler -> SetSentErrorMessage(true);
- return false;
- }
- SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
- return true;
- }
- static bool HandleFFAOffCommand(ChatHandler * handler, const char * args)
- {
- Player* player = handler->GetSession()->GetPlayer();
- if (HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP))
- {
- RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
- }
- handler->SendSysMessage("You are not FFA PVP Flagged!");
- handler->SetSentErrorMessage(true);
- return false;
- }
- };
- void AddSC_ffa_commandscript()
- {
- new ffa_commandscript();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement