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

Members Online

»
0 Active | 14 Guests
Online:

LATEST FORUM THREADS

»
water
CoD4 MP Mapping
Rainbow HELP....
CoD4 MP Mapping

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 2
Category: CoD2 Scripting
Scripting and coding with Call of Duty 2.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, supersword, playername
Latest Posts
Subscribed Posts
Search
Restricted Access Restricted Access
Page
Next Page
subscribe
Author Topic: Standalone Anti Camper Mod
SanchoMLD
General Member
Since: Jul 18, 2012
Posts: 22
Last: Jul 27, 2012
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Sunday, Jul. 22, 2012 02:08 am
Code:
//  **  *************************************************************************************************  **  //
//	**		OO StandAlonCamperMod 	© Olle Otze		contact [email=theodyn@arcor.de]theodyn@arcor.de[/email]     www.HellZone-am.de		   **  //
//  **  *************************************************************************************************  **  //

/*  *****************************************************************************************************  **  //
	
	Filelocation of gametypes: maps\mp\gametypes\
	
	The next 2 lines u must paste at the end of the funktion main() in your gametype (dm.gsc, tdm.gsc, sd.gsc,...)
	
/// ** Variables for the OO StandAlonCamperMod ** ///
	maps\mp\gametypes\_camping::Variables();<br />
<br />
<br />
<br />
	The next 2 lines u must paste at the end of the funktion Callback_StartGameType() in your gametype (dm.gsc, tdm.gsc, sd.gsc,...)

/// ** Launch the OO StandAlonCamperMod ** ///
	thread maps\mp\gametypes\_camping::main();

	This file (_camping.gsc) must be located in the same place like u gametypfiles: maps\mp\gametypes\

*/// ****************************************************************************************************  **


Variables(){	

	//get cvar
	level.no_camper	= cvardef("no_camper", "", "", "","string");
	level.campwarntime = cvardef("campwarntime", 0, 0, 300, "int");
	level.campobjtime = cvardef("campobjtime", level.campwarntime+10, level.campwarntime+5, 600, "int");
	level.camptimer = cvardef("camptimer", 20, 0, 300, "int");
	level.campsniper_warntime = cvardef("campsniper_warntime", 0, 0, 600, "int");
	level.campsniper_objtime = cvardef("campsniper_objtime", level.campsniper_warntime+10, level.campsniper_warntime+5, 1200, "int");
	
	
	//Load fx effects
	level.effect["fartbomb"] = loadfx("fx/fart/fartsmoke.efx");
	
	//precache
	level thread Precache();
	
	//set variables
	level.iscamper = false;
}

cvardef(varname, vardefault, min, max, type){

	mapname = getcvar("mapname");
	gametype = getcvar("g_gametype");
	multigtmap = gametype + "_" + mapname;

	tempvar = varname + "_" + gametype;
	if(getcvar(tempvar) != "") varname = tempvar;

	tempvar = varname + "_" + mapname;
	if(getcvar(tempvar) != "") varname = tempvar;

	tempvar = varname + "_" + multigtmap;
	if(getcvar(tempvar) != "") varname = tempvar;


	switch(type){
	
		case "int":
		if(getcvar(varname) == "") definition = vardefault;
		else definition = getcvarint(varname);
		break;
		
		case "float":
		if(getcvar(varname) == "") definition = vardefault;
		else definition = getcvarfloat(varname);
		break;
		
		case "string":
		default:
		if(getcvar(varname) == "") definition = vardefault;
		else definition = getcvar(varname);
		break;
	}

	if(type != "string"){
	
		
		if(min != 0 && definition < min) definition = min;
		else if(max != 0 && definition > max) definition = max;
	}

	return definition;
}

Precache(){

	precacheShader("objpoint_radio");
	precacheShader("field_radio");
}

main(){

	//start standalone
	level thread onPlayerConnect();
	
	level PrecacheTeamBased();	
}

PrecacheTeamBased(){

	switch(game["allies"]){
		
		case "american":	precacheShader("objective_american"); break;
		case "british":		precacheShader("objective_british"); break;
		default:			precacheShader("objective_russian"); break;
	}

	precacheShader("objective_german");
}

