Hello, ive been trying to get PvP tokens into my server, (whenever you kill an enemy player you will be rewarded with this) however it will just give me an error, I cant stand it ive been trying to fix this but no success, so now im asking you, could you help me solve this problem?
Script:
#include "StdAfx.h"
#include "Setup.h"
#define GOLD_AMOUNT 1000000 //it is in copper
#define PVP_TOKEN 44115 //Put Your Token ID Here
char message[200];
sprintf(message, "|cff00ff00[World PvP]|r |cffff0000%s has killed %s...The hunt begins!|r", plr->GetName(), victim->GetName());
sWorld.SendWorldWideScreenText(message);
sLog.outColor(TRED,"\n[WPVP]: WPVP Activated - the killer was %s...The victim was %s.", plr->GetName(), victim->GetName());
sLog.outColor(TNORMAL,"\n");
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 + GOLD_AMOUNT;
int32 new_gold_v;
if(gold_check_v < GOLD_AMOUNT)
{
new_gold_v = 0;
}
else
{
int Chance = 20;
int Generator = RandomUInt(100);
if(Generator <= Chance)
{
plr->GetItemInterface()->SafeAddItem(PVP_TOKEN, INVENTORY_SLOT_NOT_SET, -1);
Item * it = objmgr.CreateItem(PVP_TOKEN, plr);
plr->GetItemInterface()->AddItemToFreeSlot(it);
sLog.outColor(TGREEN,"[WPVP]: A Token was added for this kill to %s", plr->GetName());
sLog.outColor(TNORMAL,"\n");
}
else
{
sLog.outColor(TYELLOW,"[WPVP]: A Token was not added to %s", plr->GetName());
sLog.outColor(TNORMAL,"\n");
}
}
}
void SetupPvP(ScriptMgr * mgr)
{
mgr->register_hook(SERVER_HOOK_EVENT_ON_KILL_PLAYER, (void*)onPvpKill);
}
Ive have this in notepad, im opening this with HeidiSQL, my database. When I try to execute it, it will give me an error:
http://img828.imageshack.us/img828/374/4584.png
Whenever I remove those words what this error gives me, I keep getting more and more error's, is it me, am I stupid or is this just a messed up script?
Thanks for your time, -Cynthia.