
Results 1 to 10 of 15
Thread: [Share] XP for killing a player
Threaded View
-
04-07-09, 11:00 AM #1
[Share] XP for killing a player
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:
Code:/*********************************/ /* 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:
Code:#ifndef INSTANCE_SCRIPTS_SETUP_H #define INSTANCE_SCRIPTS_SETUP_H void SetupPlayerXP(ScriptMgr * mgr); void CalculateXP(Player * pPlayer); #endif
Code:#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
Toast from ArcEmu forums