下面是一个GM命令的模版代码。命令功能:飞行和骑上载具
class buff_commandscript : public CommandScript
{
public:
mount_commandscript() : CommandScript("mount_commandscript") { }
ChatCommand* GetCommands() const
{
static ChatCommand IngameCommandTable[] =
{
{ "mount", SEC_PLAYER, false, &HandleMountCommand, "", NULL },
{ "fly", SEC_PLAYER, false, &HandleFlyCommand, "", NULL },
{ NULL, 0, false, NULL, "", NULL }
};
return IngameCommandTable;
}
static bool HandleMountCommand(ChatHandler * handler, const char * args)
{
Player * me = handler->GetSession()->GetPlayer();
me-> AddAura(16056, me); //这里就是给你骑上坐骑的一个技能BUFF,让角色获得16056这个BUFF在身上。
handler->PSendSysMessage("You Have Been Mounted!");
return true;
}
static bool HandleFlyCommand(ChatHandler * handler, const char * args)
{
Player * me = handler->GetSession()->GetPlayer();
me-> AddAura(31700, me); //这个是给角色增加一个飞行BUFF的功能。。当角色有这个31700飞行BUFF的时候,角色就可以飞行了
handler->PSendSysMessage("You Have Been Mounted, Now Fly!");
return true;
}
};
void AddSC_Ingame_commandscript()
{
new mount_commandscript();
}
|