View Full Version : help for create a script
hamed_tay
05-11-2009, 11:12 AM
hi
i wana add some scripts that when a group win in a battle ground pvp this script give the winners members 5 token
is there any body can help me
tanx :)
Deadly02
05-11-2009, 11:58 AM
i think that is possible with core editing. And btw ~WRONG SECTION~
Ooberstan
05-11-2009, 12:33 PM
This can be done with a LUA or C + + script, but i'm not certain of the script.
Sorry.
WRONG SECTION
Die_Nasty
05-11-2009, 12:36 PM
This is done through a C++ Script
Check the Scripts folder in Realeases and you may find your answher.
Or else for another time try using the Search mechanism.
hamed_tay
05-12-2009, 10:37 AM
can you tell me where can i check and what must change in core base .plz help me and sorry for my bad EN.
GodofWrath
05-12-2009, 06:14 PM
Credits to Jotox from mmowned.
Change the Token(s) amount if you want.
//Arena PvP Script
//Made By Jotox/Classic
//------------------------------
//Configs.
//------------------------------
//Level required to participate.
#define REQUIRED_LEVEL 80
//Base amount of points awarded
#define NUM_POINTS 40
//Number of points lost on death
#define POINTS_DEATH 10
//Allow parties to PvP (0 for no)
#define PARTY_ALLOWED 1
//Allow Raids to PvP (0 for no) Default: no (It results in 30 vs 1)
#define RAIDS_ALLOWED 0
//---------------------------
//End Config.
//---------------------------
#include "StdAfx.h"
#include "Setup.h"
void GivePoints( Player* player, int32 points)
{
if( points < 0 )
player->m_arenaPoints = ((int32)player->m_arenaPoints > (-1)*(points)) ? player->m_arenaPoints + points : 0;//Subtract points, or set to 0 if they don't have enough.
else
player->m_arenaPoints += points;
player->SetUInt32Value(PLAYER_FIELD_ARENA_CURRENCY, player->m_arenaPoints);
}
void OnPlayerKill(Player * pPlayer, Player * pVictim)
{
if( pPlayer->getLevel() < REQUIRED_LEVEL || pVictim->getLevel() < REQUIRED_LEVEL)
return;
if( !pPlayer->HasFlag(PLAYER_FLAGS, PLAYER_FLAG_FREE_FOR_ALL_PVP) || !pVictim->HasFlag(PLAYER_FLAGS, PLAYER_FLAG_FREE_FOR_ALL_PVP) )
return;
Group *pGroup = pPlayer->GetGroup();
if( pGroup && pGroup->GetGroupType() == GROUP_TYPE_RAID && RAIDS_ALLOWED==0)
{
SubGroup * sgr;
for(uint32 i = 0; i < pPlayer->GetGroup()->GetSubGroupCount(); ++i)
{
sgr = pPlayer->GetGroup()->GetSubGroup(i);
pPlayer->GetGroup()->Lock();
for(GroupMembersSet::iterator itr = sgr->GetGroupMembersBegin(); itr != sgr->GetGroupMembersEnd(); ++itr)
{
if((*itr)->m_loggedInPlayer)
(*itr)->m_loggedInPlayer->BroadcastMessage("%sYou cannot gain arena points while in a raid group.", "|cffff0000");
}
pPlayer->GetGroup()->Unlock();
}
return;
}
int32 Points = NUM_POINTS;
if( PARTY_ALLOWED!=0 && pPlayer->GetGroup() )
{
set<Player*> group_members;
Group * Group = pPlayer->GetGroup();
SubGroup * SubGroup = pGroup->GetSubGroup(pPlayer->GetSubGroup());
if( !Group || !SubGroup )
return;//Just in case.
for(GroupMembersSet::iterator itr = SubGroup->GetGroupMembersBegin(); itr != SubGroup->GetGroupMembersEnd(); itr++)
{
PlayerInfo * pi = (*itr);
Player * gm = objmgr.GetPlayer(pi->guid);
if( !gm || gm == pPlayer)
continue;
if(gm->isInRange(pPlayer, 100.0f) && gm->CombatStatus.IsInCombat())
group_members.insert(gm);
}
Points = (Points / group_members.size());//Divide by group members.
if( Points % 5)
Points += 5 - (Points % 5);//Round up to the nearest 5.
for(set<Player*>::iterator itr = group_members.begin(); itr != group_members.end(); itr++)
{
GivePoints((*itr), Points);
(*itr)->BroadcastMessage("You have gained %u Arena Points from a party member's kill.", Points);
}
}
GivePoints( pPlayer, Points );
if( pPlayer->GetSession() )
pPlayer->GetSession()->SendNotification("%sYou gain %u Arena Points.", "|cff00ff00", Points);
GivePoints( pVictim, (-1)*(int32)POINTS_DEATH);
if(pVictim->GetSession())
pVictim->GetSession()->SendNotification("%sYou lose %u Arena Points.", "|cffff0000", POINTS_DEATH);
}
void SetupArenaPvP(ScriptMgr * mgr)
{
mgr->register_hook(SERVER_HOOK_EVENT_ON_KILL_PLAYER, &OnPlayerKill);
}
hamed_tay
05-13-2009, 09:45 AM
tanx a lot. so i wana add token ( badge of justic ) instead of arena point .how can i fix this? for example when a group go battleground the winner group gives for example 5 badge justic. how can i change this tanx
Is there any body can help?
is there any body can help me?
vBulletin® v3.8.7, Copyright ©2000-2012, vBulletin Solutions, Inc.