onPlayerConnect(){

	self endon("disconnect");

	if(getcvar("mapname") == level.no_camper) return;
	if(getcvar("g_gametype") == level.no_camper) return;

	
	for(;;){
	
		level waittill("connecting", player);
		
		player thread onJoinedTeam();
		player thread onPlayerKilled();
	}
}

onJoinedTeam(){

	self endon("disconnect");
	
	for(;;){
	
		self waittill("joined_team");
		
		self thread CheckCamping();
	}
}

onPlayerKilled(){

	self endon("disconnect");
	
	for(;;){
	
		self waittill("killed_player");
		
		self thread MessageCamperDied();
	}
}

CheckCamping(){

	level endon("round_ended");
	self endon("disconnect");
	
	campingtime = 0;
	snipercampingtime = 0;
	show_warning = false;

	for(;;){
	
		wait 0.5;
		if(level.iscamper) continue;
		
		startpos = self.origin;
		wait 0.5;
		endpos = self.origin;
		
		if(WeaponType(self getcurrentweapon(),"sniper")){
		
			if(level.campsniper_warntime){
			
					if(distance(startpos, endpos) < 20) snipercampingtime++;
						else snipercampingtime = 0;
					
					if(snipercampingtime == level.campsniper_warntime)
						show_warning = true;
			}
			
			else continue;
		}
		
		else{
		
			if(level.campwarntime){
			
				if(distance(startpos, endpos) < 25) campingtime++;
					else campingtime = 0;
				
				if(campingtime == level.campwarntime)
					show_warning = true;
			}
			
			else continue;
		}
		
		if(show_warning){
		
			self iprintlnbold(&"CAMPING_WARNING_MESSAGE_SELF", self.name);
				
			show_warning = false;
		}
		
		if((campingtime >= level.campobjtime || snipercampingtime >= level.campsniper_objtime)){
		
			self thread MarkCamper();
			return;
		}
	}
	
	campingtime = 0;
	snipercampingtime = 0;
	show_warning = false;
	
}

MarkCamper(){

	level endon("gameover");
	level endon("round_ended");

	self endon("dead");
	self endon("stopcamper");
	self endon("disconnect");


	if(self.iscamper || (isDefined(level.roundended) && level.roundended) || self.sessionstate != "playing") return;

	self.objnum = GetObjective();
	
	if(self.objnum){
	
		self.iscamper = true;
		
		self iprintlnbold(&"CAMPING_MARKED_MESSAGE_SELF", self.name);
		self iprintlnbold(&"CAMPING_TIME_MESSAGE_SELF", level.camptimer);
		
		iprintln(&"CAMPING_MARKED_MESSAGE_ALL", self.name);
		iprintln(&"CAMPING_TIME_MESSAGE_ALL", level.camptimer);
		
		compass_team = "none";
		
		if(self.pers["team"] == "allies") compass_icon = "objective_" + game["allies"];
			else compass_icon = "objective_" + game["axis"];
		
		objective_add(self.objnum, "current", self.origin, compass_icon);
		objective_team(self.objnum, compass_team);
		
		if(level.camptimer >= 1)
			self thread CountCamper();
		
		while(isPlayer(self) && isAlive(self) && self.pers["team"] != "spectator"){
		
			for(i=0;(i<60 && isPlayer(self) && isAlive(self));i++){
			
				if((i <= 29) && self.iscamper) objective_icon(self.objnum, "objpoint_radio");
				else if((i >= 30) && self.iscamper) objective_icon(self.objnum, compass_icon);
				
				if(self.iscamper) objective_position(self.objnum, self.origin);
				
				wait 0.05;
			}
			
			if(isPlayer(self)){
			
				playfxontag(level.effect["fartbomb"], self, "pelvis");
				
				self playLocalSound("fart");
			}
		}
	}
}

CountCamper(){

	self endon("dead");
	self endon("disconnect");
	self endon("spawned");

	wait level.camptimer - 1;

	if(isPlayer(self)){
	
		self notify("stopcamper");
		self.iscamper = false;
		
		wait 1;
	}

	if(isAlive(self)){
	
		self iprintlnbold(&"CAMPING_SURVIVED_MESSAGE_SELF", self.name);
		
		iprintln(&"CAMPING_SURVIVED_MESSAGE_ALL", self.name);
		
		self RemoveCamper();
	}
}

