Quote Originally Posted by You_Got_Tescoed View Post
So i got bored and made this. Note: Not tested or compiled so any errors Post.



PlayerCommands.cpp:
Code:
#include "StdAfx.h"
#include "Setup.h"

#define FOOD_ADD    33254
#define DRINK_ADD    33236
#define BOTH_ADD    34062
#define MPOT_ADD    32948
#define HPOT_ADD    32947
#define STACK_COUNT        20

static string food = "#food";
static string food = "#drink";
static string food = "#both";
static string food = "#mpot";
static string food = "#hpot";

void EventPlayerCommands(Player * Plr, uint32 Type, uint32 Lang, const char * Message, const char * Misc)
{
    if(Message == food)
    {
        ItemPrototype *proto;
        ItemPrototype* it = ItemPrototypeStorage.LookupEntry(FOOD_ADD);
        SlotResult slot;
        Item * pItem = objmgr.CreateItem(FOOD_ADD, Plr);
        proto = pItem->GetProto();
        slot = Plr->GetItemInterface()->FindFreeInventorySlot(proto);
        if(slot.Result)
        {
            pItem->SetUInt32Value(ITEM_FIELD_STACK_COUNT, STACK_COUNT);
            pItem->SetOwner(Plr);
            if (pItem->GetProto()->Bonding == ITEM_BIND_ON_PICKUP)
                pItem->SoulBind();
            pItem->m_isDirty = true;
            Plr->GetItemInterface()->SafeAddItem(pItem,slot.ContainerSlot,slot.Slot);
            if(Plr->IsInWorld() && !pItem->IsInWorld())
            {
                pItem->PushToWorld(Plr->GetMapMgr());

                ByteBuffer buf(2500);
                uint32 count = pItem->BuildCreateUpdateBlockForPlayer(&buf, Plr);
                Plr->PushCreationData(&buf, count);
            }
        }
    }

    elseif(Message == drink)
    {
        ItemPrototype *proto;
        ItemPrototype* it = ItemPrototypeStorage.LookupEntry(DRINK_ADD);
        SlotResult slot;
        Item * pItem = objmgr.CreateItem(DRINK_ADD, Plr);
        proto = pItem->GetProto();
        slot = Plr->GetItemInterface()->FindFreeInventorySlot(proto);
        if(slot.Result)
        {
            pItem->SetUInt32Value(ITEM_FIELD_STACK_COUNT, STACK_COUNT);
            pItem->SetOwner(Plr);
            if (pItem->GetProto()->Bonding == ITEM_BIND_ON_PICKUP)
                pItem->SoulBind();
            pItem->m_isDirty = true;
            Plr->GetItemInterface()->SafeAddItem(pItem,slot.ContainerSlot,slot.Slot);
            if(Plr->IsInWorld() && !pItem->IsInWorld())
            {
                pItem->PushToWorld(Plr->GetMapMgr());

                ByteBuffer buf(2500);
                uint32 count = pItem->BuildCreateUpdateBlockForPlayer(&buf, Plr);
                Plr->PushCreationData(&buf, count);
            }
        }
    }

    elseif(Message == both)
    {
        ItemPrototype *proto;
        ItemPrototype* it = ItemPrototypeStorage.LookupEntry(FOOD_ADD);
        SlotResult slot;
        Item * pItem = objmgr.CreateItem(BOTH_ADD, Plr);
        proto = pItem->GetProto();
        slot = Plr->GetItemInterface()->FindFreeInventorySlot(proto);
        if(slot.Result)
        {
            pItem->SetUInt32Value(ITEM_FIELD_STACK_COUNT, STACK_COUNT);
            pItem->SetOwner(Plr);
            if (pItem->GetProto()->Bonding == ITEM_BIND_ON_PICKUP)
                pItem->SoulBind();
            pItem->m_isDirty = true;
            Plr->GetItemInterface()->SafeAddItem(pItem,slot.ContainerSlot,slot.Slot);
            if(Plr->IsInWorld() && !pItem->IsInWorld())
            {
                pItem->PushToWorld(Plr->GetMapMgr());

                ByteBuffer buf(2500);
                uint32 count = pItem->BuildCreateUpdateBlockForPlayer(&buf, Plr);
                Plr->PushCreationData(&buf, count);
            }
        }
    }

    elseif(Message == hpot)
    {
        ItemPrototype *proto;
        ItemPrototype* it = ItemPrototypeStorage.LookupEntry(FOOD_ADD);
        SlotResult slot;
        Item * pItem = objmgr.CreateItem(HPOT_ADD, Plr);
        proto = pItem->GetProto();
        slot = Plr->GetItemInterface()->FindFreeInventorySlot(proto);
        if(slot.Result)
        {
            pItem->SetUInt32Value(ITEM_FIELD_STACK_COUNT, STACK_COUNT);
            pItem->SetOwner(Plr);
            if (pItem->GetProto()->Bonding == ITEM_BIND_ON_PICKUP)
                pItem->SoulBind();
            pItem->m_isDirty = true;
            Plr->GetItemInterface()->SafeAddItem(pItem,slot.ContainerSlot,slot.Slot);
            if(Plr->IsInWorld() && !pItem->IsInWorld())
            {
                pItem->PushToWorld(Plr->GetMapMgr());

                ByteBuffer buf(2500);
                uint32 count = pItem->BuildCreateUpdateBlockForPlayer(&buf, Plr);
                Plr->PushCreationData(&buf, count);
            }
        }
    }

    elseif(Message == mpot)
    {
        ItemPrototype *proto;
        ItemPrototype* it = ItemPrototypeStorage.LookupEntry(FOOD_ADD);
        SlotResult slot;
        Item * pItem = objmgr.CreateItem(MPOT_ADD, Plr);
        proto = pItem->GetProto();
        slot = Plr->GetItemInterface()->FindFreeInventorySlot(proto);
        if(slot.Result)
        {
            pItem->SetUInt32Value(ITEM_FIELD_STACK_COUNT, STACK_COUNT);
            pItem->SetOwner(Plr);
            if (pItem->GetProto()->Bonding == ITEM_BIND_ON_PICKUP)
                pItem->SoulBind();
            pItem->m_isDirty = true;
            Plr->GetItemInterface()->SafeAddItem(pItem,slot.ContainerSlot,slot.Slot);
            if(Plr->IsInWorld() && !pItem->IsInWorld())
            {
                pItem->PushToWorld(Plr->GetMapMgr());

                ByteBuffer buf(2500);
                uint32 count = pItem->BuildCreateUpdateBlockForPlayer(&buf, Plr);
                Plr->PushCreationData(&buf, count);
            }
        }
    }
}

