Forums WoW Modding Support Archives Azerothcore Discord Archives [DiscordArchive] ```cpp

[DiscordArchive] ```cpp

[DiscordArchive] ```cpp

rektbyfaith
Administrator
0
12-15-2023, 12:51 AM
#1
Archived author: Phix • Posted: 2023-12-16T08:13:48.318000+00:00
Original source

```cpp
#include "ScriptMgr.h"
#include "Player.h"
#include "Config.h"
#include "ChatCommand.h"

using namespace Acore::ChatCommands;

class ChatHandler;

enum MyPlatyerAcoreString
{
HELLO_WORLD = 35410
};

// Add player scripts
class MyCommand : public CommandScript
{

MyCommand() : CommandScript("MyCommand") { }

ChatCommandTable GetCommands() const override
{
static ChatCommandTable commandTable =
{
{ "hello", &HandleCommand, SEC_GAMEMASTER, Console::No},
};

return commandTable;
}

static bool HandleCommand(ChatHandler *handler, std:Confusedtring args) {
Player* player = handler->GetSession()->GetPlayer();
}
};
```
I get the error ```pointer to incomplete class type "ChatHandler" is not allowed``` on the HandleCommand function. I'm relatively new to c++. Why is this?
rektbyfaith
12-15-2023, 12:51 AM #1

Archived author: Phix • Posted: 2023-12-16T08:13:48.318000+00:00
Original source

```cpp
#include "ScriptMgr.h"
#include "Player.h"
#include "Config.h"
#include "ChatCommand.h"

using namespace Acore::ChatCommands;

class ChatHandler;

enum MyPlatyerAcoreString
{
HELLO_WORLD = 35410
};

// Add player scripts
class MyCommand : public CommandScript
{

MyCommand() : CommandScript("MyCommand") { }

ChatCommandTable GetCommands() const override
{
static ChatCommandTable commandTable =
{
{ "hello", &HandleCommand, SEC_GAMEMASTER, Console::No},
};

return commandTable;
}

static bool HandleCommand(ChatHandler *handler, std:Confusedtring args) {
Player* player = handler->GetSession()->GetPlayer();
}
};
```
I get the error ```pointer to incomplete class type "ChatHandler" is not allowed``` on the HandleCommand function. I'm relatively new to c++. Why is this?

Recently Browsing
 1 Guest(s)
Recently Browsing
 1 Guest(s)