Hello,
I've modified some scripts and merged them together since I suck at C++
Code:
#include "StdAfx.h"
#include "Setup.h"
void AddGold(uint32 gold, Player * Plr)
{
uint32 gamm = Plr->GetUInt32Value(PLAYER_FIELD_COINAGE);
uint32 goldammount = gamm + gold;
Plr->SetUInt32Value(PLAYER_FIELD_COINAGE, goldammount);
}
void TakeGold(uint32 gold, Player * Plr)
{
uint32 gamm = Plr->GetUInt32Value(PLAYER_FIELD_COINAGE);
uint32 goldammount = gamm - gold;
Plr->SetUInt32Value(PLAYER_FIELD_COINAGE, goldammount);
}
void OnPlayerKill(Player* attacker, Player* victim)
{
AddGold(10000, attacker);
if( attacker->GetSession() )
attacker->GetSession()->SendNotification("%sYou gain %u Gold.", "|cff00ff00", 1);
TakeGold(5000, victim);
if( victim->GetSession() )
victim->GetSession()->SendNotification("%sYou lost %u Silver.", "|cff00ff00", 50);
}
void SetupArenaPvP(ScriptMgr * mgr)
{
mgr->register_hook(SERVER_HOOK_EVENT_ON_KILL_PLAYER, &OnPlayerKill);
}
Everything works fine, except the 'TakeGold'.
It crashes the server if I kill another player.
Does anyone know what the problem is?