[DiscordArchive] Hi guys, I am trying to make script that automatically push a player to a created channel, but I can
[DiscordArchive] Hi guys, I am trying to make script that automatically push a player to a created channel, but I can
tring channelName;Archived author: MR.MUSTACHE • Posted: 2019-05-31T05:19:58.577000+00:00
Original source
Hi guys, I am trying to make script that automatically push a player to a created channel, but I can't make it work and the core crashes
```cpp
class custom_channel_world : public PlayerScript
{
public:
custom_channel_world() : PlayerScript("custom_channel_world") {}
std:
tring channelName;
void OnLogin(Player* player, bool firstLogin) override
{
channelName = sConfigMgr->GetStringDefault("Custom.Global.Channel", "world");
ChannelMgr* cMgr = ChannelMgr::forTeam(player->GetTeam());
if (Channel* channel = cMgr->GetChannel(0, channelName, player, false))
channel->JoinChannel(player, "");
}
};
```
Does anyone have any suggestions?