MessageCamperDied(){

	if(self.iscamper == true){
	
		self notify("stopcamper");
		
		self.iscamper = false;
		
		self iprintlnbold(&"CAMPING_DIED_MESSAGE_SELF", self.name);
		iprintln(&"CAMPING_DIED_MESSAGE_ALL", self.name);
		
		self RemoveCamper();
	}
}

WeaponType(weapon, type){

	if(!isDefined(weapon)) return false;

	switch(type){
	
		case "sniper":
		switch(weapon){
		
			case "mosin_nagant_sniper_mp":
			case "springfield_mp":
			case "kar98k_sniper_mp":
			case "enfield_scope_mp": return true;
			default: return false;
		}
	}
	
	return false;
}

RemoveCampers(){

	player = "";
	players = getentarray("player", "classname");

	for(i = 0; i < players.size; i++){
	
		if(isPlayer(players[i]) && isDefined(players[i].objnum))
		
		players[i] RemoveCamper();
	}
}

RemoveCamper(){

	self endon("dead");
	self endon("disconnect");

	if(isDefined(self.objnum)){
	
		DeleteObjective(self.objnum);
		
		self.objnum = undefined;
	}
	
	self thread CheckCamping();
}

GetObjective(){

	if(!isDefined(level.objectives)) CreateObjectivesArray();

	objnum = 0;

	for(i = 15; i >= 4; i--){
	
		if(level.objectives[i] == 0){
		
			level.objectives[i] = 1;
			objnum = i;
			break;
		}
	}
	
	return objnum;
}

DeleteObjective(objnum){


	if(!isDefined(level.objectives)) CreateObjectivesArray();

	if(level.objectives[objnum] == 1){
	
		objective_delete(objnum);
		level.objectives[objnum] = 0;
	}
}

CreateObjectivesArray(){

	if(!isDefined(level.objectives)) level.objectives = [];

	for(i = 0; i <= 15; i++){
	
		if(i < 4) level.objectives[i] = 1;
		else level.objectives[i] = 0;
	}
}




Code:
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//*** Anti Camper Option ***//
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

// Time, before Movewarning to a Player (No Sniper)
// 0 = disable, max = 300, default = 0
set campwarntime "10"

// Time, before Movewarning to a Player (Sniper)
// 0 = disable, max = 600, default = 0
set campsniper_warntime "20"

// Time, before Punishment starts (No Sniper)
// min = warntime + 5, max = 600 (default = warntime + 10)
set campobjtime "10"

// Time, before Punishment starts (Sniper)
// min = warntime + 5, max = 1200, (default = warntime + 10)
set campsniper_objtime "20"

// Time for Length of Punishment
// 0 = never, max = 300, default = 20
set camptimer "15"

// Or you may wish camper option on a particalar map or
// gametype, or even both?...here are some examples... remember not
// to use // if you decide to create one!

// Gametypes
//set no_camper_dm "1"
set no_camper_sd "1"

// Maps
//set no_camper_mtl_hobbiton "1"
set no_camper_gob_rats "1"
Share |
IzNoGoD
General Member
Since: Nov 29, 2008
Posts: 694
Last: Nov 10, 2012
[view latest posts]
Level 6
Category: CoD2 Scripting
Posted: Sunday, Jul. 22, 2012 04:32 am
Did you write this yourself or did you rip this from some other mod?
Share |
SanchoMLD
General Member
Since: Jul 18, 2012
Posts: 22
Last: Jul 27, 2012
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Sunday, Jul. 22, 2012 06:56 am
IzNoGoD writes...
Quote:
Did you write this yourself or did you rip this from some other mod?


Code:
OO StandAlonCamperMod 	© Olle Otze		contact [email=theodyn@arcor.de]theodyn@arcor.de[/email]     www.HellZone-am.de	


