Code
#include "ScriptPCH.h"
#include "Chat.h"
class devtag_commandscript : public CommandScript
{
public:
devtag_commandscript() : CommandScript("devtag_commandscript") { }
static bool DevTagWorldCommand(ChatHandler* handler, const char* args)
{
if (!*args)
{
if (handler->GetSession()->GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_DEVELOPER))
handler->GetSession()->SendAreaTriggerMessage("|cffff0000Мод разработчика включен|r");
else
handler->GetSession()->SendAreaTriggerMessage("|cffff0000Мод разработчика выключен|r");
return true;
}
std::string argstr = (char*)args;
if (argstr == "on")
{
handler->GetSession()->SendAreaTriggerMessage("|cffff0000Мод разработчика включен|r");
handler->GetSession()->GetPlayer()->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_DEVELOPER);
return true;
}
if (argstr == "off")
{
handler->GetSession()->SendAreaTriggerMessage("|cffff0000Мод разработчика выключен|r");
handler->GetSession()->GetPlayer()->RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_DEVELOPER);
return true;
}
handler->SendSysMessage(LANG_USE_BOL);
handler->SetSentErrorMessage(true);
return false;
}
ChatCommand* GetCommands() const
{
static ChatCommand DevTagCommandTable[] =
{
{ "developer", SEC_PLAYER, true, &DevTagWorldCommand, "", NULL },
{ NULL, 0, false, NULL, "", NULL }
};
return DevTagCommandTable;
}
};
void AddSC_devtag_commandscript()
{
new devtag_commandscript();
}
/*INSERT INTO `command` (`name`, `security`, `help`) VALUES ('developer', 1, 'Syntax: .developer [on/off]\r\n\r\nEnable or Disable in game Dev tag or show current state if on/off not provided.');*/
.dev on/off