void SetupPlayerCommands(ScriptMgr * mgr)
{
    mgr->register_hook(SERVER_HOOK_EVENT_ON_CHAT, (void *) EventPlayerCommands);
}#include "StdAfx.h"
#include "Setup.h"

#define FOOD_ADD    33254
#define DRINK_ADD    33236
#define BOTH_ADD    34062
#define MPOT_ADD    32948
#define HPOT_ADD    32947
#define STACK_COUNT        20

static string food = "#food";
static string food = "#drink";
static string food = "#both";
static string food = "#mpot";
static string food = "#hpot";

void EventPlayerCommands(Player * Plr, uint32 Type, uint32 Lang, const char * Message, const char * Misc)
{
    if(Message == food)
    {
        ItemPrototype *proto;
        ItemPrototype* it = ItemPrototypeStorage.LookupEntry(FOOD_ADD);
        SlotResult slot;
        Item * pItem = objmgr.CreateItem(FOOD_ADD, Plr);
        proto = pItem->GetProto();
        slot = Plr->GetItemInterface()->FindFreeInventorySlot(proto);
        if(slot.Result)
        {
            pItem->SetUInt32Value(ITEM_FIELD_STACK_COUNT, STACK_COUNT);
            pItem->SetOwner(Plr);
            if (pItem->GetProto()->Bonding == ITEM_BIND_ON_PICKUP)
                pItem->SoulBind();
            pItem->m_isDirty = true;
            Plr->GetItemInterface()->SafeAddItem(pItem,slot.ContainerSlot,slot.Slot);
            if(Plr->IsInWorld() && !pItem->IsInWorld())
            {
                pItem->PushToWorld(Plr->GetMapMgr());

                ByteBuffer buf(2500);
                uint32 count = pItem->BuildCreateUpdateBlockForPlayer(&buf, Plr);
                Plr->PushCreationData(&buf, count);
            }
        }
    }

    elseif(Message == drink)
    {
        ItemPrototype *proto;
        ItemPrototype* it = ItemPrototypeStorage.LookupEntry(DRINK_ADD);
        SlotResult slot;
        Item * pItem = objmgr.CreateItem(DRINK_ADD, Plr);
        proto = pItem->GetProto();
        slot = Plr->GetItemInterface()->FindFreeInventorySlot(proto);
        if(slot.Result)
        {
            pItem->SetUInt32Value(ITEM_FIELD_STACK_COUNT, STACK_COUNT);
            pItem->SetOwner(Plr);
            if (pItem->GetProto()->Bonding == ITEM_BIND_ON_PICKUP)
                pItem->SoulBind();
            pItem->m_isDirty = true;
            Plr->GetItemInterface()->SafeAddItem(pItem,slot.ContainerSlot,slot.Slot);
            if(Plr->IsInWorld() && !pItem->IsInWorld())
            {
                pItem->PushToWorld(Plr->GetMapMgr());

                ByteBuffer buf(2500);
                uint32 count = pItem->BuildCreateUpdateBlockForPlayer(&buf, Plr);
                Plr->PushCreationData(&buf, count);
            }
        }
    }

    elseif(Message == both)
    {
        ItemPrototype *proto;
        ItemPrototype* it = ItemPrototypeStorage.LookupEntry(FOOD_ADD);
        SlotResult slot;
        Item * pItem = objmgr.CreateItem(BOTH_ADD, Plr);
        proto = pItem->GetProto();
        slot = Plr->GetItemInterface()->FindFreeInventorySlot(proto);
        if(slot.Result)
        {
            pItem->SetUInt32Value(ITEM_FIELD_STACK_COUNT, STACK_COUNT);
            pItem->SetOwner(Plr);
            if (pItem->GetProto()->Bonding == ITEM_BIND_ON_PICKUP)
                pItem->SoulBind();
            pItem->m_isDirty = true;
            Plr->GetItemInterface()->SafeAddItem(pItem,slot.ContainerSlot,slot.Slot);
            if(Plr->IsInWorld() && !pItem->IsInWorld())
            {
                pItem->PushToWorld(Plr->GetMapMgr());

                ByteBuffer buf(2500);
                uint32 count = pItem->BuildCreateUpdateBlockForPlayer(&buf, Plr);
                Plr->PushCreationData(&buf, count);
            }
        }
    }

    elseif(Message == hpot)
    {
        ItemPrototype *proto;
        ItemPrototype* it = ItemPrototypeStorage.LookupEntry(FOOD_ADD);
        SlotResult slot;
        Item * pItem = objmgr.CreateItem(HPOT_ADD, Plr);
        proto = pItem->GetProto();
        slot = Plr->GetItemInterface()->FindFreeInventorySlot(proto);
        if(slot.Result)
        {
            pItem->SetUInt32Value(ITEM_FIELD_STACK_COUNT, STACK_COUNT);
            pItem->SetOwner(Plr);
            if (pItem->GetProto()->Bonding == ITEM_BIND_ON_PICKUP)
                pItem->SoulBind();
            pItem->m_isDirty = true;
            Plr->GetItemInterface()->SafeAddItem(pItem,slot.ContainerSlot,slot.Slot);
            if(Plr->IsInWorld() && !pItem->IsInWorld())
            {
                pItem->PushToWorld(Plr->GetMapMgr());

                ByteBuffer buf(2500);
                uint32 count = pItem->BuildCreateUpdateBlockForPlayer(&buf, Plr);
                Plr->PushCreationData(&buf, count);
            }
        }
    }

    elseif(Message == mpot)
    {
        ItemPrototype *proto;
        ItemPrototype* it = ItemPrototypeStorage.LookupEntry(FOOD_ADD);
        SlotResult slot;
        Item * pItem = objmgr.CreateItem(MPOT_ADD, Plr);
        proto = pItem->GetProto();
        slot = Plr->GetItemInterface()->FindFreeInventorySlot(proto);
        if(slot.Result)
        {
            pItem->SetUInt32Value(ITEM_FIELD_STACK_COUNT, STACK_COUNT);
            pItem->SetOwner(Plr);
            if (pItem->GetProto()->Bonding == ITEM_BIND_ON_PICKUP)
                pItem->SoulBind();
            pItem->m_isDirty = true;
            Plr->GetItemInterface()->SafeAddItem(pItem,slot.ContainerSlot,slot.Slot);
            if(Plr->IsInWorld() && !pItem->IsInWorld())
            {
                pItem->PushToWorld(Plr->GetMapMgr());

                ByteBuffer buf(2500);
                uint32 count = pItem->BuildCreateUpdateBlockForPlayer(&buf, Plr);
                Plr->PushCreationData(&buf, count);
            }
        }
    }
}

void SetupPlayerCommands(ScriptMgr * mgr)
{
    mgr->register_hook(SERVER_HOOK_EVENT_ON_CHAT, (void *) EventPlayerCommands);
}
Gl and if it works HF
you copied your script twice in the code box