It's not my script.
Share |
IzNoGoD
General Member
Since: Nov 29, 2008
Posts: 694
Last: Nov 10, 2012
[view latest posts]
Level 6
Category: CoD2 Scripting
Posted: Sunday, Jul. 22, 2012 08:55 am
Do you have his permission to post this?
If not, you just infringed copyright.
Share |
SanchoMLD
General Member
Since: Jul 18, 2012
Posts: 22
Last: Jul 27, 2012
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Sunday, Jul. 22, 2012 09:07 am
I dont change code and not delete credits... soo?
Share |
StrYdeR
Preferred PLUS Member
Since: May 11, 2004
Posts: 11606
Last: May 11, 2013
[view latest posts]
Level 10
Admin
Forum Moderator
Im a HOST of MODSonair
Category: CoD2 Scripting
Posted: Sunday, Jul. 22, 2012 09:09 am
SanchoMLD writes...
Quote:
I dont change code and not delete credits... soo?
that is correct
[angryalien]
Go ahead... You Play I Mod : MODSonline.com
Support Modsonline by becoming a PREFERRED MEMBER today
Have you heard the MODSonair Podcast?: www.modsonair.com
MODSonair is a weekly podcast bringing you the news from a modders perspective. Tune in every Sunday at 4pm GMT to listen LIVE.
Share |
IzNoGoD
General Member
Since: Nov 29, 2008
Posts: 694
Last: Nov 10, 2012
[view latest posts]
Level 6
Category: CoD2 Scripting
Posted: Sunday, Jul. 22, 2012 09:20 am
SanchoMLD writes...
Quote:
I dont change code and not delete credits... soo?


Still might be copyright infringment.

Lets say i posted the full windows 7 source code here, but kept original "made by microsoft" credits. It would be copyright infringment.
Share |
Welshy
Preferred Member
Since: Feb 16, 2007
Posts: 1770
Last: May 10, 2013
[view latest posts]
Level 8
Admin
Forum Moderator
Im a fan of MODSonair
Im a HOST of MODSonair
Category: CoD2 Scripting
Posted: Sunday, Jul. 22, 2012 10:23 am
Actually it wouldn't, providing you kept the code exactly the same without modifying anything and left the credits, there would be no copyright infringement (unless you claimed it as your own work) How you got the source code in the first place however, would be a different story, not to mention that in Microsoft's EULA it states that you are not to decompile, post or release any parts of the program.

With regards to the topic, Seeing as they own everything you make for CoD games, the only person that would be affected by copyright infringement would be IW/Activision. This however is a user created code, so there is no chance of that. So seeing as Olle Otze doesn't actually hold a copyright in this case, it cannot be copyright infringement.

It's not even a moral issue. At no point has Sancho claimed it as his own work. The original authors name is in the credits and the code has not been modified in anyway.
Go ahead... You Play I Mod : MODSonline.com
Support Modsonline by becoming a PREFERRED MEMBER today
Have you heard the MODSonair Podcast?: www.modsonair.com
MODSonair is a weekly podcast bringing you the news from a modders perspective. Tune in every Sunday at 5pm GMT to listen LIVE.
Share |
IzNoGoD
General Member
Since: Nov 29, 2008
Posts: 694
Last: Nov 10, 2012
[view latest posts]
Level 6
Category: CoD2 Scripting
Posted: Sunday, Jul. 22, 2012 01:16 pm
Welshy writes...
Quote:

With regards to the topic, Seeing as they own everything you make for CoD games, the only person that would be affected by copyright infringement would be IW/Activision. This however is a user created code, so there is no chance of that. So seeing as Olle Otze doesn't actually hold a copyright in this case, it cannot be copyright infringement.


Im gonna quote you on this.
The EULA for the mod tools did in fact state that everything those tools were used for was IP of IW/activision.

Now, I have made scripts for many years and at times I didnt even have the mod tools installed. Scripting can be done without the need for any mod tools. A text editor (I use windows notepad-dont laugh) and a program that can make zip archives is enough to script.

So no, scripts are one of the few things activision/IW cannot claim as their own for you do not use their tools.

Everything that is clientside (except for the menus) are either made by editting stock files or made using mod tools, and are thus property of IW/activision. I think they did this (at least it is possible) to prevent lawsuits for players downloading "copyrighted" mods using activision/IW programs (CoD).

Copyright also implies that there is one person that has the right to copy/can give others rights to copy. Look at music: You can easily get music files, and, following your reasoning, you can download them for "the person that uploaded it got it in some way". Recent lawsuits show differently.

This is program code of which the copyright lies exclusively with the author as he did not give SanchoMLD permission to copy it to a public forum. As contact information is provided here, the poster should have taken care and asked for permission to post this.

