Перейти к содержимому
View in the app

A better way to browse. Learn more.

Zloplay community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Опубликовано:

I got a request from =[DNS]=WildCat to fix some issues with the original AntiCamp which I did. As I think it may be also useful for other people I release the source here.

 

Changes I did to the original AntiCamp:

- Add check if player is using killstreak weapon

- Add check if player is using sentry turret

- Add customizable distance

- Add customizable time for checking distance

- Add customizable option for max warnings -> when the player reaches maximum he will suicide

 

To use the custom option you add in your server config:

seta scr_ac_time 4000 //milliseconds for check
seta scr_ac_distance 50
scr_ac_maxwarnings 2

Change the above values to your need.

 

Source code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using InfinityScript;

namespace InfinityScript.Examples
{
   public class AntiCamp : BaseScript
   {
       private bool _donePrematch = false;
       private List _safeTriggers = new List();
       private int Distance = 50;
       private int CheckTime = 4000;
       private int[] Warnings = new int[18];
       private int MaxWarnings = 2;

       private static bool isKillstreakWep(string wep)
       {
           if (wep.Contains("ac130"))
               return true;
           if (wep.Contains("remote"))
               return true;
           if (wep.Contains("minigun"))
               return true;
           return false;
       }

       public AntiCamp()
       {
           Call("setdvarifuninitialized", "scr_ac_time", 4000);
           Call("setdvarifuninitialized", "scr_ac_distance", 50);
           Call("setdvarifuninitialized", "scr_ac_maxwarnings", 2);
           Distance = Call("getdvarint", "scr_ac_distance");
           CheckTime = Call("getdvarint", "scr_ac_time");
           MaxWarnings = Call("getdvarint", "scr_ac_maxwarnings");
           if (CheckTime < 500)
               CheckTime = 500;

           var gameType = Call("getDvar", "g_gametype").ToLower();

           for (int i = 0; i < 2048; i++)
           {
               var entity = Call("getEntByNum", i);

               if (entity != null)
               {
                   var targetname = entity.GetField("targetname");

                   if (gameType == "dom")
                   {
                       if (targetname == "flag_primary" || targetname == "flag_secondary")
                       {
                           _safeTriggers.Add(entity);
                       }
                   }
                   else if (gameType == "koth")
                   {
                       if (targetname == "radiotrigger")
                       {
                           _safeTriggers.Add(entity);
                       }
                   }
               }
           }

           // only trigger anticamp after the game started
           OnNotify("prematch_done", () =>
           {
               _donePrematch = true;
           });

           // don't trigger anticamp after the game ended
           OnNotify("game_over", () =>
           {
               _donePrematch = false;
           });

           PlayerConnecting += new Action(entity =>
           {
               // bombsite using
               entity.SetField("ac_using", 0);
               //using remote
               entity.SetField("ac_remote", 0);

               entity.OnNotify("use_hold", player =>
               {
                   player.SetField("ac_using", 1);
               });

               entity.OnNotify("done_using", player =>
               {
                   player.SetField("ac_using", 0);
               });

               entity.OnNotify("using_remote", player =>
                   {
                       player.SetField("ac_remote", 1);
                   });

               entity.OnNotify("stopped_using_remote", player =>
                   {
                       player.SetField("ac_remote", 0);
                   });

               //entity.OnInterval(4000, player =>
               entity.OnInterval(CheckTime, player =>
               {
                   int entNum = player.Call("getentitynumber");
                   if (!player.IsAlive)
                   {
                       goto _Reset;
                   }

                   if (!_donePrematch)
                   {
                       goto _Reset;
                   }

                   if (player.GetField("ac_using") != 0)
                   {
                       goto _Reset;
                   }
                   if (player.GetField("ac_remote") != 0)
                   {
                       goto _Reset;
                   }
                   if (isKillstreakWep(player.CurrentWeapon))
                       goto _Reset;

                   foreach (var safeEntity in _safeTriggers)
                   {
                       if (player.Call("istouching", safeEntity) != 0)
                       {
                           Log.Write(LogLevel.Trace, "touching safe entity");
                           goto _Reset;
                       }
                   }

                   if (player.Call("istalking") != 0)
                   {
                       Log.Write(LogLevel.Trace, "talking");
                       goto _Reset;
                   }

                   if (player.Call("isusingturret") != 0)
                   {
                       goto _Reset;
                   }

                   if (player.HasField("ac_lastPos"))
                   {
                       var lastPos = player.GetField("ac_lastPos");

                       //why no height difference?
                       //if (lastPos.DistanceTo2D(player.Origin) < 50)
                       if (lastPos.DistanceTo(player.Origin) < Distance)
                       {
                           player.Call("iprintlnbold", "You will be killed if you do not move.");

                           Warnings[entNum]++;
                           if (Warnings[entNum] >= MaxWarnings)
                           {
                               player.Call("suicide");
                               goto _Reset;
                           }
                       }
                   }
                   goto _NoReset;

               _Reset:
                   Warnings[entNum] = 0;

               _NoReset:
                   player.SetField("ac_lastPos", player.Origin);
                   return true;
               });
           });
       }
   }
}

 

Credits to NTAuthority or whoever made the original AntiCamp example.

Опубликовано:

The original anti-camp also had an issue in wich a player would never die if the regen time was less than the checks time (only noticed it 2 days ago when I tried messing with the check times)

I had to set an 8s regen time for 7s checks, or the player would just regen before the next check, meaning that he would get low life again, rather than dying.

Did you work on that issue aswell?

Опубликовано:
:D is it possible to add a sniper exception on it i was thinking of adding but i have a friend that only uses sniper and he cant Quick Scope to save his life like my self., i don't have a problem people using a sniper rifle sitting and waiting it the mp7 and ump shot gun etc that bothers me thx if not could you just compile one for me to use on server i am making i dont understand coding and c# thanks :oops:
  • 2 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Гость
Ответить в тему...

Сейчас на странице 0

  • Нет пользователей, просматривающих эту страницу

Важная информация

Используя этот сайт, вы соглашаетесь Условия использования.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.