T端设置PVP物品掉落,防止同IP刷

 1、只允许玩家在某些地方PVP才能获得物品

2、判断玩家是否在同一个IP下PVP,。如果是同IP的PVP,那么就无法获得奖励

3、同时要判断玩家是否有免荣誉的BUFF,否则不奖励的!


这个是判断是否在同一个IP下进行PVP作弊的判断条件!如果是在网吧~~~几个朋友一起PVP,那么就要慎重考虑是否用这个了!
killer->GetSession()->GetRemoteAddress()
==
victim->GetSession()->GetRemoteAddress()


这个是判断是否在指定的地区PVP的!
killer->GetAreaId()
== AREAIDONE || killer->GetAreaId() == AREAIDTWO

 

以下是完整代码:

//itemonkill.cpp
// Made By Sinistah/ToxicDev
 
enum config
{
    TOKEN = 11111, // Entry Id Of The Item Defined Here
    AMMOUNT = 1,    // Ammount Of The TOKEN's Given
    AREAIDONE = 172, // Area Id For Location One
    AREAIDTWO = 232 // Area Id For Location Two
};  
 
class itemonkill : public PlayerScript
{
public: 
    itemonkill() : PlayerScript("itemonkill") { }
 
    void OnPVPKill(Player * killer, Player * victim)
    {
        if ((killer->GetAreaId() == AREAIDONE || killer->GetAreaId() == AREAIDTWO) && killer->GetGUID() != victim->GetGUID())
        {
            if (killer->GetSession()->GetRemoteAddress() == victim->GetSession()->GetRemoteAddress())
                killer->GetSession()->SendNotification("[PvP System] Your Victim Has Same Ip Adress As You! No Reward Was Given.");
            else if (victim->HasAura(2479))
                killer->GetSession()->SendNotification("[PvP System] Your Victim Had Honorless Target Aura! No Reward Was Given");
            else
            {
                killer->GetSession()->SendNotification("[PvP System] You Were Rewarded For Killing %s!", victim->GetName());    
                killer->AddItem(TOKEN, AMMOUNT);
            }
        }
    }
};
 
void AddSC_itemonkill()
{
    new itemonkill;
}

 

posted @ 2014-05-25 21:20  needly  阅读(398)  评论(0编辑  收藏  举报