Login x
User Name:
Password:
Social Links Facebook Twitter YouTube Steam RSS News Feeds
Watch MODSonair

Members Online

»
0 Active | 52 Guests
Online:

LATEST FORUM THREADS

»
New BF2 Mod
BF2 General

Forums

»

Welcome to the MODSonline.com forums. Looking for Frequently Asked Questions? Check out our FAQs section or search it out using the SEARCH link below. If you are new here, you may want to check out our rules and this great user's guide to the forums and the website.
For more mapping and modding information, see our Wiki: MODSonWiki.com

Jump To:
Forum: All Forums : Call of Duty
Category: CoD+UO General
General game questions, comments, and chat.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked subscribe
Author Topic: anti camping mod
bubbazan68
General Member
Since: May 23, 2010
Posts: 62
Last: Oct 2, 2016
[view latest posts]
Level 3
Category: CoD+UO General
Posted: Tuesday, Mar. 27, 2012 11:08 pm
ok i know awe has an anti camping mod but that is the only part i need for our server
i have an anti camp GSC that just has a time limit , is there a way to make it into an area limit?
waht i mean is if a player stays in one area to long he will get a message this one is if he does not move


//
Code:
-----------------------
// Anti camping and AFK handler
//Not my own work - borrowed from
//Pam UO
//-----------------------

main() {

level thread afkmonitor();

}



afkmonitor()
{
		
	setcvar("sv_madness_afk", "30");
	wait 1;
	
	while(1)
	{
			afk_limit = getcvarint("sv_madness_afk");
		
		// Make sure no one sets it TOOOO low
		if (afk_limit < 30 && afk_limit > 0)
			afk_limit = 30;

		if (afk_limit > 0)
		{
			players = getentarray("player", "classname");
			for(i = 0; i < players.size; i++)
			{
				player = players[i];

				if (!isDefined(player.pers["old_origin"]))
					player.pers["old_origin"] = player.origin;

				if (!isDefined(player.pers["afk_timer"]))
					player.pers["afk_timer"] = 0;

				// Check to see if they are on a team
				if (player.pers["team"] == "spectator")
				{
					player.pers["afk_timer"] = 0;
					continue;
				}

				// Check to make sure the player is ALIVE
				if (!isAlive(player))
				{
					player.pers["afk_timer"] = 0;
					continue;
				}

				if (player.pers["old_origin"] == player.origin)
				{
					player.pers["afk_timer"] = player.pers["afk_timer"] + 5;
					timerleft = afk_limit - player.pers["afk_timer"];

					if (player.pers["afk_timer"] >= afk_limit)
					{
						thisPlayerNum = player getEntityNumber();
						player iprintlnbold("^3You were obliterated for Camping");
						//setcvar("g_switchspec", thisPlayerNum);
						
						smiteplayer(player);
						
						wait 1.1;
					}
					else if (timerleft < 21 && timerleft > 15)
					{
						player iprintlnbold("^3Warning, you seem to be Camping due to lack of movement");
						player iprintlnbold("^3Soon you will be dealt a mighty blow if you don't start moving");
					}
				}
				else
				{
					player.pers["afk_timer"] = 0;
					player.pers["old_origin"] = player.origin;
				}

			}

		}

		wait 5;
	}
}


smiteplayer(player) // make a player explode, will hurt people up to 15 feet away
{
				if(isAlive(player) && player.sessionstate == "playing")
				{
					// explode 
					range = 180;
					maxdamage = 150;
					mindamage = 10;

					playfx(level._effect["tigertankexplosion"], player.origin);
					radiusDamage(player.origin + (0,0,12), range, maxdamage, mindamage);
					iprintln("^1Behold, for Camping  longer than 30 seconds^7 " + player.name + "^1 was smote a mighty blow!^7");
				}
				else
					return;
}
Share |
serthy
General Member
Since: Sep 8, 2010
Posts: 482
Last: Jun 28, 2013
[view latest posts]
Level 5
Im a fan of MODSonair
Category: CoD+UO General
Posted: Wednesday, Mar. 28, 2012 12:16 am
Code:
-----------------------
// Anti camping and AFK handler
//Not my own work - borrowed from
//Pam UO
//-----------------------

