Likes: 0
Results 1 to 10 of 11
-
08-09-08, 02:42 PM #1
#food,#drink,#both Player - command's
Register to remove this adSo 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); }
› See More: #food,#drink,#both Player - command'sLast edited by You_Got_Tescoed; 08-09-08 at 03:13 PM.
-
08-09-08, 02:59 PM #2
So this adds items to a player? This has been done in lua and is 10x more simpler XD.
But still nice releaseyour mother
-
08-09-08, 03:03 PM #3
Yep Depending On What String or Text yuo type in the chat it will add you a item. Aka typeing #both will give you a mana biscuit with both health and food. 'food #water, Guess =D
-
08-09-08, 03:14 PM #4
Update!: Added Health and Mana Pot Commands.
Also a note: You may want to add Flood Protection a bit more with theese
-
08-09-08, 05:15 PM #5
-
08-09-08, 09:09 PM #6
-
09-09-09, 01:15 PM #7
-
10-09-09, 01:53 AM #8
-
10-09-09, 09:50 AM #9
are you sure that this is not a rippoff ive seen this before om ******* and acweb...
No touching please.
-
12-09-09, 06:25 PM #10
Register to remove this adI've made this before...
But it had drinks and shit for all levels...