Page 1 of 1
classification
Posted: June 18th, 2011, 9:26 am
by Goro92
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
Re: classification
Posted: June 18th, 2011, 10:44 am
by megazor
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.
Re: classification
Posted: June 18th, 2011, 11:03 am
by XeloX
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.
Re: classification
Posted: June 18th, 2011, 12:49 pm
by Rezil
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.
Re: classification
Posted: June 18th, 2011, 1:54 pm
by Goro92
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

)
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;
}
}
}
}
Re: classification
Posted: June 18th, 2011, 2:46 pm
by Rezil
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.
Re: classification
Posted: June 18th, 2011, 2:55 pm
by Goro92
Rezil wrote:First off, if you want to use my code, you're free to do so
thx
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
Re: classification
Posted: June 19th, 2011, 12:45 am
by Rezil
Remove the hud elements by finding the variables that start with newHUDElem(); or newClientHUDElem(<player>); and deleting everything related to that variable.
Re: classification
Posted: June 19th, 2011, 8:32 am
by Goro92
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.