iprintlnbold script help

Have questions about CoD4 mapping that aren't covered in the tutorials section? Post here!

Moderator: Core Staff

Post Reply
User avatar
Goro92
CJ Spammer!
CJ Spammer!
Posts: 605
Joined: March 7th, 2011, 5:54 pm
Location: Brescia, Italy

iprintlnbold script help

Post by Goro92 » April 19th, 2011, 2:02 pm

i want to make a script that shows ONLY one time for each player the iprintlnbold message like the end of peds propel
i tried this but doesn't work :(

with this script only one player can show the message
i tried also with " player wait 1000 "but i knew that was a stupid thing xD

Code: Select all

main()
{
thread finishmap();
}
 
finishmap()
{
trigger = getent ("finishmap","targetname");
 
while (1)
{
   
 
 
trigger waittill ("trigger",player);
if(isdefined(player.down)) return;
player iprintlnbold ("^1Congratulation, ^7" +player.name + "^1, You have finished the map^7!!!");     
 
 
 
 
 wait 10000.0;
 
 
}
}
 
help me :D
Image

megazor
CJ Worshipper
CJ Worshipper
Posts: 414
Joined: July 22nd, 2009, 3:02 am
Location: Russia, Vladivostok

Re: iprintlnbold script help

Post by megazor » April 19th, 2011, 3:30 pm

btw, triggers catch only alive players, so checking for only 'player.done' is enough.

User avatar
Goro92
CJ Spammer!
CJ Spammer!
Posts: 605
Joined: March 7th, 2011, 5:54 pm
Location: Brescia, Italy

Re: iprintlnbold script help

Post by Goro92 » April 19th, 2011, 4:42 pm

KillerSam wrote:Try this code:

Code: Select all

main()
{
thread finishmap();
}

finishmap()
{
trigger = getent("finishmap","targetname");

   while (1)
   {
      trigger waittill ("trigger", user );
      if ( isPlayer( user ) && isAlive( user ) && isdefined( user.done ) ) //checks if player is already done
               {
               wait 0.5;
               }
      else  //if not already done, display the message
         {
user iprintlnbold ("Congratulations, " + user.name + ", you have completed the map!");   
         user.done = true; //set the player to "done" so that it doesn't show again to that player.
         }
   }
}

THANK YOU! :mrgreen:
Image

User avatar
Rezil
Core Staff
Core Staff
Posts: 2030
Joined: July 24th, 2006, 11:21 am
Location: Cramped in a small cubicle/making another jump map

Re: iprintlnbold script help

Post by Rezil » April 19th, 2011, 6:42 pm

Unnecessary if-else and checking too much, this is enough:

Code: Select all

main()
{
	thread finishmap();
}

finishmap()
{
	trigger = getent("finishmap","targetname");

	while (1)
	{
		trigger waittill ("trigger", user);
		if (!isdefined(user.done))
		{
			user iprintlnbold ("Congratulations, " + user.name + ", you have completed the map!");   
			user.done = true; //set the player to "done" so that it doesn't show again to that player.
		}
	}
}
Drofder2004: Drofder's rules for reviewing a map
[...]
#5 If your name is Rezil, minimum 5/5.
---
<LT>YosemiteSam[NL]:
I heard somewhere that the best way to start is juggling 2 balls with one hand, so you will get a feel for it.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests