PDA

View Full Version : A couple basic player commands



Sdyess94
12-07-09, 01:48 PM
#include "StdAfx.h"
#include "Setup.h"
#ifdef WIN32
#pragma warning(disable:4305) // warning C4305: 'argument' : truncation from 'double' to 'float'
#endif

#define STRUDEL_TYPE 43523
#define STRUDEL_AMOUNT 20

static string strudel = "#strudel";
static string buff = "#buff";


bool Commands(Player * pPlayer, uint32 Type, uint32 Lang, const char * Message, const char * Misc)
{
if (Message == strudel)
{
ItemPrototype* it = ItemPrototypeStorage.LookupEntry(STRUDEL_TYPE);
Item *item;
item = objmgr.CreateItem( STRUDEL_TYPE, pPlayer);
item->SetUInt32Value(ITEM_FIELD_STACK_COUNT, ((STRUDEL_AMOUNT > it->MaxCount) ? it->MaxCount : STRUDEL_AMOUNT));
if(it->Bonding==ITEM_BIND_ON_PICKUP)
item->SoulBind();
if(!pPlayer->GetItemInterface()->AddItemToFreeSlot(item))
{
pPlayer->BroadcastMessage("No free slots were found in your inventory!");
delete item;
}
SlotResult *lr = pPlayer->GetItemInterface()->LastSearchResult();
pPlayer->GetSession()->SendItemPushResult(item,false,true,false,true,lr->ContainerSlot,lr->Slot,STRUDEL_AMOUNT);
}

if (Message == buff)
{
pPlayer->BroadcastMessage("You are now buffed!");
pPlayer->CastSpell(pPlayer, 33077, true);
pPlayer->CastSpell(pPlayer, 33078, true);
pPlayer->CastSpell(pPlayer, 33079, true);
pPlayer->CastSpell(pPlayer, 33080, true);
pPlayer->CastSpell(pPlayer, 33081, true);
pPlayer->CastSpell(pPlayer, 33082, true);
}
return true;
}
void SetupCommands(ScriptMgr * mgr)
{
mgr->register_hook(SERVER_HOOK_EVENT_ON_CHAT, &Commands);
}


Once compiled, a player can type #buff and it will buff them up with the scroll buffs ya know.
A player can also type #strudel and receive 20 conjured mana strudels

Onlykl
12-07-09, 01:55 PM
you should give little info...

Sdyess94
12-07-09, 02:17 PM
Edited.