So this is another of my team's releases, from Snailz btw. He gave me permission to post it here, so im sharing
PVPMoney.cpp
Code:
/***********************************************************
* *
* *
* ****************************** *
* * * *
* * The FrostTeam Project * *
* * Snailz * *
* ****************************** *
* *
* *
* --FrostTeam SVN consists of the latest WotLK *
* scripts, both Lua and C++. Some will be our own, *
* some will be others with credits attatched. Our *
* Svn includes all scripts that you may need *
* to help make your server a more fun environment.-- *
* *
************************************************************/
#include "StdAfx.h"
#include "Setup.h"
void onPvpKill(Player* plr, Player* victim)
{
if( plr->GetTeam() != victim->GetTeam())
{
char message[200];
sprintf(message, "%s has killed %s", plr->GetName(), victim->GetName()); // In the Quotes "%s has killed %s" this will be announce when someone killed someone %s being killers then victims name
sWorld.SendWorldWideScreenText(message);
int32 gold_check_p = plr->GetUInt32Value( PLAYER_FIELD_COINAGE );
int32 gold_check_v = victim->GetUInt32Value( PLAYER_FIELD_COINAGE );
int32 new_gold_p = gold_check_p + 50000;// Coinage added on kill
int32 new_gold_v;
if(gold_check_v < 50000)// If player has 5 gold wont remove any
{
new_gold_v = 0;
}
else
{
new_gold_v = gold_check_v - 50000;//Coinage lost on death. Remember, 50000 = 5 Gold
}
plr->SetUInt32Value( PLAYER_FIELD_COINAGE, new_gold_p );
victim->SetUInt32Value( PLAYER_FIELD_COINAGE, new_gold_v );
}
}
void SetupPvPMoney(ScriptMgr * mgr)
{
mgr->register_hook(SERVER_HOOK_EVENT_ON_KILL_PLAYER, (void*)onPvpKill);
}
Basically, when you kill a player, you will get 5gold, and the deceased player will lose 5gold :P
frosteam - Revision 41: /