Results 1 to 9 of 9

Thread: How to make a AntiCamperMod For SD

  1. #1
    Corporal STAUFFi's Avatar
    Join Date
    Aug 2012
    Location
    Germany
    Posts
    269
    Thanks
    106
    Thanked 128 Times in 83 Posts

    How to make a AntiCamperMod For SD

    Hey Guys
    I make now a sd mod.
    and want make a anticampermod.
    When you camp 20 sec or 15 sec.
    You will be dead.
    killtube can help me?

  2. #2
    Global Mossaderator Mitch's Avatar
    Join Date
    Nov 2012
    Posts
    654
    Thanks
    204
    Thanked 450 Times in 305 Posts
    Code:
    antiCamp()
    {
    	self endon("killed_player");
    
    	count = 0;
    	time = 15;
    
    	for(;;)
    	{
    		origin = self.origin;
    
    		wait 1;
    
    		if(self.origin == origin)
    			count++;
    		else
    			count = 0;
    
    		if(count == time)
    			self suicide();
    	}	
    }
    For standalone
    Code:
    init()
    {
    	thread onPlayerConnect();
    }
    
    onPlayerConnect()
    {
    	level endon("intermission");
    
    	for(;;)
    	{
    		level waittill("connecting", player);
    		player thread onPlayerSpawned();
    	}
    }
    
    onPlayerSpawned()
    {
    	self endon("disconnect");
    	level endon("intermission");
    
    	for(;;)
    	{
    		self waittill("spawned_player");
    		self thread antiCamp();
    	}
    }
    Last edited by Mitch; 31st January 2013 at 20:57.

  3. The Following 2 Users Say Thank You to Mitch For This Useful Post:

    kung foo man (31st January 2013),STAUFFi (31st January 2013)

  4. #3
    Private First Class Earliboy's Avatar
    Join Date
    Nov 2012
    Location
    Germany
    Posts
    130
    Thanks
    5
    Thanked 88 Times in 61 Posts
    I don't got much time, i could answer tommorow.
    But just work with self.campingPos = self.origin; and then check the distance within time.
    No ... No ... this is not possible .......

  5. #4
    Sergeant EvoloZz's Avatar
    Join Date
    Sep 2012
    Location
    Helsinki, Finland
    Posts
    360
    Thanks
    314
    Thanked 167 Times in 120 Posts
    Quote Originally Posted by Mitch View Post
    Code:
    antiCamp()
    {
    	self endon("killed_player");
    
    	count = 0;
    	time = 15;
    
    	for(;;)
    	{
    		origin = self.origin;
    
    		wait 1;
    
    		if(self.origin == origin)
    			count++;
    		else
    			count = 0;
    
    		if(count == time)
    			self suicide();
    	}	
    }
    For standalone
    Code:
    init()
    {
    	thread onPlayerConnect();
    }
    
    onPlayerConnect()
    {
    	level endon("intermission");
    
    	for(;;)
    	{
    		level waittill("connecting", player);
    		player thread onPlayerSpawned();
    	}
    }
    
    onPlayerSpawned()
    {
    	self endon("disconnect");
    	level endon("intermission");
    
    	for(;;)
    	{
    		self waittill("spawned_player");
    		self thread antiCamp();
    	}
    }
    With something like that you die immediately after spawn, at least I do

  6. #5
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,011
    Thanks
    2,102
    Thanked 1,084 Times in 753 Posts
    Try adding this:


    Code:
    antiCamp()
    {
    	self endon("killed_player");
    
    	count = 0;
    	time = 15;
    
    	for(;;)
    	{
    		origin = self.origin;
    
    		wait 1;
    
    		if(self.origin == origin && self.sessionstate != "spectator")
    			count++;
    		else
    			count = 0;
    
    		if(count == time)
    			self suicide();
    	}	
    }
    timescale 0.01

  7. #6
    Sergeant EvoloZz's Avatar
    Join Date
    Sep 2012
    Location
    Helsinki, Finland
    Posts
    360
    Thanks
    314
    Thanked 167 Times in 120 Posts
    Weird, still same

  8. #7
    Private First Class Earliboy's Avatar
    Join Date
    Nov 2012
    Location
    Germany
    Posts
    130
    Thanks
    5
    Thanked 88 Times in 61 Posts
    Well if you credit, u can use mine. I never used it, but when i tested it, it worked.

    Its longer but it kills camper that camps in a small area.
    May you need to fix the campdistance.

    If u want to enable the timer, delete the // at "self thread campHudTimer ....

    Spoiler:

    Code:
    init()
    {
    	self endon("disconnect");
    	
    	//iprintln("CampTimer: Start Loading");
    	
    	campDistance = 1200;
    	campTime = getCvarInt("scr_camptime");
    	if(campTime == "")
    		campTime = 30;
    	else if(campTime <= 5)
    		campTime = 10;
    	
    	self.campTimer = 0;
    	
    	while(true)
    	{
    		if(getCvar("scr_camptimer") == "0")
    			return;
    		wait .05;
    		if(!isAlive(self))
    		{
    			self.camping = undefined;
    			self.campTimer = 0;
    			self.camping = false;
    			continue;
    		}
    		else
    		{
    			if(!isDefined(self.camping))
    			{
    				self.camping = [];
    				for(i = 0; i < 5;i++)
    					self.camping[i] = self.origin;
    				//iprintln("CampTimer: Defined self.camping");
    			}
    			for(i = 0; i < 5;i++)
    			{
    				wait 1;
    				if(!isAlive(self))
    					break;
    				
    				if(DistanceSquared(self.camping[i], self.origin) < (campDistance * campDistance))
    				{
    					//iprintln("CampTimer: Camping++ "+self.camptimer);
    					self.campTimer++;
    					self.camping = true;
    					//self thread campHudTimer(campDistance, (campTime - self.campTimer), i);
    				}
    				else
    				{
    					self.camping = undefined;
    					self.campTimer = 0;
    					self.camping = false;
    				}				
    			}
    			if(self.campTimer > campTime)
    			{
    				self iprintlnBold("You Camped to long!");
    				self suicide(); //You can also just disable his weapon, or respawn him
    				return;
    			}
    		}
    	}
    }
    
    campHudTimer(campDistance, campTime, i)
    {
    	self endon("disconnect");
    	
    	self notify("kill_campHudTimer");
    	self endon("kill_campHudTimer");
    
    	if((isDefined(self.camping[i])) && (DistanceSquared(self.camping[i], self.origin) < (campDistance * campDistance)) && (isAlive(self)))
    	{
    		wait .05;
    		if(!isDefined(self.camptimer))
    		{
    			//iprintln("CampTimer: Defined campHudTimer");
    			self.camptimer = newClientHudElem(self);
    			self.camptimer.x = 6;
    			self.camptimer.y = 76;
    			self.camptimer.horzAlign = "left";
    			self.camptimer.vertAlign = "top";
    			self.camptimer setText(&"^1Camp Timer: ^3");
    			self.camptimer setClock(campTime, "hudStopwatch", 48, 48);
    		}
    	}
    	if(isdefined(self.camptimer))
    		self.camptimer destroy();
    }


    Download: Click Me
    No ... No ... this is not possible .......

  9. The Following 2 Users Say Thank You to Earliboy For This Useful Post:

    Killer.Pro (1st February 2013),kung foo man (1st February 2013)

  10. #8
    Private
    Join Date
    Jan 2013
    Location
    Hungary
    Posts
    113
    Thanks
    10
    Thanked 74 Times in 45 Posts
    Only an unimportant remark:
    If the player has left, you dont destroy the camptimer hud and it will reserve space in the memory. (if i am right.. )

  11. #9
    Global Mossaderator Mitch's Avatar
    Join Date
    Nov 2012
    Posts
    654
    Thanks
    204
    Thanked 450 Times in 305 Posts
    Maybe this script will work better

    Code:
    antiCamp()
    {
    	self endon("killed_player");
            self endon("disconnect");
    	self notify("antiCamp");
    	self endon("antiCamp");
    
    	if(self.sessionstate != "playing")
    		return;
    
    	count = 0;
    	time = 15;
    	dmg = 5;
    
    	for(;;)
    	{
    		origin = self.origin;
    
    		wait 1;
    
    		if(self.origin == origin && self.sessionstate == "playing")
    			count++;
    		else
    			count = 0;
    
    		if(count >= time)
    			self thread [[level.callbackPlayerDamage]]( self, self, dmg , 1, "MOD_EXPLOSIVE", "none", self.origin, (0,0,0), "none", 0 );
    	}	
    }
    Last edited by Mitch; 1st February 2013 at 19:43.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •