classification

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

classification

Post by Goro92 » June 18th, 2011, 9:26 am

i need help...

I want to create a kind of ranking to determine who finishes first, who finishes second and who ends third

sorry for my english
Image

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

Re: classification

Post by megazor » June 18th, 2011, 10:44 am

OMFG, I have never seen more terrible English!

Firstly learn it - and once you know it perfectly, come to the forums with your questions. I couldn't understand what you wrote, and doubt anyone will be able to.

User avatar
XeloX
CJ Newbie
CJ Newbie
Posts: 74
Joined: February 13th, 2010, 9:58 pm

Re: classification

Post by XeloX » June 18th, 2011, 11:03 am

megazor wrote:OMFG, I have never seen more terrible English!

Firstly learn it - and once you know it perfectly, come to the forums with your questions. I couldn't understand what you wrote, and doubt anyone will be able to.
He wants a script that shows who finished in first, second and third place on a jumping map.
That was not that hard to understand, i wont force anybody to learn a foreign language to ask a question with perfect grammar.
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: classification

Post by Rezil » June 18th, 2011, 12:49 pm

Ignore megazor, he's trying to be sarcastic over the internet. You'll need a timer and to check when each player triggered your end trigger. Then give the first three players the according ranking.
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.

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

Re: classification

Post by Goro92 » June 18th, 2011, 1:54 pm

Rezil wrote:Ignore megazor, he's trying to be sarcastic over the internet. You'll need a timer and to check when each player triggered your end trigger. Then give the first three players the according ranking.
first of all sorry 4 my english

i tried to create a timer by using your script (sorry :D) viewtopic.php?f=11&t=12522&hilit=timer

but doesn't work >.<...yep i know i've deleted the hudelem and something else

Code: Select all

main()
{
  

   thread start();
   thread simple_stopwatch();
   thread stopwatch_end();
   
   level.time_interrupted = false;


}

start()
{   
   for(;;)
   {
      p = getentarray("self", "classname");
      for(i=0;i<p.size;i++)
      {
         if ((!isdefined(p[i].reset)) && (isalive(p[i])))
         {
            p[i].reset = true;
            p[i].triggered_timer = false;
            p[i] thread watchselfTime();
         }
      }
      wait 0.25;
   }
}

simple_stopwatch()
{
   t = getent("start_trigger","targetname"); 
   while(1)
   {
      t waittill("trigger", player);
      level.time_interrupted = false;
      if(!self.triggered_timer)
      {
         level.time_interrupted = false;
         player.triggered_timer = true;
         if((!isdefined(player.secondwatch)) && (!isdefined(player.minutewatch)))
         {
            self thread make_secondswatch();
            self thread make_minuteswatch();
            
         }
      }
     
   }
}

make_secondswatch()
{

   for(;;)
   {
      secondtime = 0;
      secondtime = secondtime * 10;
      seconds = 0;
      for(i=seconds;i<=599;i++)
      {
         if(level.time_interrupted)
         {
            seconds = 0;
            break;
         }
         self.secondtime = i / 10;
        
         wait 0.1;
      }
      wait 0.05;
   }

}
make_minuteswatch()
{

   minutes = 0;

   for(i=minutes;i>=0;i++)
   {
      if(level.time_interrupted)
      {
         minutes = 0;
         break;
      }
     
      if(self.secondtime == 599/10) self.minutetime++;
      wait 0.1;
   }


}

watchselfTime()
{
   for(;;)
   {
      if(self.triggered_timer) 
      {
         
         {
           
            level.time_interrupted = true;
            self.triggered_timer = false;
            self.secondtime = 0;
            self.minutetime = 0;
           
            
            wait 0.05;
         }
      }
      wait 0.05;
   }
}
stopwatch_end()
{
   t = getent("end_trigger","targetname"); //Change!

   while(1)
   {
      t waittill("trigger", player);
      if(player.triggered_timer)
      {
         player.triggered_timer = false;
         level.time_interrupted = true;

 if ( isPlayer( player ) && isAlive( player ) && isdefined( player.done ) ) 
               {
               wait 0.5;
               }
      else  
         {
 player iprintlnbold("You finished in " +self.minutetime+ " minutes and " +self.secondtime, " seconds."); 
         self.secondtime = 0;
         self.minutetime = 0;
         self.done = true; 


  wait 0.05;
         }
        
     
       
      }
     

   }
}
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: classification

Post by Rezil » June 18th, 2011, 2:46 pm

First off, if you want to use my code, you're free to do so. Second, you should've copied my script in its entirety, test it and then remove the HUD elements if you want to. You'll also have to add a variable to check which player triggered the end trigger.
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.

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

Re: classification

Post by Goro92 » June 18th, 2011, 2:55 pm

Rezil wrote:First off, if you want to use my code, you're free to do so
thx :mrgreen:


the script works now
Rezil wrote:You'll also have to add a variable to check which player triggered the end trigger.
ok but how?xD
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: classification

Post by Rezil » June 19th, 2011, 12:45 am

Remove the hud elements by finding the variables that start with newHUDElem(); or newClientHUDElem(<player>); and deleting everything related to that variable.
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.

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

Re: classification

Post by Goro92 » June 19th, 2011, 8:32 am

Rezil wrote:Remove the hud elements by finding the variables that start with newHUDElem(); or newClientHUDElem(<player>); and deleting everything related to that variable.

the timer works well

but i still don't understand this
Rezil wrote:You'll also have to add a variable to check which player triggered the end trigger.
Image

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest