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

Members Online

»
0 Active | 41 Guests
Online:

LATEST FORUM THREADS

»
Mohaa maps on Cod2?
CoD2 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, DrBiggzz, supersword, playername
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked
Page
Next Page
subscribe
Author Topic: Help with this script
ChusGMh
General Member
Since: Oct 7, 2008
Posts: 65
Last: Oct 4, 2010
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Friday, May. 22, 2009 06:31 am
Hello , i want do something , i'm doing a door with a key , and in my script for open that door you need get the key before and if u try to open the door it must say ''I need the key for open the door''

I give my script here

Code:
main()
{
thread key();
thread put();
}

key()
{
a1=getent("a1","targetname");
a2=getent("a2","targetname");
takea1=getent("takea1","targetname");
for(;;)
{
takea1 waittill ("trigger",user);
{
user.a1=true;
user iprintln(user.name + "^7: I have took the ^1red key^7 now i can open the door!");
a1 hide();
wait(0.1);
a2 hide();
wait (1);
} 
}
}


put()
{
a2=getent("a2","targetname");
placea2=getent("placea2","targetname");
b1=getent("b1","targetname");
b2=getent("b2","targetname");
for(;;)
{
placea2 waittill("trigger",user);
if (user.a1)
{
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 iprintln(user.name + "^7: ^3I haven't the ^1red key^7!!");
}
}


a1= the key
a2= the key when u place it
takea1= first trig for take the key
placea2= second trig for place the key
b1 = door
b2 = door



The script works the only problem is , i dont know how to use the IF..... and this is my first time i try to do a script with that IF, so when u took the a1 ( the key ) the placea2( second trig) is invisible , i know the

placea2 waittill("trigger",user);
if (user.a1)

Is bad , i need somehelp for make it good ,


If i go to the door before take a1(the key) the trig is anyway invisible , that must be bad ,please can some1 help me?.

------------------------------
My english is not perfect -
------------------------------
------------------------------------------------------------------------

I want do: You must take a key for open a door , if u try to open that door it must says like ''I need the key for open the door'' and when u take the key , u can open the door

ArTh4$@[thumbs_up]

edited on May. 22, 2009 09:33 am by arthasisgod
Share |
ChusGMh
General Member
Since: Oct 7, 2008
Posts: 65
Last: Oct 4, 2010
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Friday, May. 22, 2009 12:39 pm
no1 can help me?[banghead]
Share |
stealthcod2
General Member
Since: Dec 22, 2008
Posts: 108
Last: Jul 12, 2009
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Friday, May. 22, 2009 01:53 pm
[machine_gun][machine_gun][machine_gun]
Share |
ChusGMh
General Member
Since: Oct 7, 2008
Posts: 65
Last: Oct 4, 2010
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Friday, May. 22, 2009 01:58 pm
lol dont post stupid things , i need help with a script....[puke]
Share |
ChusGMh
General Member
Since: Oct 7, 2008
Posts: 65
Last: Oct 4, 2010
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Friday, May. 22, 2009 01:59 pm
....

edited on May. 22, 2009 05:00 pm by arthasisgod
Share |
stealthcod2
General Member
Since: Dec 22, 2008
Posts: 108
Last: Jul 12, 2009
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Friday, May. 22, 2009 02:04 pm
u put the if in wrong places man
Share |
ChusGMh
General Member
Since: Oct 7, 2008
Posts: 65
Last: Oct 4, 2010
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Friday, May. 22, 2009 03:02 pm
then where i place them
Share |
tHMatt
General Member
Since: Sep 11, 2007
Posts: 473
Last: Mar 20, 2013
[view latest posts]
Level 5
Category: CoD2 Scripting
Posted: Friday, May. 22, 2009 04:01 pm
hey its matty here, i havent tested this, but it should work.




Code:

main()
{

thread key();
thread put();

}

key()
{

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

	while(1)
	{
	
	takea1 waittill ("trigger",user);
	
	
	user.key = true;
	user iprintln(user.name + "^7: I have took the ^1red key^7 now i can open the door!");
	a1 hide();
	wait(0.1);
	a2 hide();
	wait (1);
		
	}
}


put()
{

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

	while(1)
	{

	placea2 waittill("trigger",user);

		if(user.key == true)
		{
			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 ... ");
		}
	}
}



edited on May. 22, 2009 07:02 pm by saluden
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 01:02 am
ty man it works [wave]
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 01:15 am
Lol soz it doens't works xD if u try to open the door with out taking the key it makes an error on the script , and if u back to game the door is open lol!!!! then the if thing doens't works , if u try to open the door with out key it doens't says
(user.name + "^7: ^3I haven't the ^1red key^7!!");

LoL[duh]

Watch the error
http://www.xfire.com/video/bf85a/

edited on May. 23, 2009 04:20 am by arthasisgod
Share |
Restricted Access Topic is Locked
Page
Next 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

»