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

Members Online

»
0 Active | 40 Guests
Online:

LATEST FORUM THREADS

»
eXtreme+ v2.9
CoDBO Map + Mod Releases

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, DrBiggzz, supersword, playername
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked
Page
Previous Page
subscribe
Author Topic: Help with this script
PwN3R
General Member
Since: Jun 19, 2008
Posts: 96
Last: Mar 17, 2010
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Saturday, May. 23, 2009 01:49 am
Try this one,matty's one had a litle bugs

main()
{
thread put();
thread key();

}

put()
{

a2=getent("a2","targetname");
placea2=getent("placea2","targetname");
b1=getent("b1","targetname");
b2=getent("b2","targetname");

while(1)
{

placea2 waittill("trigger",user);

if (isDefined(user.key))
{

a2 show();
a2 movez (-30,7,1.9,1.9);
a2 waittill ("movedone");
a2 hide();
wait(1);
b1 movey(64,2,0.5,0.5);
b1 waittill ("movedone");
b2 movey(-64,2,0.5,0.5);
b2 waittill ("movedone");
wait(1);
}
else
{
user iprintlnbold("You dont have the key ... ");
}
}

}
key()
{

a1=getent("a1","targetname");
a2=getent("a2","targetname");
placea2=getent("takea1","targetname");

while(1)
{

placea2 waittill ("trigger",user);


if(!isDefined(user.key))
{
user iprintln(user.name + "^7: I have took the ^1red key^7 now i can open the door!");
user.key = true;
a1 hide();
wait(0.1);
a2 hide();
wait (1);
}
else
user iprintlnbold("You have already this key");

}
}
Share |
DemonSeed
General Member
Since: Apr 30, 2009
Posts: 1362
Last: Feb 19, 2018
[view latest posts]
Level 8
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Saturday, May. 23, 2009 02:01 am
Or you can try this one:

Code:
main()
{
	takea1=getent("takea1","targetname");
	takea1 thread key();
	
	placea2=getent("placea2","targetname");
	placea2 thread put();
}

key()
{
	a1=getent("a1","targetname");
	a2=getent("a2","targetname");
	
	for(;;)
	{
		self waittill ("trigger", user );
		
		if( isPlayer( user ) )
		{
			user.done = undefined;
			
			while( isAlive( user ) && user isTouching( self ) )
			{
				user iprintln( user.name + "^7: You have taken the ^1red key^7 now you can open the door!" );
				a1 hide();
				wait(0.1);
				a2 hide();
		
				user.done = true;
				wait 1;
			}
		}
		
	}
}


put()
{
	a2=getent("a2","targetname");
	b1=getent("b1","targetname");
	b2=getent("b2","targetname");
	
	for(;;)
	{
		self waittill( "trigger", user );
		
		if( isPlayer( user ) )
		{
			while( isAlive( user ) && user isTouching( self ) && isdefined( user.done ) )
			{
				a2 show();
				a2 movez (-30,7,1.9,1.9);
				a2 waittill ("movedone");
				a2 hide();
				wait(1);
				b1 movey(64,2,0.5,0.5);
				b1 waittill ("movedone");
				b2 movey(-64,2,0.5,0.5);
				b2 waittill ("movedone");
				
				user.done = undefined;
				wait 1;
			}
			else 
			{
				user iprintln( user.name + "^7: ^3You haven't got the ^1red key^7!!");
				user.done = undefined;
			}
		} 

	}
}
Share |
ChusGMh
General Member
Since: Oct 7, 2008
Posts: 65
Last: Oct 4, 2010
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Saturday, May. 23, 2009 04:35 am
lol , very thx demonseed , ur script is too advanced :P anyway with the help of pwner we done it but thx [wave][wave][wave]
Share |
DemonSeed
General Member
Since: Apr 30, 2009
Posts: 1362
Last: Feb 19, 2018
[view latest posts]
Level 8
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Saturday, May. 23, 2009 05:12 am
But PAWNER's script has no check for what entity "user" is. You could drive a tank over the trigger and it would still trigger.

Also, if "user" is a player, there is no check for whether "user" is alive. If they get killed while in the trigger, user.key would still be boolean, but wouldnt be able to trigger placea2.
Share |
ChusGMh
General Member
Since: Oct 7, 2008
Posts: 65
Last: Oct 4, 2010
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Saturday, May. 23, 2009 05:15 am
no problem lol atm this script is not important for me , i just was trying to use the ''if things'' that's all this script is just a little test [jumping]
Share |
PwN3R
General Member
Since: Jun 19, 2008
Posts: 96
Last: Mar 17, 2010
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Saturday, May. 23, 2009 05:18 am
LOLOLOLOLOLOLOLOLOL...xD

1 My name is PwN3R NOT PAWNER
2Why that poo-poo?both scripts are useful
3LMFAO
Share |
stealthcod2
General Member
Since: Dec 22, 2008
Posts: 108
Last: Jul 12, 2009
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Saturday, May. 23, 2009 09:51 am
lol pwner.
Share |
DemonSeed
General Member
Since: Apr 30, 2009
Posts: 1362
Last: Feb 19, 2018
[view latest posts]
Level 8
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Saturday, May. 23, 2009 12:32 pm
PwN3R writes...
Quote:

2Why that poo-poo?both scripts are useful


Why? Because getting the script right the first time avoids problems later on. I pointed out the problems in your script, so as to help the OP avoid headaches later on.

A script which is buggy, or which will incur problems later on, is not "useful" to anyone.

This is nothing personal. It's solid, sound adivice from a professional software engineer, who codes for a living. Lets keep the kiddie comments out of it, eh?
Share |
Restricted Access Topic is Locked
Page
Previous Page
subscribe
MODSonline.com Forums : Call of Duty 2 : CoD2 Scripting

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

»