main() {

level thread afkmonitor();

}



afkmonitor()
{
		
	setcvar("sv_madness_afk", "30");
	setcvar("sv_madness_afkrange", "64");

	wait 1;
	
	while(1)
	{
			afk_limit = getcvarint("sv_madness_afk");
			afk_range = getcvarint("sv_madness_afkrange");
		
		// Make sure no one sets it TOOOO low
		if (afk_limit < 30 && afk_limit > 0)
			afk_limit = 30;

		if (afk_limit > 0)
		{
			players = getentarray("player", "classname");
			for(i = 0; i < players.size; i++)
			{
				player = players[i];

				if (!isDefined(player.pers["old_origin"]))
					player.pers["old_origin"] = player.origin;

				if (!isDefined(player.pers["afk_timer"]))
					player.pers["afk_timer"] = 0;

				// Check to see if they are on a team
				if (player.pers["team"] == "spectator")
				{
					player.pers["afk_timer"] = 0;
					continue;
				}

				// Check to make sure the player is ALIVE
				if (!isAlive(player))
				{
					player.pers["afk_timer"] = 0;
					continue;
				}

				if (player.pers["old_origin"] == player.origin || distancesquared( player.pers["old_origin"] , player.origin ) >= afk_range )
				{
					player.pers["afk_timer"] = player.pers["afk_timer"] + 5;
					timerleft = afk_limit - player.pers["afk_timer"];

					if (player.pers["afk_timer"] >= afk_limit)
					{
						thisPlayerNum = player getEntityNumber();
						player iprintlnbold("^3You were obliterated for Camping");
						//setcvar("g_switchspec", thisPlayerNum);
						
						smiteplayer(player);
						
						wait 1.1;
					}
					else if (timerleft < 21 && timerleft > 15)
					{
						player iprintlnbold("^3Warning, you seem to be Camping due to lack of movement");
						player iprintlnbold("^3Soon you will be dealt a mighty blow if you don't start moving");
					}
				}
				else
				{
					player.pers["afk_timer"] = 0;
					player.pers["old_origin"] = player.origin;
				}

			}

		}

		wait 5;
	}
}


smiteplayer(player) // make a player explode, will hurt people up to 15 feet away
{
				if(isAlive(player) && player.sessionstate == "playing")
				{
					// explode 
					range = 180;
					maxdamage = 150;
					mindamage = 10;

					playfx(level._effect["tigertankexplosion"], player.origin);
					radiusDamage(player.origin + (0,0,12), range, maxdamage, mindamage);
					iprintln("^1Behold, for Camping  longer than 30 seconds^7 " + player.name + "^1 was smote a mighty blow!^7");
				}
				else
					return;
}


added afk_range with cvar sv_madness_afkrange
Share |
bubbazan68
General Member
Since: May 23, 2010
Posts: 62
Last: Oct 2, 2016
[view latest posts]
Level 3
Category: CoD+UO General
Posted: Wednesday, Mar. 28, 2012 09:06 am
ok tired it and now when i sit for the 30 seconds and then move i get

cannot cast undefined to int: (file'maps\mp\camp.gsc', line104)
playfx(level._effect["tigertankexplosion"], player.origin);
called from;(file'maps\mp\camp.gsc', line70)
smiteplayer(player);
called from;(file'maps\mp\camp.gsc', line90)
wait5;





like now the rage automaticly targets the player and it want to try to blow him up no matter how far he moves
Share |
Restricted Access Topic is Locked subscribe
MODSonline.com Forums : Call of Duty : CoD+UO General

Latest Syndicated News

»
Codutility.com up and runn...
Nice, and there still using the logo and template for the screenshots, which...
Codutility.com up and runn...
dundy writes...Quote:Call of Duty modding and mapping is barly alive only a ...
Codutility.com up and runn...
Mystic writes...Quote:It seems to me the like the site is completely dead? ...
Codutility.com up and runn...
It seems to me the like the site is completely dead?

Partners & Friends

»