Omfg. This is so epix, i love you
+rep
Edit:
I've tryed it and it doesnt work, im 100% sure im done something wrong so could you please check what i've done wrong?
( I removed the Quest Part Becouse the quest doesnt exist yet )
Code:
#include "StdAfx.h"
#include "Setup.h"
//This function is taken from Spectre's PvP Script, which can be seen at the AspireScripts SVN
// svn://svn.aspiredev.org/AspireDev
//<3
void AddItem(Player* Plr, const uint32 &ItemID, const uint32 &Amt, const bool &Stack)
{
Item *ItemToAdd;
SlotResult Slot;
if(Plr == NULL)
return;
if(Stack)
{
ItemToAdd = Plr->GetItemInterface()->FindItemLessMax(999000, 1, false);
if(ItemToAdd != NULL)
{
ItemToAdd->ModUnsigned32Value(ITEM_FIELD_STACK_COUNT, Amt);
ItemToAdd->m_isDirty = true;
Plr->BroadcastMessage("%s%s x%u Awarded", MSG_COLOR_GOLD, ItemToAdd->GetProto()->Name1, Amt);
return;
}
}
for(uint32 i = 1;i <= Amt;i++)
{
ItemToAdd = objmgr.CreateItem(999000, Plr);
if(ItemToAdd == NULL)
return; // failed creation, no memory to allocate, or invalid item id
Slot = Plr->GetItemInterface()->FindFreeInventorySlot(ItemToAdd->GetProto());
if(Slot.Result)
{
Plr->GetItemInterface()->SafeAddItem(ItemID, Slot.ContainerSlot, Slot.Slot);
Plr->BroadcastMessage("%s%s x1 Awarded", MSG_COLOR_GOLD, ItemToAdd->GetProto()->Name1);
}
else
Plr->BroadcastMessage("No free inventory slots could be located, aborting");
}
}
void OnKill(Player* pPlayer, Player* pVictim)
{
if(pPlayer->GetMapId() != 37 || pVictim->GetMapId() != 37)
return; //Both players need to be at map 37
if(pPlayer->GetLowGUID() == pVictim->GetLowGUID())
return; //No award for suicide
if(pVictim->getLevel() < pPlayer->getLevel())
return; //Only kill your own level and above
if(pPlayer->GetTeam() == pVictim->GetTeam())
return; //Only kill from the other faction
}
void SetupPVPScript(ScriptMgr* mgr)
{
mgr->register_hook(SERVER_HOOK_EVENT_ON_PLAYER_KILL, (void*)&OnKill);
}
BTW: i only have to save it as an .LUA file and save it in scripts, right? First time i used a script so im not sure how to do.