zoukankan      html  css  js  c++  java
  • 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;
    }
  • 相关阅读:
    [置顶] MySQL Cluster初步学习资料整理--安装部署新特性性能测试等
    ubuntu下设置开机自启动项
    【JSP】Cookie的使用及保存中文,并用Cookie实现购物车功能
    汉语-词语:笑面虎
    汉语-词语:阴险
    汉语-词语:奸猾
    汉语-词语:奸诈
    汉语-词语:厚道
    汉语-词语:忠厚
    汉语-词语:狡猾
  • 原文地址:https://www.cnblogs.com/needly/p/3751614.html
Copyright © 2011-2022 走看看