As it has been done many times before in Lua, I'm now going to demonstrate a C++ script including player commands. (Yuh, I wanne be unique.) To start of I'm keeping this basic commands, but while progressing I might add more functions on request.


Code:
/* Credits claimed by AuxProductions.

More functions WILL be added on request.
*/

#include "StdAfx.h"
#include "Setup.h"

#ifdef WIN32
#pragma warning(disable:4305) // Disables the funky warning.
#endif

// Defines.
#define FOOD 35953 // http://www.wowhead.com/?item=35953
#define DRINK 33445 // http://www.wowhead.com/?item=33445

// Command Registration
static string food     = "%food";                 // Adds the item '35953'.
static string drink     = "%drink";         // Adds the item '33445'.
static string buffs        ="%buffs";       // Buffs the player.


/*            FOOOD COMMAND     */
if(Message == food && !Plr->CombatStatus.IsInCombat()) {                             //Combat check
            Item * item;                                                                                 
            item = objmgr.CreateItem(food, Plr);                                                         
            item->SetUInt32Value(ITEM_FIELD_STACK_COUNT, 10);                                            
            if(!Plr->GetItemInterface()->AddItemToFreeSlot(item)) 
            {                                     
                Plr->BroadcastMessage("No free slots were found in your inventory!");                     
                item->DeleteMe();                                                                         
            } 
            else 
            { 
                SlotResult * sr;                                                                                         
                sr = Plr->GetItemInterface()->LastSearchResult();                                                         
                Plr->GetSession()->SendItemPushResult(item, false, true, false, true, sr->ContainerSlot, sr->Slot, 1);    
            }
            } 
            else 
            {
                Plr->BroadcastMessage("You cannot use this command when in combat!");                     
            }
        
/*        DRINK COMMAND        */
if(Message == drink && !Plr->CombatStatus.IsInCombat()) {                             //Combat check
            Item * item;                                                                                 
            item = objmgr.CreateItem(DRINK, Plr);                                                         
            item->SetUInt32Value(ITEM_FIELD_STACK_COUNT, 10);                                            
            if(!Plr->GetItemInterface()->AddItemToFreeSlot(item)) 
            {                                     
                Plr->BroadcastMessage("No free slots were found in your inventory!");                     
                item->DeleteMe();                                                                         
            } 
            else 
            { 
                SlotResult * sr;                                                                                         
                sr = Plr->GetItemInterface()->LastSearchResult();                                                         
                Plr->GetSession()->SendItemPushResult(item, false, true, false, true, sr->ContainerSlot, sr->Slot, 1);    
            }
            } 
            else 
            {
                Plr->BroadcastMessage("You cannot use this command when in combat!");                     
            }
            
/*       BUFFS                  */
        if(Message == buffs && !Plr->CombatStatus.IsInCombat()) 
        {                             
            Plr->CastSpell(Plr, 20217, true);          // BoK
            plr->CastSpell(Plr, 48469, true);         // Mark of the wild.
            
            Plr->BroadcastMessage("You are now buffed!");     
                 }

Have fun, and note this is NOT copied from anyone.



Note : I havn't got the chance to test this yet, so might be missing a bracket perhaps. Would be nice if someone tested it. ^^