Author |
Topic: Help with this script |
PwN3R |
|
General Member Since: Jun 19, 2008 Posts: 96 Last: Mar 17, 2010 [view latest posts] |
|
|
Category: CoD2 Scripting Posted: Saturday, May. 23, 2009 08: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");
}
} |
|
|
|
DemonSeed |
General Member Since: Apr 30, 2009 Posts: 1362 Last: Feb 19, 2018 [view latest posts] |
|
|
|
Category: CoD2 Scripting Posted: Saturday, May. 23, 2009 09: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;
}
}
}
}
|
|
|
|
ChusGMh |
General Member Since: Oct 7, 2008 Posts: 65 Last: Oct 4, 2010 [view latest posts] |
|
|
Category: CoD2 Scripting Posted: Saturday, May. 23, 2009 11:35 am |
|
|
|
|
|
DemonSeed |
General Member Since: Apr 30, 2009 Posts: 1362 Last: Feb 19, 2018 [view latest posts] |
|
|
|
|
ChusGMh |
General Member Since: Oct 7, 2008 Posts: 65 Last: Oct 4, 2010 [view latest posts] |
|
|
|
PwN3R |
|
General Member Since: Jun 19, 2008 Posts: 96 Last: Mar 17, 2010 [view latest posts] |
|
|
|
stealthcod2 |
|
General Member Since: Dec 23, 2008 Posts: 108 Last: Jul 13, 2009 [view latest posts] |
|
|
|
DemonSeed |
General Member Since: Apr 30, 2009 Posts: 1362 Last: Feb 19, 2018 [view latest posts] |
|
|
|
Category: CoD2 Scripting Posted: Saturday, May. 23, 2009 07: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? |
|
|
|