Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Anti camp script
#1
One of the many, but here's mine:
Code:
onPlayerSpawn()
{
    if(getdvarint("scr_anticamp") == 0)
        return;
    wait 5;    //spawn wait
    self thread AntiCamp();
}

AntiCamp()
{
    level endon( "game_ended" );
    self endon("disconnect");
    self endon("joined_spectators");
    self endon ( "death" );

    DefaultCampTime = getdvarint("scr_maxcamptime"); //10
    MaxCampTime = DefaultCampTime;
    MinCampTime = getdvarint("scr_mincamptime"); //6
    CampDistance = getdvarint("scr_campdistance"); //50
    CampPunishTime = getdvarint("scr_camppunishtime"); //5
    CampResetTime = (getdvarint("scr_campresettime") - 1) * 1000; //16
    LastCampTime = 0;

    if(!isdefined(self.pers["camppunishment"]))
        self.pers["camppunishment"] = 0;

    L = 0;
    s = 0;

    for(c=0;;c++)
    {
        old = self.origin;
        wait 1;
        new = self.origin;
        
        L = distance( new, old );

        if( L > CampDistance )
            c = 0;
        else if( s > (CampPunishTime - 1) )
        {
            self.pers["camppunishment"]++;
            //some punishment based on how much times already got punished?
            self punish();
            s = 0;
            c = 0;
        }
        if(c > (MaxCampTime - 1))
        {
            if(s < CampPunishTime)
            {
                iprintln(self, " is Camping!");
                //ping him on radar?
                self iprintlnbold( "^1Stop Camping!" );
                self iprintlnbold( "^1" + (CampPunishTime - s) + "^7 seconds remaining before punishment" );
            }
            LastCampTime = gettime();
            s++;
        }
        else
            s = 0;
        if(s == 1 && MaxCampTime > MinCampTime)
            MaxCampTime--; //decrease next camp time.
        if( MaxCampTime != DefaultCampTime && ( getTime() - LastCampTime ) > CampResetTime )
            MaxCampTime = DefaultCampTime; //reset camp time
    }
}


punish()
{
    level endon( "game_ended" );
    self endon("disconnect");
    self endon("joined_spectators");
    self endon ( "death" );

    originX = self.origin[0];
    originY = self.origin[1];
    camparea = getdvarint( "scr_camparea" ); //120

    up = originY + camparea;
    right = originX - camparea;
    left = originX + camparea;
    down = originY - camparea;

    self iprintlnbold( " " );
    self iprintlnbold( " " );
    self iprintlnbold( " " );
    self iprintlnbold( "Move out of your camp area!" );
    self iprintlnbold( "^1Your weapons are disabled while inside." );
    self disableweapons();
    while( self isInSpace(up, right, left, down) )
        wait .05;
    self enableweapons();
    self iprintlnbold( " " );
    self iprintlnbold( " " );
    self iprintlnbold( " " );
}

isInSpace(front, right, left, rear, bottom, ceiling)
{
    if( isdefined( bottom ) && isdefined( ceiling ))
        if(self.origin[1] < front && self.origin[1] > rear && self.origin[0] > right && self.origin[0] < left && self.origin[2] < ceiling && self.origin[2] > bottom )
            return true;
    if(self.origin[1] < front && self.origin[1] > rear && self.origin[0] > right && self.origin[0] < left )
        return true;
    return false;
}
Reply

#2
it only works on the first spawn ..
(08-10-2011, 12:58)Pozzuh Wrote:
Se7en Wrote:Stealed, from cod4 mod ...
look who's talking

[Release] Old School Mod v2.2
[Release] Scroll menu

Reply

#3
(08-30-2011, 20:02)iAegle Wrote: it only works on the first spawn ..

It's a code snippet.. not a fully working code

derp
[Image: MaEIQ.png]
Reply

#4
(08-30-2011, 20:02)iAegle Wrote: it only works on the first spawn ..

You just got to thread onPlayerSpawn when player is spawned.. How hard can that be xD

Reply

#5
(08-30-2011, 20:06)Justin Wrote:
(08-30-2011, 20:02)iAegle Wrote: it only works on the first spawn ..

You just got to thread onPlayerSpawn when player is spawned.. How hard can that be xD

I know, just saying Superman

nice script, personally I would give them a Kill waypoint
(08-10-2011, 12:58)Pozzuh Wrote:
Se7en Wrote:Stealed, from cod4 mod ...
look who's talking

[Release] Old School Mod v2.2
[Release] Scroll menu

Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  [Release] iSnipe anti hardscope mutant 0 3,497 11-06-2013, 11:27
Last Post: mutant
  Need An Anti Hack Manuadminmod worldclass 2 3,734 10-14-2013, 09:57
Last Post: d0h!
  Who can create this script First_Semyon 3 4,254 09-24-2013, 18:19
Last Post: First_Semyon
  Searching for Anti HS ExoGamer* 10 6,694 08-08-2013, 12:39
Last Post: aceed
  [Release] Advanced timed messages with script support DePa95 0 4,071 08-07-2013, 19:35
Last Post: DePa95
  Help Run Infinity Script on Teknogods? Bandarigoda123 6 7,504 07-14-2013, 17:27
Last Post: surtek
  can't find script engine "VBScript" for script "C:\Windows\system32\slmgr.vbs" ddaavvee 6 24,640 06-18-2013, 03:46
Last Post: dylankrajewski
  Simple flyable helicopter script port, could use help! akillj 0 2,535 06-15-2013, 09:20
Last Post: akillj
  What script controls the "random" aspect to care packages? akillj 2 3,266 06-05-2013, 11:24
Last Post: akillj
  [Release] Anti-Invisible Name master131 24 21,510 05-02-2013, 14:15
Last Post: .sepultura.

Forum Jump:


Users browsing this thread:
2 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2024 Melroy van den Berg.