Hello, I tried setting up a world chat c++ script for my server but it crashes when someone on the server uses /o (Both admins and regular players.). I wrote it by looking at some other world scripts on different websites and they look a lot like the others ones so I don’t know if I can get help here or not… If I can’t, please delete my thread.
Here’s the code:
case CHAT_MSG_OFFICER:
{
char message[1024];
switch(GetPlayer()->GetSession()->GetSecurity())
{
case SEC_PLAYER: // normal player, non-vip
snprintf(message, 1024, “|cffFF0000[Alliance]|cffFFFF00[%s]:|cffffffff %s”, GetPlayer()->GetName(), msg.c_str());
break;
case 1: // Moderator
snprintf(message, 1024, “|cff01DF74[Mod]|cffFFFF00[%s]:|cffffffff %s”, GetPlayer()->GetName(), msg.c_str());
break;
case 2: // GameMaster
if (GetPlayer()->GetTeam()==ALLIANCE)
snprintf(message, 1024, “|cFF87CEFA[GameMaster]|cffFFFF00[%s]:|cffffffff %s”, GetPlayer()->GetName(), msg.c_str());
break;
case 3: //Admin
snprintf(message, 1024, “|cFFFF0000[Admin]|cffFFFF00[%s]:|cffffffff %s”, GetPlayer()->GetName(), msg.c_str());
break;
}
sWorld->SendGlobalText(message, NULL);
}
break;
From what I’ve seen on the other scripts it should work, and chathandler.cpp is the only file the other scripts have edited…