コード例 #1
0
        public void MAIN_OnPlayerConnect(Entity player)
        {
            try
            {
                player.SetField("spawnevent", 0);
                player.SetField("isConnecting", 0);
                GroupsDatabase.Group playergroup = player.GetGroup(database);
                WriteLog.Info("# Player " + player.Name + " from group \"" + playergroup.group_name + "\" connected.");
                WriteLog.Info("# GUID: " + player.GUID.ToString() + " IP: " + player.IP.ToString());
                WriteLog.Info("# HWID: " + player.GetHWID() + " ENTREF: " + player.GetEntityNumber());
                if (string.IsNullOrEmpty(player.GetXNADDR().Value))
                {
                    throw new Exception("Bad xnaddr");
                }
                WriteLog.Info("# XNADDR(12): " + player.GetXNADDR().ToString());
                if (!player.IsPlayer || player.GetHWID().IsBadHWID())
                {
                    throw new Exception("Invalid entref/hwid");
                }
            }
            catch (Exception)
            {
                WriteLog.Info("# Haxor connected. Could not retrieve/set player info. Kicking...");
                try
                {
                    HaxLog.WriteInfo("----STARTREPORT----");
                    HaxLog.WriteInfo("BAD PLAYER");
                    HaxLog.WriteInfo(player.ToString());
                }
                catch (Exception ex)
                {
                    HaxLog.WriteInfo("ERROR ON TOSTRING");
                    HaxLog.WriteInfo(ex.ToString());
                }
                finally
                {
                    HaxLog.WriteInfo("----ENDREPORT----");
                }
                AfterDelay(100, () =>
                {
                    ExecuteCommand("dropclient " + player.GetEntityNumber() + " \"Something went wrong. Please restart TeknoMW3 and try again.\"");
                });
            }

            UTILS_SetCliDefDvars(player);

            if (bool.Parse(Sett_GetString("settings_enable_connectmessage")) == true)
            {
                WriteChatToAll(Sett_GetString("format_connectmessage").Format(new Dictionary <string, string>()
                {
                    { "<player>", player.Name },
                    { "<playerf>", player.GetFormattedName(database) },
                }));
            }

            string line = "[CONNECT] " + string.Format("{0} : {1}, {2}, {3}, {4}, {5}", player.Name.ToString(), player.GetEntityNumber().ToString(), player.GUID, player.IP.Address.ToString(), player.GetHWID().Value, player.GetXNADDR().ToString());

            line.LogTo(PlayersLog, MainLog);
        }
コード例 #2
0
 public void SNIPE_PeriodicChecks(Entity player, Entity inflictor, Entity attacker, int damage, int dFlags, string mod, string weapon, Vector3 point, Vector3 dir, string hitLoc)
 {
     if (ConfigValues.ISNIPE_SETTINGS.ANTIFALLDAMAGE && mod == "MOD_FALLING")
     {
         player.Health += damage;
         return;
     }
     if (!attacker.IsPlayer)
     {
         return;
     }
     if (weapon == "iw5_usp45_mp_tactical" && Call <string>("getdvar", "g_gametype") == "infect" && attacker.GetTeam() != "allies")
     {
         return;
     }
     if (ConfigValues.ISNIPE_SETTINGS.ANTIWEAPONHACK && !SNIPE_IsWeaponAllowed(weapon) && !CMDS_IsRekt(attacker))
     {
         try
         {
             WriteLog.Info("----STARTREPORT----");
             WriteLog.Info("Bad weapon detected: " + weapon + " at player " + attacker.Name);
             HaxLog.WriteInfo("----STARTREPORT----");
             HaxLog.WriteInfo("BAD WEAPON: " + weapon);
             HaxLog.WriteInfo("Player Info:");
             HaxLog.WriteInfo(attacker.Name);
             HaxLog.WriteInfo(attacker.GUID.ToString());
             HaxLog.WriteInfo(attacker.IP.ToString());
             HaxLog.WriteInfo(attacker.GetEntityNumber().ToString());
         }
         finally
         {
             WriteLog.Info("----ENDREPORT----");
             HaxLog.WriteInfo("----ENDREPORT----");
             player.Health += damage;
             CMDS_Rek(attacker);
             WriteChatToAll(Command.GetString("rek", "message").Format(new Dictionary <string, string>()
             {
                 { "<target>", attacker.Name },
                 { "<targetf>", attacker.GetFormattedName(database) },
                 { "<issuer>", ConfigValues.ChatPrefix },
                 { "<issuerf>", ConfigValues.ChatPrefix },
             }));
         }
     }
 }
コード例 #3
0
        public void SNIPE_PeriodicChecks(Entity player, Entity inflictor, Entity attacker, int damage, int dFlags, string mod, string weapon, Vector3 point, Vector3 dir, string hitLoc)
        {
            if (ConfigValues.ISNIPE_SETTINGS.ANTIFALLDAMAGE && mod == "MOD_FALLING")
            {
                player.Health += damage;
                return;
            }
            if (!attacker.IsPlayer)
            {
                return;
            }

            if (attacker.HasField("CMD_FLY"))
            {
                if (attacker.IsSpectating() || !attacker.IsAlive)
                {
                    player.Health += damage;
                }
            }

            if (weapon == "iw5_usp45_mp_tactical" && Call <string>("getdvar", "g_gametype") == "infect" && attacker.GetTeam() != "allies")
            {
                return;
            }
            if (ConfigValues.ISNIPE_SETTINGS.ANTINOSCOPE && (UTILS_GetFieldSafe <int>(attacker, "weapon_fired_noscope") == 1))
            {
                player.Health += damage;
            }
            if (ConfigValues.ISNIPE_SETTINGS.ANTICRTK && (weapon == "throwingknife_mp") && (attacker.Origin.DistanceTo2D(player.Origin) < 200f))
            {
                player.Health += damage;
                player.Call("iprintlnbold", new Parameter[] { Lang_GetString("Message_CRTK_NotAllowed") });
            }
            if (ConfigValues.ISNIPE_SETTINGS.ANTIBOLTCANCEL && (UTILS_GetFieldSafe <int>(attacker, "weapon_fired_boltcancel") == 1))
            {
                player.Health += damage;
            }

            if (ConfigValues.ISNIPE_SETTINGS.ANTIWEAPONHACK && !SNIPE_IsWeaponAllowed(weapon) && !CMDS_IsRekt(attacker))
            {
                try
                {
                    WriteLog.Info("----STARTREPORT----");
                    WriteLog.Info("Bad weapon detected: " + weapon + " at player " + attacker.Name);
                    HaxLog.WriteInfo("----STARTREPORT----");
                    HaxLog.WriteInfo("BAD WEAPON: " + weapon);
                    HaxLog.WriteInfo("Player Info:");
                    HaxLog.WriteInfo(attacker.Name);
                    HaxLog.WriteInfo(attacker.GUID.ToString());
                    HaxLog.WriteInfo(attacker.IP.ToString());
                    HaxLog.WriteInfo(attacker.GetEntityNumber().ToString());
                }
                finally
                {
                    WriteLog.Info("----ENDREPORT----");
                    HaxLog.WriteInfo("----ENDREPORT----");
                    player.Health += damage;
                    CMDS_Rek(attacker);
                    WriteChatToAll(Command.GetString("rek", "message").Format(new Dictionary <string, string>()
                    {
                        { "<target>", attacker.Name },
                        { "<targetf>", attacker.GetFormattedName(database) },
                        { "<issuer>", ConfigValues.ChatPrefix },
                        { "<issuerf>", ConfigValues.ChatPrefix },
                    }));
                }
            }
        }