Above stuff is mainly to stand up for every scripter whose script has been stolen and used on other servers, sometimes even WITH credits to the original creator. From a legal point of view, you may not copy any script without expressed permission from the author. If IW claims copyright, they have to prove they are entitled to do so and in many cases, have to actually get a hold of the script which are mostly serverside anyway.

This is how far my rant about this goes about copyright on scripts for an old game that is barely played anymore. Would like to [/offtopic] my post at this point.




Now, [ontopic]

Nice script, although it looks a bit bloated. Could have easily removed the need for multiple modifications in any file. One line should be enough for starters.
Share |
Tally
General Member
Since: Apr 21, 2005
Posts: 819
Last: Oct 26, 2012
[view latest posts]
Level 7
Category: CoD2 Scripting
Posted: Sunday, Jul. 22, 2012 05:55 pm
IzNoGoD writes...
Quote:
Welshy writes...
Quote:

With regards to the topic, Seeing as they own everything you make for CoD games, the only person that would be affected by copyright infringement would be IW/Activision. This however is a user created code, so there is no chance of that. So seeing as Olle Otze doesn't actually hold a copyright in this case, it cannot be copyright infringement.


Im gonna quote you on this.
The EULA for the mod tools did in fact state that everything those tools were used for was IP of IW/activision.

Now, I have made scripts for many years and at times I didnt even have the mod tools installed. Scripting can be done without the need for any mod tools. A text editor (I use windows notepad-dont laugh) and a program that can make zip archives is enough to script.

So no, scripts are one of the few things activision/IW cannot claim as their own for you do not use their tools.

Everything that is clientside (except for the menus) are either made by editting stock files or made using mod tools, and are thus property of IW/activision. I think they did this (at least it is possible) to prevent lawsuits for players downloading "copyrighted" mods using activision/IW programs (CoD).

Copyright also implies that there is one person that has the right to copy/can give others rights to copy. Look at music: You can easily get music files, and, following your reasoning, you can download them for "the person that uploaded it got it in some way". Recent lawsuits show differently.

This is program code of which the copyright lies exclusively with the author as he did not give SanchoMLD permission to copy it to a public forum. As contact information is provided here, the poster should have taken care and asked for permission to post this.

Above stuff is mainly to stand up for every scripter whose script has been stolen and used on other servers, sometimes even WITH credits to the original creator. From a legal point of view, you may not copy any script without expressed permission from the author. If IW claims copyright, they have to prove they are entitled to do so and in many cases, have to actually get a hold of the script which are mostly serverside anyway.

This is how far my rant about this goes about copyright on scripts for an old game that is barely played anymore. Would like to [/offtopic] my post at this point.




Now, [ontopic]

Nice script, although it looks a bit bloated. Could have easily removed the need for multiple modifications in any file. One line should be enough for starters.


This is in essence correct: the mod tools EULA pertains only to MAPPING - all maps are the property of Activision. And even here, a map must contain no custom textures. This was highlighted when IW ran the COD4 mapping contest - all submitted maps could not use custom textures, as Activision could not lay claim to custom textures.

In the case of scripting, it could be argued that as the script language and file format are proprietary, Activision can lay claim to them. However, great swaths of scripting are essentially just C++ and Activision could never lay claim to that.

On the whole, mods are the property of the creator, not Activision. Maps on the other hand, which contain no custom textures are wholly the property of Activison. The mod tools EULA is essentially only there to stop people making a whole new game out of Activision's game assets and prevents someone from selling their work as if it were their own. It is not to give Activision rights to work they did not create.
Share |
Restricted Access Restricted Access
Page
Next Page
subscribe
MODSonline.com Forums : Call of Duty 2 : CoD2 Scripting

Latest Syndicated News

»
Why console gaming is dying
Quote:Consider this: Dedicated gaming sales — including living-room consoles...
Devs: Games are being dumb...
Click 'read more' to view the contents of this post.
Loadout
Gun Crafting to the Max. edited on Sep. 25, 2012 06:57 pm by Morp...
Introducing the Source Fil...
Surprised this wasn't made a long time ago. Sounds like a nice little feature.
Introducing the Source Fil...
The Source Filmmaker (SFM) is the movie-making tool built and used by us he...

Partners & Friends

»