Onlykl
04-07-09, 12:00 PM
This script rewards a player with XP for killing a player of the opposite faction.
I added setup.cpp & setup.h for ppls who dont know how to set it up.
Script:
/*********************************/
/* Scripted by ToAsT */
/*********************************/
#include "StdAfx.h"
#include "Setup.h"
void KillPlayer(Player *pPlayer, Player *pVictim)
{
uint32 plr_level = pPlayer->getLevel();
uint32 vic_level = pVictim->getLevel();
if( vic_level <= ( plr_level - 10 ) || vic_level >= ( 10 + plr_level) )
return;
CalculateXP(pPlayer);
}
void CalculateXP( Player * pPlayer )
{
uint32 plr_level = pPlayer->getLevel();
uint32 xp1;
if( plr_level <= 10 )
{
xp1 = 200;
}else if( plr_level <= 20 )
{
xp1 = 500;
}else if( plr_level <= 30 )
{
xp1 = 1000;
}else if( plr_level <= 40 )
{
xp1 = 1500;
}else if( plr_level <= 50 )
{
xp1 = 2000;
}else if( plr_level <= 60 )
{
xp1 = 2500;
}else if( plr_level <= 69 )
{
xp1 = 3000;
}
pPlayer->GiveXP(xp1,0,false);
}
void SetupPlayerXP(ScriptMgr * mgr)
{
mgr->register_hook(SERVER_HOOK_EVENT_ON_KILL_PLAYER, &KillPlayer);
}
Setup.h:
#ifndef INSTANCE_SCRIPTS_SETUP_H
#define INSTANCE_SCRIPTS_SETUP_H
void SetupPlayerXP(ScriptMgr * mgr);
void CalculateXP(Player * pPlayer);
#endif
Setup.cpp:
#include "StdAfx.h"
#include "Setup.h"
#define SKIP_ALLOCATOR_SHARING 1
#include <ScriptSetup.h>
extern "C" SCRIPT_DECL uint32 _exp_get_script_type()
{
return SCRIPT_TYPE_MISC;
}
extern "C" SCRIPT_DECL void _exp_script_register(ScriptMgr* mgr)
{
SetupPlayerXP(mgr);
}
#ifdef WIN32
BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved )
{
return TRUE;
}
#endif
Credits
Toast from ArcEmu forums
I added setup.cpp & setup.h for ppls who dont know how to set it up.
Script:
/*********************************/
/* Scripted by ToAsT */
/*********************************/
#include "StdAfx.h"
#include "Setup.h"
void KillPlayer(Player *pPlayer, Player *pVictim)
{
uint32 plr_level = pPlayer->getLevel();
uint32 vic_level = pVictim->getLevel();
if( vic_level <= ( plr_level - 10 ) || vic_level >= ( 10 + plr_level) )
return;
CalculateXP(pPlayer);
}
void CalculateXP( Player * pPlayer )
{
uint32 plr_level = pPlayer->getLevel();
uint32 xp1;
if( plr_level <= 10 )
{
xp1 = 200;
}else if( plr_level <= 20 )
{
xp1 = 500;
}else if( plr_level <= 30 )
{
xp1 = 1000;
}else if( plr_level <= 40 )
{
xp1 = 1500;
}else if( plr_level <= 50 )
{
xp1 = 2000;
}else if( plr_level <= 60 )
{
xp1 = 2500;
}else if( plr_level <= 69 )
{
xp1 = 3000;
}
pPlayer->GiveXP(xp1,0,false);
}
void SetupPlayerXP(ScriptMgr * mgr)
{
mgr->register_hook(SERVER_HOOK_EVENT_ON_KILL_PLAYER, &KillPlayer);
}
Setup.h:
#ifndef INSTANCE_SCRIPTS_SETUP_H
#define INSTANCE_SCRIPTS_SETUP_H
void SetupPlayerXP(ScriptMgr * mgr);
void CalculateXP(Player * pPlayer);
#endif
Setup.cpp:
#include "StdAfx.h"
#include "Setup.h"
#define SKIP_ALLOCATOR_SHARING 1
#include <ScriptSetup.h>
extern "C" SCRIPT_DECL uint32 _exp_get_script_type()
{
return SCRIPT_TYPE_MISC;
}
extern "C" SCRIPT_DECL void _exp_script_register(ScriptMgr* mgr)
{
SetupPlayerXP(mgr);
}
#ifdef WIN32
BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved )
{
return TRUE;
}
#endif
Credits
Toast from ArcEmu forums